473,287 Members | 3,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

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!
Apr 3 '21 #1
0 3902

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

Similar topics

4
by: Sven Dzepina | last post by:
Hello people =) Has somebody a nice script, which can solve equations ? It would be super, if someone has an idea where I can get such a script / code in php. Thanks. Gretting!
3
by: greg.smith | last post by:
Hi there, I've been trying to solve this different via numerical methods(C programming) and it's driving me crazy.... I can't post my code because it's simply one big mess and doesn't work. ...
5
by: Tiza Naziri | last post by:
Hi, How to represent this matrix equation in C code: / a0 \ / 0 1 0 1 0 0 1 0 \/ b0 \ | a1 | | 0 0 1 0 1 0 0 1 || b1 | | a2 | | 1 0 0 1 0 1 0 0 || b2 | | a3 |=| 0 1 0 0 1 0 1 0 || b3 | | a4...
2
by: Michael MacDonald | last post by:
I have written a simple program that calculates a running $ total. This program uses a checkbox to acknowledge that that version of the ticket is desired and it checks the Qty box to see how many...
9
by: TG | last post by:
Hi there. Anyone knows how to use numpy / scipy in order to solve this ? * A is an array of shape (n,) * X is a positive float number * B is an array of shape (n,) * O is an array of shape...
6
by: mismis | last post by:
HELP!..PLEASE..i have a project that asks to write a C++ program solving for the root of the equation (x*x*x)-(x*x)-(9x)+(9) ........huhuhu..please help..i really need to pass..please..
1
by: candacefaye1 | last post by:
1. write a C++ program to decide if the coefficients of a quadratic equation have real roots. The three choices will be to write the message “zero divide” when A is zero, write the message “no real...
2
by: purple | last post by:
Could you guys do me a favor for solving a equation set? Z=d/4*(1-SIN(X)/X) X=8q/(D^2*Y)+SIN(X) Y=1/n*Z^(2/3)*i^(1/2) In this equation set, X,Y&Z are the unkown parameters, the others say,...
1
by: zufie | last post by:
This is my original equation: =(/)*100 When the denomimator is zero I am unable to calculate the percentage. I tried changing my equation to this format: =IIf( = 0, 0, / ) I also tried:
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.