Post Reply 
Program returns String - how to fix
02-22-2023, 06:39 PM (This post was last modified: 02-22-2023 06:46 PM by roadrunner.)
Post: #3
RE: Program returns String - how to fix
Anyway, about your program, if you convert everything to exact it works:

Code:
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:=exact(2*π*ZIN_F);
n:="1+"+exact(w^2)+"*r^2*c^2";
x:="[r/("+exact(n)+")="+exact(ZIN_REAL)+","+exact(w)+"*c*r^2/("+exact(n)+")="+exact(ZIN_IMA)+"]";
y:="[r,c]";

z:=CAS.solve(EVAL(x),EVAL(y));

RETURN z(1);
END;

-road
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Program returns String - how to fix - hape - 02-22-2023, 06:05 AM
RE: Program returns String - how to fix - roadrunner - 02-22-2023 06:39 PM



User(s) browsing this thread: 1 Guest(s)