From: fateman@cs.berkeley.edu   
      
   On 6/17/2015 11:18 AM, Albert Rich wrote:   
      
      
   > Maxima returns 1 for n/n; whereas it returns "0 to a negative exponent" error   
   > for 0/0. Instead of just plowing on with 1 for n/n, for consistency shouldn't   
   > it ask if "is n zero or nonzero?"   
      
   There are several solutions to this problem. At least 3 listed below.   
      
   1. Don't allow division. Build a CAS that does polynomial   
   arithmetic.Boring.   
      
   2. Carry along side conditions. For example, simplification of (n/n)   
   produces an expression equivalent to "if n=0 then undefined else 1."   
   (perhaps written with delta functions or some other hack). This becomes   
   uncomfortable because the side conditions have to be combined and   
   simplified or they grow large. Incorporate some kind of data base in   
   which you can assert that n is not -1. In a world where n can be an   
   argument to a function, a pattern-match variable, a local variable, a   
   mathematical indeterminate, this becomes a challenge. Defining what you   
   really need is difficult.Implementation is likely to be partial, and   
   Hard.   
      
   3. Argue that you are doing computations in an abstract algebra domain   
   in which n/n is 1 even if n=0. (maybe re-enforced by an analytical   
   continuity argument... ). Hence n/n =1 for all n. Well maybe not   
   Interval(-1,1)/Interval(-1,1) or Undefined/Undefined or if someone   
   actually types in 0/0.   
      
   ...............   
   This item 3   
   is different from integrate(x^n,x) because the answer x^(n+1)/(n+1)   
   does not approach log(x) as n -> -1.   
      
   HOWEVER   
   There is another integral of x^n, namely z= (x^(n+1)-1)/(n+1).   
   It differs from the usual answer by 1/(n+1), which is just another   
   value for "plus a constant":)   
      
   why is z preferable? the limit of z as n -> -1 is -- magically -- log(x).   
      
   so One Might Argue that integrate(x^n,x) is better expressed by   
   (x^(n+1)-1)/(n+1) VALID FOR ALL values of n including n=-1 if you just   
   take the limit.   
      
    I know of no CAS that return this value, and presumably RUBI testers   
   would reject it as not being optimal from the perspective of leafcount.   
   Even though it might be "more correct". It could easily be changed   
   in Maxima, unless the benchmark gives some guff.   
      
   Can all "what is the sign of N etc" questions be finessed this way?   
   Nope.   
      
   This doesn't solve the question of how to express integrate(1/(x^2+a),x),   
   which by convention if a is positive is expressed as an arctangent   
   and if a is negative, by log.   
      
   So Maxima asks you if a is pos or neg...   
      
   But if you ask integrate(1/(x^2+q^2),x) then Maxima (by assuming q is real)   
   gives the arctan.   
      
    Unless you say declare(q,complex), then Maxima gives the log.   
   Maybe the thought is that if you know about complex numbers, you know   
   that logs and arctans are related and so won't be confused.   
      
   Epicycles, anyone?   
      
   Incidentally,this also points out that computing the derivative of an   
   integral to see if it agrees with the integrand is not a foolproof test.   
    You generally want to have a result that is simple (perhaps by   
   leafcount) but also one that is maximally continuous. You could add to   
   any result any function whatsoever that has a derivative of zero .. like   
   a step function, and the check might still seem to work, even if the   
   answer was from a symbolic integration perspective slightly bonkers.   
      
      
   RJF   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|