ApproxFun.jl
ApproxFun.jl copied to clipboard
Error solving nonlinear boundary value problem / worked in a previous version of Julia 111 and Approxfun
I try to solve the following nonlinear Differential Equation/Boundary Value Problem: y'''' + 4.0*y'''/x = 0 with the following boundary conditions y(0) = y'(0) = 0 y''(1)=0 y'''(1)=1
in a previous version the following solution worked:
using ApproxFun
x = Fun(identity,0..5)
u0 = 0.0x
N = u->[u(0), u'(0), u''(1), u'''(1)-1, u''''+4*u^3/x]
u = newton(N,u0)
Warning: Maximum numer of iterations 15 reached, with approximate accuracy of 1.439e-13
the results were ok
if I try to solve the same problem with the latest version I rceive the following error messages: ERROR: AssertionError: abs(first(g)) < tol Stacktrace:
if I change the statement N = u-> (because of singularity at x=0) to N = u->[u(0), u'(0), u''(1), u'''(1)-1, if x<1e-4 u''''+12*y'y^2 else u''''+4u^3/x end] u = newton(N,u0) I receive the same error message ERROR: AssertionError: abs(first(g)) < tol Stacktrace:
Can anybody help me
Please include stack traces when you post an issue
Dear Stephan,
Please find the requested stack trace:
Tank you for your help
Best regards
Chris
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.1 (2021-04-23)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using ApproxFun
julia> println("\nResult using ApproxFun")
Result using ApproxFun
julia> x = Fun(identity,0..5)
Fun(Chebyshev(0..5),[2.5, 2.5])
julia> u0=0.0x
Fun(Chebyshev(0..5),[0.0, 0.0])
julia> N=u->[u(0),u'(0),u''(1),u'''(1)-1,u''''+4*u^3/x];
julia> u=newton(N,u0)
ERROR: AssertionError: abs(first(g)) < tol
Stacktrace:
[1] coefficients(f::Vector{Float64}, sp1::JacobiWeight{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, IntervalSets.ClosedInterval{Int64}, Float64, Int64}, sp2::JacobiWeight{Chebyshev{Interval
Sets.ClosedInterval{Int64}, Float64}, IntervalSets.ClosedInterval{Int64}, Float64, Int64})
@ ApproxFunSingularities C:\Users\Chris\.julia\packages\ApproxFunSingularities\abp7k\src\JacobiWeightChebyshev.jl:16
[2] coefficients
@ C:\Users\Chris\.julia\packages\ApproxFunSingularities\abp7k\src\JacobiWeight.jl:106 [inlined]
[3] coefficients(f::Fun{JacobiWeight{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, IntervalSets.ClosedInterval{Int64}, Float64, Int64}, Float64, Vector{Float64}}, msp::Chebyshev{IntervalSets
.ClosedInterval{Int64}, Float64})
@ ApproxFunBase C:\Users\Chris\.julia\packages\ApproxFunBase\Gra7W\src\Fun.jl:49
[4] *(A::ApproxFunBase.ConstantTimesOperator{TimesOperator{Float64, Tuple{Int64, Int64}}, Float64}, b::Function)
@ ApproxFunBase C:\Users\Chris\.julia\packages\ApproxFunBase\Gra7W\src\Operators\general\algebra.jl:611
[5] /(B::ApproxFunBase.ConstantTimesOperator{TimesOperator{Float64, Tuple{Int64, Int64}}, Float64}, c::Fun{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, Float64, Vector{Float64}})
@ ApproxFunBase C:\Users\Chris\.julia\packages\ApproxFunBase\Gra7W\src\Operators\general\algebra.jl:581
[6] /(a::ApproxFun.DualFun{Fun{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, Float64, Vector{Float64}}, ApproxFunBase.ConstantTimesOperator{TimesOperator{Float64, Tuple{Int64, Int64}}, Float
64}}, b::Fun{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, Float64, Vector{Float64}})
@ ApproxFun C:\Users\Chris\.julia\packages\ApproxFun\GOMNa\src\Extras\autodifferentiation.jl:54
[7] (::var"#1#2")(u::ApproxFun.DualFun{Fun{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, Float64, Vector{Float64}}, ConstantOperator{Float64, Chebyshev{IntervalSets.ClosedInterval{Int64}, Fl
oat64}}})
@ Main .\REPL[5]:1
[8] newton(N::var"#1#2", u0::Fun{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, Float64, Vector{Float64}}; maxiterations::Int64, tolerance::Float64)
@ ApproxFun C:\Users\Chris\.julia\packages\ApproxFun\GOMNa\src\Extras\autodifferentiation.jl:98
[9] newton(N::Function, u0::Fun{Chebyshev{IntervalSets.ClosedInterval{Int64}, Float64}, Float64, Vector{Float64}})
@ ApproxFun C:\Users\Chris\.julia\packages\ApproxFun\GOMNa\src\Extras\autodifferentiation.jl:95
[10] top-level scope
@ REPL[6]:1
The divide by x
is probably an issue. Try multiplying through