06-04-2018, 05:07 PM
I am having trouble programming the SOLVE and fsolve functions, and I am not sure of what I am doing wrong. I can run solve on the HP Prime, but I can't programmatically solve the equation.
[9/17/19. Replaced tinypic image]
EDIT 6/4/18 corrected error in code with the radius, but still can't get code to work.
![[Image: solve1.png]](https://i.postimg.cc/N07Bc9JS/solve1.png)
EDIT 6/4/18 corrected error in code with the radius, but still can't get code to work.
Code:
EXPORT OldAAngleSetting,theta,radius,x,q,v;
EXPORT SolveProgramExamples()
BEGIN
OldAAngleSetting:=AAngle; //save apps angle mode setting
AAngle:=1; //Switch to apps radian angle mode
// SOLVE Example ----------------------------------------
//initialize variables
X:=0;
theta:=0;
//input
V:=2;
R:=0.75;
Q:=3.1;
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
x:=0;
theta:=0;
//input
v:=2;
radius:=0.75;
q:=3.1;
theta:=CAS("fsolve(x-SIN(x)=2*q/(v*radius^2),x=3)");
PRINT(" ");
PRINT("fsolve example");
PRINT("x="+x);
PRINT("theta="+theta);
AAngle:=OldAAngleSetting; //restore previous apps angle mode setting
END;