-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Description
I am trying to use Optim.jl for univariate functions in tandem with ApproxFun.jl. However, there is a catastrophic bug that requires an awkward workaround. When I evaluate a Fourier series at a point close to zero, ApproxFun gives a completely incorrect result. Below is the minimal code that demonstrates this.
Input:
using ApproxFun
dF = Fourier(-pi..pi)
example = Fun(x -> cos(x), dF)
val_correct = example(0)
val_correct_2 = example(2*pi + 1e-09)
val_wrong = example(1e-09)
Result:
Fourier(【-3.141592653589793,3.141592653589793❫)
Fun(Fourier(【-3.141592653589793,3.141592653589793❫), [5.62263e-17, -2.77556e-17, -1.0])
1.0
1.0
2.775556218710621e-26
This has also occurred for more complicated functions. Essentially, if I evaluate a Fourier series at some very small x, then the output will be close to zero. Here, 1e-09 is not particularly close to machine precision, so I can't see why this should be happening.
Metadata
Metadata
Assignees
Labels
No labels