Open GrigorySarnitsky opened 6 months ago
Not so much of an issue, but a highly confusing point. Apparently both ' and Derivative() compute the derivative but in different ways:
'
Derivative()
> Fun(x -> x^2)' Fun(Chebyshev(), [0.0, 2.0])
and
> Derivative() * Fun(x -> x^2) Fun(Ultraspherical(1), [0.0, 1.0])
This is the most confusing while using newton(). The example from the docs with ' works:
newton()
using ApproxFun using Plots N1(u, x = Fun()) = [u(-1.)-1., u(1.)+0.5, 0.001u'' + 6(1-x^2)u' + u^2 - 1]; u = newton(N1, 0 * Fun()) plot(u)
but changing it to
∂x = Derivative() N1(u, x = Fun()) = [u(-1.)-1., u(1.)+0.5, 0.001 * (∂x^2 * u) + 6(1-x^2) * (∂x * u) + u^2 - 1];
throws an error:
MethodError: no method matching space(::ApproxFun.DualFun{Fun{Chebyshev{ChebyshevInterval{Float64}, Float64}, Float64, Vector{Float64}}, ConstantOperator{Float64, Chebyshev{ChebyshevInterval{Float64}, Float64}}}) Closest candidates are: space(::LowRankFun, ::Integer) @ ApproxFunBase [~/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl:348](http://localhost:8888/home/grigory/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl#line=347) space(::LowRankFun) @ ApproxFunBase [~/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl:349](http://localhost:8888/home/grigory/.julia/packages/ApproxFunBase/clvO0/src/Multivariate/LowRankFun.jl#line=348) space(::Fun) @ ApproxFunBase [~/.julia/packages/ApproxFunBase/clvO0/src/Fun.jl:339](http://localhost:8888/home/grigory/.julia/packages/ApproxFunBase/clvO0/src/Fun.jl#line=338) ...
Not so much of an issue, but a highly confusing point. Apparently both
'
andDerivative()
compute the derivative but in different ways:and
This is the most confusing while using
newton()
. The example from the docs with'
works:but changing it to
throws an error: