"William Stein" <[EMAIL PROTECTED]> writes:
> On 9/1/07, Nikos Apostolakis <[EMAIL PROTECTED]> wrote:
>>
>> Hello group,
>>
>> how can we pass global variables to the maxima process that sage is
>> using?  For example in maxima I can do the following
>>
>> (%i25) tlimswitch : true;
>> (%o25)                               true
>> (%i26) limit(sqrt(x^2 + x +1) + x, x, minf);
>>                                         1
>> (%o26)                                - -
>>                                         2
>>
>> to calculate a limit that without this switch, maxima has hard time
>> calculating.  Is it posible to do this in sage?  I tried
>>
>> maxima('tlimswitch : true')
>> maxima.eval('tlimswitch : true')
>>
>> but neither worked.
>>
>> BTW, it may be a good idea to have this switch on by default in
>> sage.
>
> Unfortunately, in maxima 5.13 (which is included in SAGE-2.8.3), maxima
> insists on interacting when doing that limit even with timeswitch:true,
                                                         ^^^^^^^^^^^ 

This is a typo.  The name of the variable is "tlimswitch" and
according to the documentation when it's true, "it causes the
limit package to use Taylor series when possible."  Maxima can 
calculate many more limits that way.  For example:

In [2]: maxima_console()
Maxima 5.13.0 http://maxima.sourceforge.net
Using Lisp CLISP 2.41 (2006-10-13)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
(%i1) tlimswitch : true;
(%o1)                                true
(%i2) limit(sqrt(x^2 + x +1) + x, x, minf);
                                        1
(%o2)                                 - -
                                        2
(%i3) limit( (tan(sin(x)) - sin(tan(x)))/x^7, x, 0);
                                      1
(%o3)                                 --
                                      30
(%i4) tlimswitch : false; 
(%o4)                                false
(%i5) limit( (tan(sin(x)) - sin(tan(x)))/x^7, x, 0);
                              tan(sin(x))   sin(tan(x))
(%o5)                 limit  (----------- - -----------)
                      x -> 0       7             7
                                  x             x
(%i6)  


However:

In [3]: maxima.eval('tlimswitch:true')
Out[3]: 'true'

In [35]: limit( sqrt(x^2+x+1)+x, x = -oo)
[...] Error maxima asks questions

>From what I understand this is not the expected behavior.  In this
case maxima as called from sage should know that "tlimswitch" is
true, right?

A workaround could be to pass 'tlimit' to maxima instead of
'limit'.  According to maxima documentation "tlimit" returns the
result of limit with 'tlimswitch' set to true.  

BTW, how can I see (from the sage command line) the code for limit?
When I give "limit?" I get 

def limit(f, dir=None, **argv):
"[...]"
    if not isinstance(f, SymbolicExpression):
        f = SR(f)
    return f.limit(dir=dir, **argv)

But where can I see the definition of f.limit?

TIA,
Nikos


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to