Simplification of infinities



Dieter Kaiser wrote:
> I think I have found a way to implement the simplification of
> infinities, which will work well with the testsuite.
>   

There is another issue here, which is the following:

Does the change slow down the system?


The reason I ask, is that some of these changes may change the logic so 
that there are repeated checks in very common code sequences.

For example,  consider this code:

;; in simplification of   X*Y
;; there is presumably some piece of logic like this:

   if X=0 then 0 else if Y=0 then 0.


One way to fix the handling of infinities is to change the code to

  if X=0 then if Y=inf then und else if Y=infinity then und else 0  else
    if Y=0 then ......

There are other kinds of special values like division by intervals 
containing zero, and who knows what else might be added by other people.

Perhaps the timing is unaffected, or perhaps you have a better way of 
fixing the program?  Can you explain?

.......

now  if 1/inf or  1/infinity   is simplified to 0, several of the rules 
below
> At this time I have implemented some general rules for the operators
> "+", "*", and "^" to simplify expressions with infinities.
>
> These are some of the implemented rules for inf and infinity:
>
> 0*inf = und
> x*inf = infinity
> a*inf = inf for a>0
> b*inf = minf for b<0
> inf/inf = und
> inf + inf = inf
> inf-inf = und
> inf^0 = und
> 1^inf = und
>
> 0*infinity = und
> x*infinity = infinity
> infinity/infinity = und
> infinity+infinity = und
> infinity-infinity = und
> infinity^0 = und
> 1^infinity = und
> infinity^inf = infinity
> inf*infinity = infinity
>
> At first what we will get for the examples of the bug reports Bug ID:
> 820188 "Simplifying inf and minf" and Bug ID: 1562671 "Handling of
> infinities":
>
> (%i1) inf-inf;
> (%o1) und
>
> (%i2) -inf;
> (%o2) minf
>
> (%i3) -minf;
> (%o3) inf
>
> (%i4) inf/inf;
> (%o4) und
>
> (%i5) inf*0;
> (%o5) und
>
> (%i6) inf*inf;
> (%o6) inf
>
> (%i7) inf+inf;
> (%o7) inf
>
> (%i8) 4*inf;
> (%o8) inf
>
> (%i9) -inf;
> (%o9) minf
>
> (%i10) -minf;
> (%o10) inf
>
> (%i11) inf+minf;
> (%o11) und
>
> All examples of the bug reports work as expected.
>
> The following three examples of the testsuite will give the expected
> results:
>
> ********************** Problem 135 ***************
> Input:
> is(compare(inf, - minf) = =)
>
>
> Result:
> true
>
> ... Which was correct, but was expected to be 
> wrong due to a known bug in Maxima.
>
> ********************** Problem 136 ***************
> Input:
> is(compare(inf, 7 + inf) = =)
>
>
> Result:
> true
>
> ... Which was correct, but was expected to be 
> wrong due to a known bug in Maxima.
>
> ********************** Problem 123 ***************
> Input:
>        1
> taylor(--, x, - inf, 2)
>         2
>        x
>
>
> Result:
>    1 2
> (- -)  + . . .
>    x
>
> ... Which was correct, but was expected to be
> wrong due to a known bug in Maxima.
>
> The following example simplifies to a correct value:
>
> ********************** Problem 257 ***************
> Input:
>            - 1 inf
> limit(1 - (---)   )
>             2
>
>
> Result:
> 1
>
> This differed from the expected result:
>          inf
>     (- 1)
> 1 - --------
>        inf
>       2
>
> There is one problem in the testsuite. I have to look again at the
> simplification of the power function:
>
> ********************** Problem 195 ***************
> Input:
> is(notequal(exp(minf), 0))
>
>
> Result:
> sign: sign of und is undefined.
> error-catch
>
> This differed from the expected result:
> false
>
> There is one change which causes problems with the fresnel functions. We
> have implemented the specific values for some directed infinities like %
> i*inf. This no longer works, because %i*inf simplifies immediately to
> infinity.
>
> There is one big problem with the code of simplify_sum. It no longer
> works. This is the example from the documentation:
>
> (%i1) load("simplify_sum")$
>
> (%i9) 'sum(binom(n+k,k)/2^k,k,0,n)+'sum(binom(2*n,2*k),k,0,n);
> (%o9) 'sum(binom(n+k,k)/2^k,k,0,n)+'sum(binom(2*n,2*k),k,0,n)
>
> (%i10) simplify_sum(%);
> (%o10) 'sum(binom(n+k,k)/2^k,k,0,n)+'sum(binom(2*n,2*k),k,0,n)
>
> Most example of the file rtest_simplify_sum will generated an error,
> that the sign of 'und is not defined. The code of the function
> simplify_sum seems to expected unsimplified sums of infinities like
> "minf+inf".
>
> Dieter Kaiser
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>