I am trying to solve an equation for an unknown (all other variables are known). The equation is 35.7 in the link https://nptel.ac.in/courses/112103021/36 and I want to find p2/p1.
I was able to do this in Matlab using the vpasolve function but now wish to transfer it to C++.
Write a function pressureRatio41( double p2p1, .... ) that will calculate the driving pressure ratio p4/p1 from any shock pressure ratio p2/p1 (assuming your specific-heat ratios, gamma, and sound speeds, a, are known).
Input your target p4/p1 and keep calling that function with different values of p2/p1 until you get the target value of p4/p1. Given the messy form of that function I suggest doing it by repeated bisection https://en.wikipedia.org/wiki/Bisection_method
Unless you particularly want to differentiate it that is probably the simplest method here.