HP Forums
another fsolve question - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: another fsolve question (/thread-4194.html)



another fsolve question - roadrunner - 06-20-2015 04:01 PM

Can anyone tell me what I am doing wrong?

I plotted the function ph2o(X) (code below) and touched Menu/Fcn/Tangent and, as expected, I saw the tangent line at the cursor location that I could trace up and down the curve.

[attachment=2185]

However, when I plot function tdew(X,15) (code also below) and touch the tangent soft-key I get nothing. When I touch slope I get NaN.

[attachment=2187]

I get the same result with newton, newtonj, and bisection solver. Am I doing something wrong, or is the calculator not capable of that operation on that function?

Thanks for reading,

Paul

Code:

EXPORT ph2o(temp)
BEGIN
 local a,b;
 b:=(temp+273.15)/273.16;
 a:=1-1/b;
 return 10^(10.79574*a-5.028*log(b,10)+
  1.50475ᴇ−4*(1-10^(−8.2969*(b-1)))+
  4.2873ᴇ−4*(10^(4.76955*a)-1)-0.2138602);
END;

export tdew(r,tamb)
begin
 LOCAL y,z;
 r:=ph2o(tamb)*r/100;
 z:="fsolve(ph2o(x)="+STRING(r,2,12)+",x,−50 .. 100, newton_solver)";
 y:=CAS(z);
 RETURN y(1);
END;