I'm trying to reproduce the results from 1, which solve the equations of an elastic ring (a closed loop elastica) under various loadings. Here is the relevant part:
I need to solve the governing equations in (2), with m0 and p as unknown parameters for a range of prescribed values of f. They indicate in the text that they solve these equations using Mathematica with NDSolve and FindRoot.
I found the following question helpful as an example: How can I use FindRoot on an expression from NDSolve?, and so I implemented my code in a similar manner. However, I'm trying to use FindRoot to solve for two parameters, and I'm not sure how to use the results of NDSolve to get the necessary two equations. Here is my code:
sol[p_?NumericQ, m0_?NumericQ, f_?NumericQ] := {\[Theta], x, y, m} /.
First@NDSolve[{
x'[s] == Cos[\[Theta][s]],
y'[s] == Sin[\[Theta][s]],
\[Theta]'[s] == m[s] + 2 \[Pi],
m'[s] == f/2 Cos[\[Theta][s]] - p Sin[\[Theta][s]],
x[0] == y[0] == \[Theta][0] == 0,
m[0] == m0
},
\[Theta], {s, 0, 2 \[Pi]}]
FindRoot[{
sol[p, m0, 200][[1]][1/2] == \[Pi],
sol[p, m0, 200][[2]][1/2] == 0}, {p, 0}, {m0, -10}]
FindRoot gives me an error that states:
FindRoot: The function value {-3.14159+0.[0.5],(-10)[0.5]} is not a list of numbers with dimensions (2) at {p,m0}={0.,-10.}.
It seems to me that FindRoot is evaluating things in the wrong order. This feels like the type of Mathematica question that is answered with "Use ?NumericQ", for example, however I am doing that here, so I'm confused. I have tried wrapping Evaluate around the functions in that list, but so far I've had no luck.
I suspect the issue is my lack of knowledge of how to call sol and use it in FindRoot in the presence of ?NumericQ. For example, it works just fine, and I can visually see the roots when I plot:
Plot3D[{sol[p, m0, 200][[1]][1/2],
sol[p, m0, 200][[2]][1/2], \[Pi]}, {p, -1, 1}, {m0, -50, 50}]
So clearly, the information is there, I just can't access it correctly yet. Any help would be greatly appreciated.
1 L.N. Virgin et al., "Deformation and vibration of compressed, nested, elastic rings on rigid base", Thin-Walled Structures, 132, 167-175, (2018). Link (Paywall)



FindRootto determine them. This is important because I plan to iterate off, instead of just finding the roots atf=200. But,FindRootseems to callPartin a different order thanPlotorPlot3D. I think this question has a similar issue, but I haven't been able to implement it correctly yet: https://mathematica.stackexchange.com/questions/34355/passing-fx1-to-findroot – dpholmes Mar 03 '20 at 19:49FindRoot. Thank you! – dpholmes Mar 03 '20 at 20:17FindRootfrom "SymbolicProcessing". – Ulrich Neumann Mar 03 '20 at 20:21