11. Central force. These two problems are both about central forces. In both cases the only force is central (directed on the particle towards the origin) and only depends on radius: \(\vec{\mathbf{F}} = −F(r)\mathbf{\hat{e}_r}\). The problems are independent, one does not follow from the other.
Find a central force law \(F(r)\) so that, comparing circular orbits of varying radii, the speed v is independent of radius.
By numerical experiments, and trial and error, try to find a periodic motion that is neither circular nor a straight line, for some central force besides \(F = −kr\) or \(F = \frac{−GmM}{r2}\) . a) not with a linear zero-rest length spring; b) not with inverse-square gravity; c) not circular motion; and d) not straight-line motion.
In your failed searches, before you find a periodic motion, do the motions always have regular patterns or are they sometimes chaotic looking (include some pretty pictures)?
Puzzle: If you use a power law, what is the minimum number loops in one complete periodic orbit (a loop is, say, a relative maximum in the radius)? How does this depend on the exponent in the power law? You probably cannot make progress with this analytically, but you can figure it out with numerical experiments
[Matlab hint: To do this properly you probably need to guess at a radial force law (most anything will work) and do numerical root finding (e.g., FSOLVE) to find initial conditions and the period of the orbit. Once you have your system you can define a function whose input is the initial conditions and the time of integration and whose output is the difference between the initial state and the final state. You can make this system ‘square’ by assuming that the particle is on the x axis in the initial state. You want to find that input which makes the output the zero vector. Pick a central force and search over initial conditions and durations. Do not use FSOLVE to search over force laws; do your orbit finding using a given force law]
../../media/problem11/problem11.png
(a) Find a central force law \(F(r)\) so that, comparing circular orbits of varying radii, the speed v is independent of radius.
Consider the relationship between centripetal force and velocity for uniform circular motion, since velocity is constant we can write:
the trajectory for non-tangential inital velocity:
TODO: add graph for velocity vs radius
(b) By numerical experiments, and trial and error, try to find a periodic motion that is neither circular nor a straight line, for some central force besides \(F = −kr\) or \(F = \frac{−GmM}{r2}\) . a) not with a linear zero-rest length spring; b) not with inverse-square gravity; c) not circular motion; and d) not straight-line motion.
First of all, I would like to note here that this was the most interesting and fun and investing problem so far in this problem set. I have spent almost 18 hours spread over 6 days on this problem.
We begin by formulating our problem:
For example, an interesting central force field is this:
The graph for this magnitude of this central force field looks like this:
Dipole power law
For any such function centralforce!(du, u::State, p::Parameters, tend:Time)::State, we want to find a \(\vec{u}_0\) such that, for \(\vec{u}_t\) = DifferentialEquations.solve(odeprob)[end]
One challenge I overcame after much thinking is regarding the phasecondition, the number of variables to solve for should equal the number of equations, earlier the input dimension was five: \((x, y, vx, vy, tend)\) while the output dimension was four (Δx, Δy, Δvx, Δvy).
The following is the question I asked in a julia help group online:
In the non-linear root finding, does the input dimension have to match the output dimensions?
Right now I have input output dimension as 5, 4 respectively. input (5): (x, y, vx, vy, tend) output (4): (Δx, Δy, Δvx, Δvy )
Somehow I feel this is not ideal. The system of nonlinear equations feels under defined. So, to correct this I added the constraint of solution roots should start on the y axis, i.e x = 0
But now the root finder is giving me this warning and gets stuck:
Warning: Interrupted. Larger maxiters is needed. If you are using an integrator for non-stiff ODEs or an automatic switching algorithm (the default), you may want to consider using a method for stiff equations. See the solver pages for more details (e.g. https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/#Stiff-Problems).
└ @ SciMLBase ~/.julia/packages/SciMLBase/cwnDi/src/integrator_interface.jl:589
┌ Warning: Potential Rank Deficient Matrix Detected. Attempting to solve using Pivoted QR Factorization.
└ @ NonlinearSolveBaseLinearSolveExt ~/.julia/packages/NonlinearSolveBase/yZeYz/ext/NonlinearSolveBaseLinearSolveExt.jl:33
┌ Warning: At t=1.619487808996462e18, dt was forced below floating point epsilon 256.0, and step error estimate = 1.7742389634428446. Aborting. There is either an error in your model specification or the true solution is unstable (or the true solution can not be represented in the precision of Float64).
└ @ SciMLBase ~/.julia/packages/SciMLBase/cwnDi/src/integrator_interface.jl:623
┌ Warning: Interrupted. Larger maxiters is needed. If you are using an integrator for non-stiff ODEs or an automatic switching algorithm (the default), you may want to consider using a method for stiff equations. See the solver pages for more details (e.g. https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/#Stiff-Problems).
└ @ SciMLBase ~/.julia/packages/SciMLBase/cwnDi/src/integrator_interface.jl:589
┌ Warning: Potential Rank Deficient Matrix Detected. Attempting to solve using Pivoted QR Factorization.
└ @ NonlinearSolveBaseLinearSolveExt ~/.julia/packages/NonlinearSolveBase/yZeYz/ext/NonlinearSolveBaseLinearSolveExt.jl:33
┌ Warning: At t=1.619487808996462e18, dt was forced below floating point epsilon 256.0, and step error estimate = 1.7742389634428446. Aborting. There is either an error in your model specification or the true solution is unstable (or the true solution can not be represented in the precision of Float64).
└ @ SciMLBase ~/.julia/packages/SciMLBase/cwnDi/src/integrator_interface.jl:623
Is this because the phasecondition is linearly dependent to the state vector, I don't feel that is the case. What is going on?
The answer I got was by @romanveltz: “BifurcationKit does all that already”.
TODO: Explore how BifurcationKit.jl achieves non-linear root finding.
We can formulate the solution to this either in an optimization way, or a root finding way.
One way to feed the initial conditions to the root solver is to keep doubling the norm of the initial condition vector, this is to avoid trivial roots: \(tend = 0\) or \(v_0 = 0\)
Another strategy is to sample and pass every point in a mesh as a initial state to the solver, in the same file
functionstrategy_meshcheck() K =100.0 N =10 meshrange =range(-K, K, N) meshtime =range(0.0, K, N) count =0 roots = []println("Hello")for x in meshrangefor y in meshrangefor vx in meshrangefor vy in meshrangefor t in meshtimeglobal count r =LinearAlgebra.norm([x;y]) v =LinearAlgebra.norm([vx;vy])if r <1.0|| v <1.0|| t <1.0println("skipping small cases")continueend z⃗₀_init = [x; y; vx; vy; t] root_prob = NonlinearSolve.NonlinearProblem(RootFinding.f, z⃗₀_init, ProblemSetup.p)println(z⃗₀_init) root_sol = NonlinearSolve.solve(root_prob) count +=1 percentage =100*count / (N^length(z⃗₀_init))println(percentage, "% completed")if root_sol.retcode == NonlinearSolve.ReturnCode.Successpush!(roots, root_sol)endendendendendendprintln("Successfuly converged solutions: ", roots)end
The root finder was not converging for me for these.
But still with a bit of intuition I was able to find a non trivial Central Force Field with a non trivial periodic orbit, ./CentralForce/src/Physics.jl:
For the following force field:
#...functionhillinvalley(r⃗, p) r =norm(r⃗) σ =5 a =5e=a*exp(-σ*r^2) p = r^2 F =e+p #-aend#...