Comment #21 on issue 1321 by [email protected]: trigonometric functions of floating-point numbers should return floating-point numbers
http://code.google.com/p/sympy/issues/detail?id=1321

I keep iterating over the issue and the changes of the pull request...I see you are just trying to get f(real) -> real if possible. That being the case, I think that the `arg.is_number and arg.has(Real)` is the way to go, otherwise:

    h[8] >>> cos(pi/7.)
    cos(0.142857142857143*pi)

Or should this be handled by coercision in Mul: that when (like Function is being made to do here) a Real is encountered, NumberSymbols get evaluated. But a problem with this is that this erases some of the simplifications (that should be possible):

This simplifies ok

    h[16] >>> nsimplify(1/7.)
    1/7

If you absorb the pi in the following, the simplification won't look for it...

    h[17] >>> nsimplify((pi/7.).n())
    0.448798950512828

unless you tell it to:

    h[17] >>> nsimplify((pi/7.).n(), [pi])
    pi/7

But you shouldn't *need* to tell it to do so if the pi is already visible:

    h[16] >>> pi/7.
    0.142857142857143*pi
    h[16] >>> nsimplify(_)
0.142857142857143*pi <-- it should have automatically re-written as pi/7 (separate issue)

So in the last example, nsimplify should have tried to re-write in terms of pi since it is clearly there. But if the behavior is changed so that the pi is absorbed, that information is being lost and the simplification requires more input from the user.

Is it a good idea to throw away information as this pull intends?

    h[18] >>> acos(.5)
    1.04719755119660

If you show me the first I can guess that the answer is pi/3. If you show me the second, I won't guess that it contains pi.

Or if you think that's the way it should be, then why keep around functions with rational arguments that don''t have any recognized forms:

    h[20] >>> acos(Rational(1,11))
    acos(1/11)

I think I'm -1 to the automatic evalf() of an expression as it is throwing away information. That should only be done at the user's request with evalf(). Do @asmereur, @vks, or @ronan have input?

Is the idea that some functions (like cos) *should* autoevaluate and others (like acos) shouldn't? Should a auto_evalf flag be given to functions?

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to