I am writing a program to calculate Prandtl-Meyer expansion fan values and am having trouble selecting ONLY the positive roots for the wave angle formula.
Define LibPub prandtlmeyer(m1,θ,gamma)=
Prgm
:
:Local m2,nu1,nu2,t1_t2,p1_p2
:setMode(2,2)
:
:nu1:=√(((gamma+1)/(gamma-1)))*tan(√(((gamma-1)/(gamma+1))*(m1^(2)-1)))-tan(√(m1^(2)-1))
:nu2:=nu1+θ
:m2:=zeros(√(((gamma+1)/(gamma-1)))*tan(√(((gamma-1)/(gamma+1))*(m2^(2)-1)))-tan(√(m2^(2)-1))-nu2,m2)
:m2:=m2*{2} <—- Here is the problem!!!
:t1_t2:=((1+((gamma-1)/(2))*m2^(2))/(1+((gamma-1)/(2))*m1^(2))):
:Disp "M1= ",m1
:Disp "ν1= ",nu1
:Disp "ν2= ",nu2
:Disp "M2",m2r
:EndPrgm