Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#2479 radcan seems to give non-equvalent function

None
wont-fix
nobody
5
2012-12-14
2012-10-16
Jean-Yves
No

Hi,

When doing radcan(-(2*x)/(sqrt(1-(x^2-1)^2)*sqrt(1-asin(x^2-1)^2))), the result is -2/(sqrt(2-x^2)*sqrt(1-asin(x^2-1))*sqrt(asin(x^2-1)+1)). But these two expressions are not equivalent. For x = -0.4, -(2*x)/(sqrt(1-(x^2-1)^2)*sqrt(1-asin(x^2-1)^2)) gives 20.01585798944382 wheras -2/(sqrt(2-x^2)*sqrt(1-asin(x^2-1))*sqrt(asin(x^2-1)+1)) gives -20.01585798944383.
-(2*x)/(sqrt(1-(x^2-1)^2)*sqrt(1-asin(x^2-1)^2)) is the result of diff(acos(asin(x^2-1)),x) if this can help.
Build info is build_info("5.28.0-2","2012-08-27 23:16:48","i686-pc-mingw32","GNU Common Lisp (GCL)","GCL 2.6.8").

Best regards,

Jean-Yves

Discussion

  • use function factor

    %i1 factor(sqrt(x^2-u*x^4));
    %o1 sqrt(1-u*x^2)*abs(x)

    but

    %i1 radcan(sqrt(x^2-u*x^4));
    %o1 x*sqrt(1-u*x^2)

     
  • Raymond Toy
    Raymond Toy
    2012-10-31

    Although the documentation of radcan isn't very clear on this, radcan is expected to produce results like this. I think the idea is if x is very large, then both expressions are equivalent. I think that's true for your expressions.

    If this is not what you want, use ratsimp or some other combination of expand and factor.

    Marking as pending/invalid.

     
  • Raymond Toy
    Raymond Toy
    2012-10-31

    • status: open --> pending
     
  • @rtoy:
    You missed the minus sign!
    The one result is negative, the other is positive.
    So this is definitely a bug!

     
  • Jean-Yves
    Jean-Yves
    2012-11-08

    • status: pending --> open
     
  • Jean-Yves
    Jean-Yves
    2012-11-08

    @rtoy: I'm answering late but I tend to agree with tomasriker. When you look at the limit for x=-sqrt(sin(1)+1) which is the largest negative possible value you get:
    limit(f(x),x,-sqrt(1+sin(1)),plus) is inf
    limit(radcan(f(x)),x,-sqrt(1+sin(1)),plus) is minf
    f(x) being diff(acos(asin(x^2-1)),x)
    However, I followed Ivch advice and replaced radcan by factor in my code (with a small trick for integers).

     
  • Raymond Toy
    Raymond Toy
    2012-11-08

    First, let's make the expression simpler, removing the part with asin: e: -2*x/sqrt(1-(x^2-1)^2)

    ratsimp(e) -> -2*x/sqrt(x^2-x^4)

    No problem with that.

    radcan(e) -> -2/sqrt(2-x^2)

    This is very different. From the ratsimp result, we can change the expression (manually) to -2*x/abs(x)/sqrt(2-x^2). This is basically the same as what radcan has produced, but radcan has "assumed" that x is very large and positive, which makes abs(x) = x. This is what I meant by saying that radcan can do "unexpected" changes.

    If this is not clear, you should bring this up on the mailing list where Richard Fateman (author of radcan) can explain what's going on. This really needs to be documented better.

     
  • Raymond Toy
    Raymond Toy
    2012-12-14

    Closing as wontfix. I think this is working as expected.

     
  • Raymond Toy
    Raymond Toy
    2012-12-14

    • status: open --> wont-fix
    • milestone: --> None