       Re: NDSolve for catenary

• To: mathgroup at smc.vnet.net
• Subject: [mg111378] Re: NDSolve for catenary
• From: "Kevin J. McCann" <Kevin.McCann at umbc.edu>
• Date: Thu, 29 Jul 2010 06:44:57 -0400 (EDT)
• References: <i2ok69\$7sd\$1@smc.vnet.net>

```Your problem is likely in the attempt to solve a boundary value problem
rather than an initial value problem. Here is a quick shooting method
that gets the answer:

(* Define the shooter. Takes an initial slope of a and returns r *)
Clear[shoot, a]
shoot[a_?NumberQ] := Module[{r, x, y},
y = r /. NDSolve[{1 +
\!\(\*SuperscriptBox["r", "\[Prime]",
MultilineFunction->None]\)[x]^2 - r[x]
\!\(\*SuperscriptBox["r", "\[Prime]\[Prime]",
MultilineFunction->None]\)[x] == 0, r == 1, r' == a},
r, {x, 0, 1}][];
y
]

(* Find the correct initial slope *)

\[Alpha] = a /. FindRoot[shoot[a] == 1, {a, -1, 1}]

(* Now that we have the correct slope, solve the DE *)

R = r /. NDSolve[{1 +
\!\(\*SuperscriptBox["r", "\[Prime]",
MultilineFunction->None]\)[x]^2 - r[x]
\!\(\*SuperscriptBox["r", "\[Prime]\[Prime]",
MultilineFunction->None]\)[x] == 0, r == 1, r' == \[Alpha]},
r, {x, 0, 1}][]

(* Plot it *)

Plot[R[x], {x, 0, 1}, PlotRange -> {0.5, 1}]

Kevin

Sam Takoy wrote:
> Hi,
>
> This:
>
> NDSolve[{ 1 + r'[x]^2 - r[x] r''[x] == 0, r == r == 1}, r, {x,  0, 1}]
>
> should solve the catenary problem, but it gives 1/0 errors. Can you
> suggest a fix?
>
> Many thanks!
>
> Sam
>

```

• Prev by Date: Re: SetAttributes for entire package
• Next by Date: Re: Generate #s
• Previous by thread: NDSolve for catenary
• Next by thread: TeXForm in 7.0.0