On Thu, Aug 21, 2008 at 11:11 PM, William Stein <[EMAIL PROTECTED]> wrote:
> > On Thu, Aug 21, 2008 at 8:09 AM, William Stein <[EMAIL PROTECTED]> wrote: > > On Thu, Aug 21, 2008 at 4:44 AM, Andelf <[EMAIL PROTECTED]> wrote: > >> I am a starter, so I don't understand why this goes wrong > >> > >> I typed: > >> > >> x = var('x') > >> f = log(2+sqrt(arctan(x)*sin(1/x))) > >> lim(f, x=0) > >> > >> and got: > >> Traceback (click to the left for traceback) > >> ... > >> Is sin(1/x)*atan(x) positive or zero? > >> actually I should get a log(2). > >> > >> who can help me explain it? > > > > Use the assume command, as illustrated below. You'll eventually get > log(2): > > > > sage: x = var('x') > > sage: f = log(2+sqrt(arctan(x)*sin(1/x))) > > sage: lim(f, x=0) > > Traceback (most recent call last): > > ... > > TypeError: Computation failed since Maxima requested additional > > constraints (use assume): > > Is sin(1/x)*atan(x) positive or zero? > > sage: assume(sin(1/x)*atan(x) > 0) > > sage: x = var('x') > > sage: f = log(2+sqrt(arctan(x)*sin(1/x))) > > sage: lim(f, x=0) > > Traceback (most recent call last): > > ... > > TypeError: Computation failed since Maxima requested additional > > constraints (use assume): > > Is sin(1/x) positive or zero? > > sage: assume(sin(1/x)>0) > > sage: x = var('x') > > sage: f = log(2+sqrt(arctan(x)*sin(1/x))) > > sage: lim(f, x=0) > > Traceback (most recent call last): > > ... > > TypeError: Computation failed since Maxima requested additional > > constraints (use assume): > > Is atan(x) positive or zero? > > sage: assume(atan(x) > 0) > > sage: x = var('x') > > sage: f = log(2+sqrt(arctan(x)*sin(1/x))) > > sage: lim(f, x=0) > > log(2) > > By the way, you could also try sympy, but it fails to do this limit: > > sage: import sympy > sage: x = sympy.var('x') > sage: f = sympy.log(int(2) + sympy.sqrt(sympy.atan(x)*sympy.sin(int(1)/x))) > sage: f.limit(x,0) > WARNING: Output truncated! > <html><a target='_new' href='/home/admin/274/cells/11/full_output.txt' > class='file_link'>full_output.txt</a></html> > > The limit algorithm needs to calculate the series of > series: sin(1/_w)**(1/2)*_w > expansion variable (expanding around 0+): _w > But the series expansion failed. Check that this series is meaningful and > make > it work, then run this again. If the series cannot be mathematically > calculated, the bug is in the limit algorithm. > The limit algorithm needs to calculate the series of > thank you all, :) --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@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-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---