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!