468,113 Members | 2,151 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,113 developers. It's quick & easy.

Solving for the zero of a difficult equation!

Hello all,

Looking for some advice on how to solve for the zeros of a particular variable in the equation below. I am new to Python, coming from MATLAB. I have a conceptual rocket propulsion sizing code from MATLAB that I am transcribing into Python since I am no longer a student and have no access to MATLAB since the license expired.


The equation: 0 = (1/M**2)*(((2/(ga+1))*(1+((ga-1)/2)*M**2))**((ga+1)/(ga-1)))-AR**2
where (just as an example):
ga = 1.147
AR = 45


Better reference here: http://www.joshtheengineer.com/2016/11/16/solving-the-area-mach-number-relation/



Everything has been defined already except for the Mach number, M. What this step in the code does is just figure out what Mach number is required given the other predetermined parameters. Obviously it is quadratic, so there will be two solutions. One will be between 0 and 1, which would be the subsonic solution while the other is the supersonic solution. The supersonic solution will be anywhere from 1 to 5 ish. I just need assistance on how to have this equation solved for those two values of M, and give me the value that is greater than or equal to 1. I may technically be a rocket scientist, but we did not get enough exposure to complex mathematical coding in my Aerospace Engineering program.

Any help is greatly appreciated!
1 Week Ago #1
0 1826

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Sven Dzepina | last post: by
3 posts views Thread by greg.smith | last post: by
5 posts views Thread by Tiza Naziri | last post: by
2 posts views Thread by Michael MacDonald | last post: by
9 posts views Thread by TG | last post: by
2 posts views Thread by purple | last post: by
1 post views Thread by zufie | last post: by
3 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.