CAS question.
04-10-2015, 09:17 PM (This post was last modified: 04-13-2015 09:35 PM by Spybot.)
Post: #1
 Spybot Member Posts: 176 Joined: Feb 2015
CAS question.
Hello Everyone!

All I'm trying to do is to solve a linear equation, I've tried many combinations of code and no success, the screenshot shows the unwanted result, here is my code:

////////////////////////////////////////////////////////////////////////////////
EXPORT test()
BEGIN
LOCAL A,B,C;
LOCAL AAA,eqn1;

INPUT({{A,[0],{7,15,1}},{B,[0],{35,15,1}},{C,[0],{64,15,1}}},"I HAVE...",{"A:","B:","C:"},{"Enter Coefficient A: (Any Real Number.)","Enter Coefficient B: (Any Real Number.)","Enter Coefficient C: (Any Real Number.)"});

eqn1:=CAS(A*x+B*y+C=0);
AAA:=CAS(solve(eqn1,y));

PRINT();
PRINT(eqn1);
PRINT(AAA);
END;
////////////////////////////////////////////////////////////////////////////////////////

Any help will be appreciated!

Spybot.

Spybot.
04-10-2015, 09:24 PM (This post was last modified: 04-10-2015 09:30 PM by Han.)
Post: #2
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: Probably a dumb question!
1. The CAS() command requires a string argument
2. You are mixing the use of local variables with global variables (note that A is a built-in global variable but you've also created a local variable named A as well).

Try:

cascmd:="solve(" + A + "*x+" + B + "*y+" + C + "=0,y)";
CAS(cascmd);

You are essentially trying to use the CAS to do a symbolic solve. If that is the goal, why not just build a CAS program to do the solving, and use it as a sub-routine?

Graph 3D | QPI | SolveSys
 « Next Oldest | Next Newest »

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