Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to solve for Mach number based on the given Prandtl-Meyer function, however I keep getting odd error.

Here is my code:

g = 1.4

v2 = 54

Solve[v2 == (Sqrt[(g + 1)/(g - 1)]*
        ArcTan[Sqrt[(g - 1) (M2^2 - 1)/(g + 1)]] - 
       ArcTan[Sqrt[M2^2 - 1]])/Pi*180, {M2}];

This is the website that has the function I'm trying to solve.

Any help would be greatly appreciated.


g = 1.4

v2 = 54.76

M2 := FindRoot[
  v2 == (Sqrt[(g + 1)/(g - 1)]*
        ArcTan[Sqrt[(g - 1) (x^2 - 1)/(g + 1)]] - 
       ArcTan[Sqrt[x^2 - 1]])/Pi*180, {x, 3}]
share|improve this question
Looks like you might have use FindRoot to get a numerical solution (M2 -> 3.22983). – wxffles May 11 '13 at 5:04
Thanks! So i've managed to get appropriate answer but how can I save it as a value in a variable to use in next equations? – user6850 May 11 '13 at 5:21
Have you seen this? – J. M. May 11 '13 at 5:30

Here's a short routine for computing the Mach number from the Prandtl-Meyer equation:

prandtlMeyerMachNumber[γ_?InexactNumberQ, ν_?InexactNumberQ] := 
    Module[{prec = Precision[{γ, ν}], β, η, λ, m},
           λ = Sqrt[SetPrecision[(γ - 1)/(γ + 1), ∞]];
           η = ν + π (1 - 1/λ)/2;
           m = ((3 + γ) η^2/12 + 2/(1 - γ))/η;
           Sqrt[β^2 + 1] /. First @ FindRoot[ν == ArcTan[λ β]/λ - ArcTan[β],
                                             {β, Sqrt[m^2 - 1]}, WorkingPrecision -> prec]]

As noted in the comments, a transcendental equation such as the Prandtl-Meyer equation will often not admit an easy symbolic solution, and one thus has to resort to numerical techniques, as embodied in FindRoot[]. For this case, I derived the starting approximation that is subsequently polished by FindRoot[] using Padé approximation.

As an example:

N[prandtlMeyerMachNumber[7/5, 54 °], 20]

Note the use of the degree sign, as the function expects radian arguments.

For the case of $\gamma=7/5$ (which seems to be the common case), the routine will fail at exactly $\nu=\dfrac{\pi(\sqrt{6}-1)}{2}$ (the limiting value of $\nu$), but should otherwise be fine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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