Post Reply 
ppl program question
11-02-2014, 06:01 PM
Post: #1
ppl program question
In CAS a series of steps with variables containing expressions works symbolically just fine:

r:=[-sin(t)+t,-cos(t)]
v:=diff(r,t)
a:=diff(v,t)

each step retains its symbolic representation, unevaluated, enabling successive computation to proceed.

However, a program doing the same thing evaluates each step numerically, thereby losing context for further steps:

EXPORT a()
BEGIN
local a,r,t,v;
r:=[t-sin(t),−cos(t)];
v:=diff(r,t);
a:=diff(v,t);
END;

Variable 'r' becomes [0,-1] and the program errors beyond that step. I've tried the quote(Expr) function: "Returns an expression unevaluated," as described in the user guide, which returns 'r'. If possible, how can I make the program behave as if manually entered in cas?

Thanks!

-Dale-
Find all posts by this user
Quote this message in a reply
11-02-2014, 06:22 PM (This post was last modified: 11-02-2014 06:28 PM by Han.)
Post: #2
RE: ppl program question
Ppl programs are compiled as if they were sequences of commands executed in Home view. It appears you want to create a cas program. If you insist on creating a home program then consider using the cas() command -- though you must watch out for the nuances. I am sure a quick search of the boards will proved plenty of older discussion on this topic.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
11-02-2014, 06:26 PM
Post: #3
RE: ppl program question
The program you show does not appear to be a CAS program.
CAS programs start thus:
(a)->BEGIN
etc.


Try entering a s a CAS program and see if that gives the behavior you expect.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-03-2014, 05:17 AM
Post: #4
RE: ppl program question
Thanks for the info. I can work with that.
Find all posts by this user
Quote this message in a reply
Post Reply 




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