Post Reply 
Programming solve function
06-05-2018, 12:33 AM
Post: #2
RE: Programming solve function
The value returned by SOLVE was not stored.
The CAS has a 'radius' command, so it will not be able to directly capture the exported variable of the program.

Code:
EXPORT OldAAngleSetting,theta,rads,q,v; //← x isn't necessary, radius → rads

EXPORT SolveProgramExamples()
BEGIN
OldAAngleSetting:=AAngle; //save apps angle mode setting
AAngle:=1; //Switch to apps radian angle mode

// SOLVE Example ----------------------------------------
//initialize variables
theta:=0;
//input
V:=2;
R:=0.75;
Q:=3.1;
X:=Solve.SOLVE(X-SIN(X)=2*Q/(V*R^2),X,3); //←
theta:=X;
PRINT();
PRINT("SOLVE example");
PRINT("X="+X);
PRINT("theta="+theta);

// fsolve Example ------------------------------
//initialize variables
theta:=0;
//input
v:=2;
rads:=0.75;
q:=3.1;
theta:=fsolve("x-SIN(x)=2*q/(v*rads^2),x=3"); //←
PRINT(" ");
PRINT("fsolve example");
PRINT("x="+theta); // ←
PRINT("theta="+theta);

AAngle:=OldAAngleSetting; //restore previous apps angle mode setting
END;

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Programming solve function - Gene222 - 06-04-2018, 05:07 PM
RE: Programming solve function - Carlos295pz - 06-05-2018 12:33 AM
RE: Programming solve function - Gene222 - 06-05-2018, 03:07 AM



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