
×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center

×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center
 HP Community
 >
 Other Products
 >
 Calculators
 >
 HP Prime equation solving program returns no answer when var...
 Mark Topic as New
 Mark Topic as Read
 Float this Topic for Current User
 Bookmark
 Subscribe
 Mute
 Printer Friendly Page
Create an account on the HP Community to personalize your profile and ask a question
HP Prime equation solving program returns no answer when variable has a decimal exponent
08172017 08:13 AM
Hi, Community
I am busy trying to write a program that enables the user to select which variable is the unknown, and enter values for the other variables, after which the calculator solves for the unknown. However, whenever the variable I'm trying to solve for has an exponent that is not a whole number, the calculator returns an answer of '{}'.
Can somebody see the problem?
Code below:
EXPORT Q_MANNINGS()
BEGIN
MSGBOX(" Q = (1/N)*(A^(5/3))*(S^(1/2))/(P^(2/3)) ");
CHOOSE(Z,"SELECT UNKNOWN","Q","N","A","S","P");
IF Z==1 THEN
INPUT({N,A,S,P});
RETURN CAS.fsolve(((A^(5/3))*(S^(1/2)))/((N)*(P^(2/3)))X,X);
END;
IF Z==2 THEN
INPUT({Q,A,S,P});
RETURN CAS.fsolve(((A^(5/3))*(S^(1/2)))/((X)*(P^(2/3)))Q,X);
END;
IF Z==3 THEN
INPUT({Q,N,S,P});
RETURN CAS.fsolve(((X^(5/3))*(S^(1/2)))/((N)*(P^(2/3)))Q,X);
END;
IF Z==4 THEN
INPUT({Q,N,A,P});
RETURN CAS.fsolve(((A^(5/3))*(X^(1/2)))/((N)*(P^(2/3)))Q,X);
END;
IF Z==5 THEN
INPUT({Q,N,A,S});
RETURN CAS.fsolve(((A^(5/3))*(S^(1/2)))/((N)*(X^(2/3)))Q,X);
END;
END;
08172017 09:31 AM  edited 08172017 09:37 AM
fsolve is a CAS command so the variable you want to solve for, which in this case is: x, has to be in lowercase.
Besides the argument of CAS.fsolve has to be between quotes.
So I think that instead of
CAS.fsolve(((X^(5/3))*(S^(1/2)))/((N)*(P^(2/3)))Q,X)
you have to write:
CAS.fsolve("((x^(5/3))*(S^(1/2)))/((N)*(P^(2/3)))Q,x")
08172017 10:12 AM
I consider this a very helpful article concerning CAS commands in non  CAS programs:
Didn't find what you were looking for? Ask the community