Post Reply 
Problem with equation in Programming
05-30-2015, 12:08 PM (This post was last modified: 05-30-2015 12:10 PM by DrD.)
Post: #7
RE: Problem with equation in Programming
This is closer to your original program, with output matching your screenshot:

Code:

export So:=342,ar:=98,d:=20,t:=30;   //  Globals persist in HOME and CAS modes
EXPORT prueba1()
BEGIN

  local Tc;    // Restricted to HOME mode
  restart;     // Clears conflicting CAS vars and settings 
  HDigits:=2;  // Added for display convenience

  A:=123;      //  Uses reserved variable
  E:=234;      //  Uses reserved variable
  S:=356;      //  Uses reserved variable

// LOCAL d,ar,So,t,S;
// LOCAL E,A,Tc;

// A:=123;  //  Don't mix local and reserved variables
// d:=20;   //  Don't mix local HOME and CAS variables
// t:=30;   //  Don't mix local HOME and CAS variables
// S:=356;  //  Don't mix local and reserved variables
// E:=234;  //  Don't mix local and reserved variables
// ar:=98;  //  Don't mix local HOME and CAS variables
// So:=342; //  Don't mix local HOME and CAS variables 
// Tc:=CAS.solve("A=d*(15-t)*S*E-x+(((ar^2)*So^2)*S*E)/(24*x^2)","x");  // List result doesn't match screenshot from post

  Tc:=solve("A=d*(15-t)*S*E-x+(ar^2*So*E)/(24*x^2)","x");  // List matches screenshot from post.            

  msgbox("Solution: " + string(Tc));  // Convert list to string object 

END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Problem with equation in Programming - DrD - 05-30-2015 12:08 PM



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