-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect results for sin and cosine functions #939
Comments
The issue here is that the values lie outside the domain, and a For example: julia> g = Fun(sin, -2pi..2pi)
Fun(Chebyshev(-6.283185307179586 .. 6.283185307179586), [0.0, -0.424765, 0.0, -0.0582244, 0.0, 0.745649, 0.0, -0.315042, 0.0, 0.0582478 … 0.0, -1.38959e-11, 0.0, 2.35992e-13, 0.0, -3.4972e-15, 0.0, -2.60209e-17, 0.0, -6.93889e-17])
julia> g(pi/2)
1.0 |
Thank you for the explanation.
…On Fri, 5 Apr 2024, 5:46 pm Jishnu Bhattacharya, ***@***.***> wrote:
The issue here is that the values lie outside the domain, and a Fun does
not extrapolate (it always evaluates to zero outside the domain). You
probably want to define it on a larger domain.
For example:
julia> g = Fun(sin, -2pi..2pi)Fun(Chebyshev(-6.283185307179586 .. 6.283185307179586), [0.0, -0.424765, 0.0, -0.0582244, 0.0, 0.745649, 0.0, -0.315042, 0.0, 0.0582478 … 0.0, -1.38959e-11, 0.0, 2.35992e-13, 0.0, -3.4972e-15, 0.0, -2.60209e-17, 0.0, -6.93889e-17])
julia> g(pi/2)1.0
—
Reply to this email directly, view it on GitHub
<#939 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK4NBYYLH6DJ3PAVSURS7Q3Y33BNVAVCNFSM6AAAAABFZLOMLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGEZTIMJZGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ApproxFun (version 0.13.26) returns incorrect values for sine and cosine of some known angles in Julia 1.10. See the examples below.
julia> using ApproxFun
julia> f = Fun(cos)
Fun(Chebyshev(), [0.765198, 0.0, -0.229807, 0.0, 0.00495328, 0.0, -4.18767e-5, 0.0, 1.88447e-7, 0.0, -5.26123e-10, 0.0, 9.99916e-13])
julia> f(pi) # correct answer is -1
0.0
julia> f(2pi) # correct answer is 1
0.0
julia> g = Fun(sin)
Fun(Chebyshev(), [0.0, 0.880101, 0.0, -0.0391267, 0.0, 0.000499515, 0.0, -3.00465e-6, 0.0, 1.04985e-8, 0.0, -2.39601e-11, 0.0, 3.85525e-14])
julia> g(pi/2) # correct answer is 1
0.0
julia> g(3pi/2) # correct answer is -1
0.0
The text was updated successfully, but these errors were encountered: