I have to convert a Matlab script to C#. The matlab code uses fsolve() to find the fixed point of a function.
function Pr2=adiab(Pr1,Tr1,Pv1,Tv1,Pv2,k,kv,Vv,Vr)
Pr2=(Pr1^(1/k)-Vv/Vr*Tr1/Tv1*Pr1^((1-k)/k)*(Pv2^(1/kv)/Pv1^((1-kv)/kv)-Pv1))^k;
end
% ...
Prav(i+1)=fsolve(@(Pr2) Pr2-adiab(Prav(i),Trav(i),Pa,Ta,Pr2,k,kv,Vvt,Vrt),Prav(i));
I know I need a numerical solver but there are so many I don't know which method is best suited for this problem.