#943 taylor asks pn? when expr is zero

closed
5
2008-11-30
2006-06-10
No

taylor( asin( ( cos(x+a)^2 + sin(x)^2-1 ) / a), a, 0, 2)

asks whether sin(x)^2+cos(x)^2-1 is positive or
negative, where of course it is identically zero.

Discussion

  • Robert Dodier

    Robert Dodier - 2006-06-11

    Logged In: YES
    user_id=501686

    I don't think the bug is in taylor; reassigning the category
    to "Lisp Core - Assume". Feel free to change the category again.

    asksign (sin(x)^2+cos(x)^2-1);
    => Is sin(x)^2+cos(x)^2-1 pnz ?

    is(equal(sin(x)^2+cos(x)^2-1,0));
    => Maxima was unable to evaluate the predicate

    I don't know how hard asksign and/or is and/or mevalp should
    try to simplify.

    trigsimp(sin(x)^2+cos(x)^2-1); => 0

    but trigsimp isn't applied automatically.

     
  • Robert Dodier

    Robert Dodier - 2006-06-11
    • labels: 840499 --> Lisp Core - Assume
     
  • Stavros Macrakis

    Logged In: YES
    user_id=588346

    It would be OK if taylor/asksign asked if the expression was
    pnz, because the user could answer z (there will always be
    some cases that asksign can't handle, after all). The
    problem is that taylor/asksign is asking if it is pn, not
    giving the user the possibility of answering z.

     
  • Nobody/Anonymous

    Logged In: NO

    Also, the graph (2d!) of sin(x)^2+cos(x)^2 is not a straight line!
    S.Sangwal
    sangwal77 AT yahoo.com

     
  • Stavros Macrakis

    Logged In: YES
    user_id=588346
    Originator: YES

    > Also, the graph (2d!) of sin(x)^2+cos(x)^2 is not a straight line!

    This is because of rounding errors. To see clearly how small these errors are, try plot2d(sin(x)^2+cos(x)^2-1,[x,0,6]); This gives you a useful scale for the y axis. Unfortunately, plot2d(sin(x)^2+cos(x)^2,...) does not -- it shows the min and max values as 1, where it is in fact 0.999999999999999 -> 1.000000000000001 or something.

     
  • Dan Gildea

    Dan Gildea - 2008-11-30

    as of comm2.lisp rev 1.22, simpatan2 no longer asks questions:

    (%i8) taylor( asin( ( cos(x+a)^2 + sin(x)^2-1 ) / a), a, 0, 2);
    (%o8) %i*log(a)+(-log(abs(2*sin(x)^2+2*cos(x)^2-2))*%i
    +atan2(2*sin(x)^2+2*cos(x)^2-2,0))
    +2*%i*cos(x)*sin(x)*a/(sin(x)^2+cos(x)^2-1)
    -(4*%i*sin(x)^4+(-8*%i*cos(x)^2-4*%i)*sin(x)^2-4*%i*cos(x)^4
    +4*%i*cos(x)^2-%i)
    *a^2
    /(4*sin(x)^4+(8*cos(x)^2-8)*sin(x)^2+4*cos(x)^4-8*cos(x)^2+4)
    (%i9) trigsimp(%);
    atan2(0,0) has been generated.

    (oops)

     
  • Dan Gildea

    Dan Gildea - 2008-11-30
    • status: open --> closed
    • assigned_to: nobody --> dgildea
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks