02-22-2023, 06:05 AM
Have a look at this program:
ZIN_F:=4000000;
ZIN_REAL:=400;
ZIN_IMA:=400;
EXPORT ZIN()
BEGIN
LOCAL REAL,IMA,n,w;
LOCAL x,y,z;
INPUT({{ZIN_F,[0]},{ZIN_REAL,[0]},{ZIN_IMA,[0]}},"IMPEDANCE",{"freq","real","imag"});
w:=2*π*ZIN_F;
n:="1+"+w^2+"*r^2*c^2";
x:="[r/("+n+")="+ZIN_REAL+","+w+"*c*r^2/("+n+")="+ZIN_IMA+"]";
y:="[r,c]";
z:=CAS.solve(EVAL(x),EVAL(y));
RETURN z(1);
END;
It returns a String like "solve([(........" and does not really try to solve.
Years ago I bought myself a prime with the intention to learn how to properly use it. This is one of the old programs I tried to write during that time and I have to admit I am not 100% sure if it ever worked as inteded - I think it is clear what I want to achieve.
Can someone point out what I am doing wrong? Thanks in advance.
sincerely Hape
ZIN_F:=4000000;
ZIN_REAL:=400;
ZIN_IMA:=400;
EXPORT ZIN()
BEGIN
LOCAL REAL,IMA,n,w;
LOCAL x,y,z;
INPUT({{ZIN_F,[0]},{ZIN_REAL,[0]},{ZIN_IMA,[0]}},"IMPEDANCE",{"freq","real","imag"});
w:=2*π*ZIN_F;
n:="1+"+w^2+"*r^2*c^2";
x:="[r/("+n+")="+ZIN_REAL+","+w+"*c*r^2/("+n+")="+ZIN_IMA+"]";
y:="[r,c]";
z:=CAS.solve(EVAL(x),EVAL(y));
RETURN z(1);
END;
It returns a String like "solve([(........" and does not really try to solve.
Years ago I bought myself a prime with the intention to learn how to properly use it. This is one of the old programs I tried to write during that time and I have to admit I am not 100% sure if it ever worked as inteded - I think it is clear what I want to achieve.
Can someone point out what I am doing wrong? Thanks in advance.
sincerely Hape