In this project I'm doing, one small part is to find out the relations between z and r. However, since everything is under another coordinate (with xi and eta). I do have the transformation(from cylindrical to bipolar):

r[η_, ξ_] = Sin[η]/(Cosh[ξ] - Cos[η]);
z[η_, ξ_] = Sinh[ξ]/(Cosh[ξ] - Cos[η]); 

So, the differential equation is

dz/dr==f[η, ξ]

And I only know the range and initial condition for ξ and η.

How can I use NDSolve to find out z[r]? Or, can I actually use NDSolve?

  • $\begingroup$ Is f a given function? $\endgroup$ – Michael E2 Sep 20 '16 at 14:09
  • $\begingroup$ Yes, f is a given function but the hard part is that this function is about eta and xi. $\endgroup$ – Ying Zhang Sep 20 '16 at 15:06
  • $\begingroup$ I tried this: Calculate Dz/D[eta], Dz/D[xi], Dr/D[eta], Dr/D[xi]. then, put them in this: (Dz/D[eta]+Dz/D[xi]*D[eta]/D[xi]) /(Dr/D[eta]+ Dr/D[xi]*D[eta]/D[xi])==f(eta,xi). However, mathematica give me alert: the D[eta]/D[xi]not clearly specified in the form f[eta,xi]. I changed f[eta,xi] into f[eta[xi],xi], but still, same alert is given. $\endgroup$ – Ying Zhang Sep 20 '16 at 17:49

z is not a single-valued function of r, as can be seen from

r[η_, ξ_] := Sin[η]/(Cosh[ξ] - Cos[η]);
z[η_, ξ_] := Sinh[ξ]/(Cosh[ξ] - Cos[η]);
ParametricPlot[Evaluate@Table[{r[η, i], z[η, i]}, {i, -5, 5}], 
    {ξ, -5, 5}, {η, -5, 5}, FrameLabel -> {r, z}, AspectRatio -> 1, 
    PlotRange -> {{-1, 1}, All}]

enter image description here

For every value of r, there are an infinite number of values of z. To obtain a single curve, a relationship between ξ and η is required.

This is not a Mathematica shortcoming but instead reflects the nature of the mathematics.


Based on the clarification of the question given in comments below, one might try obtaining {η, ξ} as a function of {r, z},

Simplify[Solve[{r == Sin[η]/(Cosh[ξ] - Cos[η]), z == Sinh[ξ]/(Cosh[ξ] - Cos[η])}, 
    {ξ, η}][[2]] /. {C[1] -> 0, C[2] -> 0}]

(* {ξ -> Log[Sqrt[r^2 + (1 + z)^2]/Sqrt[r^2 + (-1 + z)^2]], 
    η -> ArcTan[(-1 + r^2 + z^2)/(Sqrt[r^2 + (-1 + z)^2] Sqrt[r^2 + (1 + z)^2]), 
    (2 r)/(Sqrt[r^2 + (-1 + z)^2] Sqrt[r^2 + (1 + z)^2])]} *)

and substituting this result into f[η, ξ] to obtain the ODE entirely as a function of {r, z}.

D[z[r], r] == f[η, ξ] /. % /. z -> z[r]

NDSolve probably can solve this ODE without difficulty.

Using NDSolve to solve all three equations in the question simultaneously as a differential-algebraic system also might work.

  • $\begingroup$ First of all, thank you very much for your answer. What you said is true, we do need a relation between ξ and η. However, if you read closely, It's given, but implicitly: you have Dz/Dr==f(ξ, η). And this will define a curve in the ξ-η plane, so, it also defines a curve in the r-z plane. But I want the this be solved in the r-z plane instead of the ξ-η plane. $\endgroup$ – Ying Zhang Sep 23 '16 at 13:33
  • $\begingroup$ Please provide f(ξ, η) in the question. $\endgroup$ – bbgodfrey Sep 23 '16 at 13:41
  • $\begingroup$ this f is a ratio of two partial derivatives of some phi with ξ and η, respectively. and I got the phi by a huge formula with an integral with another variable miu of a function A(miu) which I got from solving a difference equation.... $\endgroup$ – Ying Zhang Sep 23 '16 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.