Skip to content
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

How to input a tolerance in BVP #41

Closed
JMmontilla opened this issue Apr 21, 2019 · 2 comments
Closed

How to input a tolerance in BVP #41

JMmontilla opened this issue Apr 21, 2019 · 2 comments

Comments

@JMmontilla
Copy link

Is there a way to pass the ftol argument to the BVProblem? As an example, say that I want the residuals of this problem to be zero up to 25 decimals:

using BoundaryValueDiffEq, OrdinaryDiffEq
const g = 9.81
L = 1.0
tspan = (0.0,pi/2)
function simplependulum!(du,u,p,t)
    θ  = u[1]
    dθ = u[2]
    du[1] = dθ
    du[2] = -(g/p[1])*sin(θ)
end
u₀_2 = BigFloat.(["-0.47", "-4.79"]) # the initial guess
tspan = BigFloat.(tspan)
function bc3!(residual, sol, p, t)
    residual[1] = sol(pi/4)[1] + pi/2 # use the interpolation here, since indexing will be wrong for adaptive methods
    residual[2] = sol(pi/2)[1] - pi/2
end
bvp3 = BVProblem(simplependulum!, bc3!, u₀_2, tspan, [L])
sol3 = solve(bvp3, Shooting(Feagin14()), abstol = 1e-40, reltol = 1e-35)

@show sol3(pi/2)[1] - pi/2

How can I do that?

@ChrisRackauckas
Copy link
Member

Take a look at https://github.com/JuliaDiffEq/BoundaryValueDiffEq.jl/blob/master/test/orbital.jl#L51-L54 . We should update the docs if it's not clear on how to pass a nonlinear solver. Please let us know if that should be done.

@JMmontilla
Copy link
Author

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants