[Maxima] extending limit

Richard Hennessy rich.hennessy at verizon.net
Tue Sep 8 18:35:16 CDT 2009


Stavros,

You can choose not to use the array option so that the output does interoperate with the rest of Maxima, but the problem with that is you get output like this.

(%i1) piecewise([minf, und, -1, und, -1, 0, 1, 1, 1, inf, inf], x, 'open);
(%o1) und*(-signum(x+1)-unit_spike(x+1)+1)/2+und*unit_spike(x+1)+inf*(signum(x-1)-unit_spike(x-1)+1)/2+unit_spike(x-1)

This is hard to understand but you can integrate and differentiate as well as do algebra with it etc. using the rest of Maxima.  But, the user at some point might want to get the answer is a final form that is easier to understand.  So then you use pwsimp() with the array option.  Of course in this case 'und and 'inf don't work well in Maxima but that is not an issue with piecewise, that is a problem with Maxima. 

I think Maxima really should have a piecewise function, most other CAS's do.

Anyway here is the other way to change the output to something readable.  Until Maxima has a way to express piecewise functions in an intuitive manner the matrix form is useful for the presentation of the output to people

(%i10) pwsimp(%o1,x,'array);

           [ If  x  in  (  minf  ,  - 1  ]  then  und ]
           [                                          ]
           [ If  x  in  (  - 1   ,   1   )  then   0  ]
           [                                          ]
           [ If  x  in  [   1    ,   1   ]  then   1  ]
           [                                          ]
           [ If  x  in  (   1    ,  inf  )  then  inf ]

If you know of another way then I would like to know what it is.

Rich


----- Original Message ----- 
From: "Stavros Macrakis" <macrakis at alum.mit.edu>
To: "Richard Hennessy" <rich.hennessy at verizon.net>
Cc: "Richard Fateman" <fateman at cs.berkeley.edu>; <maxima at math.utexas.edu>; "Raymond Toy" <raymond.toy at stericsson.com>; "Barton Willis" <willisb at unk.edu>
Sent: Tuesday, September 08, 2009 5:20 PM
Subject: Re: [Maxima] extending limit


Rich,

The matrix layout is a cute trick for prototyping, but it doesn't
interoperate with the rest of Maxima at all, hence the need for
special pwintegerate etc.  As long as pw is inconsistent with the rest
of Maxima, it will be hard for most users to use it effectively.

             -s

On Tue, Sep 8, 2009 at 4:16 PM, Richard
Hennessy<rich.hennessy at verizon.net> wrote:
> I think I need to revisit this function and the array option. It is not
> good enough. This is what I think is good enough. Ideas welcome.
>
> piecewise([minf, und, -1, und, -1, 0, 1, 1, 1, inf, inf], x, 'array, 'open);
>
> [ If x in ( minf , - 1 ] then und ]
> [ ]
> [ If x in [ - 1 , 1 ) then 0 ]
> [ ]
> [ If x in [ 1 , 1 ] then 1 ]
> [ ]
> [ If x in ( 1 , inf ) then inf ]
>
> Rich
>
>
> ----- Original Message -----
> From: Richard Hennessy
> To: Richard Fateman ; Raymond Toy
> Cc: maxima at math.utexas.edu ; Barton Willis
> Sent: Tuesday, September 08, 2009 3:16 PM
> Subject: Re: [Maxima] extending limit
> If you are going to extend limit consider the code I wrote in pw.mac for the
> pwlimit function. Although it is rather simple and can't handle very many
> expressions, it can handle enough to satisfy the needs of pw.mac.
>
> I read Barton's paper and noticed that the limit of many expressions are
> piecewise functions. So limit(x^k, k, inf) = piecewise([minf, und, -1, und,
> -1, 0, 1, 1, 1, inf, inf], x, 'open) which results in an expression wholly
> unreadable. I have been somewhat lazy in my work on the piecewise function
> so if you try to make this mess look comprehensible you get this.
>
> piecewise([minf, und, -1, und, -1, 0, 1, 1, 1, inf, inf], x, 'array);
> [ If x in [ minf , - 1 ]
> pw(x) = und ]
>
> [ ]
> [ If x in [ - 1 , - 1 ]
> pw(x) = und ]
>
> [ ]
> [ If x in [ - 1 , 1 ]
> pw(x) = 0 ]
>
> [ ]
> [ If x in [ 1 , 1 ]
> pw(x) = 1 ]
>
> [ ]
> [ If x in [ 1 , inf ]
> pw(x) = inf ]
>
> which has the brackets wrong. piecewise should use the open interval here
> (minf, -1) not [minf,-1]. If you say
>
> piecewise([minf, und, -1, und, -1, 0, 1, 1, 1, inf, inf], x, 'array, 'open);
>
> it ignores the 'open which is a bug. I think I will fix this. It would not
> be that hard and the piecewise function would be more useful.
>
> Rich
>
>
>
> ----- Original Message -----
> From: Richard Fateman
> To: Raymond Toy
> Cc: maxima at math.utexas.edu ; Barton Willis
> Sent: Tuesday, September 08, 2009 12:42 PM
> Subject: Re: [Maxima] extending limit
> I've been critical of Mathematica's use of Intervals for the result of
> Limit, but perhaps we could come up with something similar.
>
> Mathematica says this..
>
> Limit[Sin[x],x->Infinity] is Interval[{-1,1}]
>
> I object to the overloading of the "interval" arithmetic to represent this,
> but I would not mind a notion of a limit set or constraint or something like
> that.
>
> e.g. limit(sin(x),x,inf) might be bounds(-1,1).
>
> To some extent bounds(a,b) can be handled arithmetically like an interval
> (which Maxima does not have now anyway!)
> but it fails to satisfy the epsilon-delta kind of definition of limit, or
> consequences that follow from that. But I have not
> fully thought this through.
> RJF
>
> For people with access to Mathematica, try
> Limit[Tan[x]^2+Sec[x]^2,x->Infinity]
>
> Raymond Toy wrote:
>
> Barton Willis wrote:
>
>
> I was playing with the idea of appending a simplim%function for the
> hypergeometric
> functions. To start, I wrote some 100% fake code:
>
>
>
>
> [snip]
>
>
> Limit assumes continuity?
>
>   (%i14) limit(hypergeometric([a],[b],x),x,0);
>   (%o14) 1
>
> Limit doesn't even try limit-hg?
>
>   (%i16) limit(hypergeometric([a],[b],x),a,0);
>   (%o16) limit(hypergeometric([a],[b],x),a,0)
>
>
>
>
> This is caused by the following in simplimit:
>
> (defmfun simplimit (exp var val &aux op)
>   (cond
>     ((eq var exp) val)
>     ((or (atom exp) (mnump exp)) exp)
>     ((and (not (infinityp val))
>       ;; *** HERE ***
>       (not (amongl '(%sin %cos %atanh %cosh %sinh %tanh mfactorial %log)
>                exp))
>       (not (inf-typep exp))
>       (simplimsubst val exp)))
>
> Since hypergeometric isn't among the list of "special" functions,
> simplimsubst is called.
>
> This looks like a bug in simplimit.  The list of special functions needs
> to expanded.  Or probably better, it should be removed and the rest of
> the code adjusted accordingly so that the special limit functions can
> decide what to do about continuity and such.
>
> Ray
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
> ________________________________
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
> ________________________________
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20090908/c1767fa9/attachment-0001.htm 


More information about the Maxima mailing list