Post Reply 
Calling sub programs
04-01-2015, 09:59 AM
Post: #1
Calling sub programs
I apologize but apparently I have, still, not understood how calling cas and home programs can call each other....

I have made a cas program to extract the expression from a function. I found great help here:http://www.hpmuseum.org/forum/thread-3516.html

Now that is a cas program. I tried to make a normal program that does the same because having my tools in the toolbox instead of variable content feels better. No success. My old friend "unmatched control word" says hello again and again.
Well no poblem - i have the cas function that works. I'll use that. I thought.
My Goal is to write a wrapper for convenient function plotting. I was inspired by an other thread and don't like the way the prime acts.

First start simple. I thought. Show the expression which should be drawn later:
Code:

EXPORT plot(args)
BEGIN
 LOCAL expr:=CAS.expression(args); //tried with and without CAS.

 RETURN STRING(expr);
END;

Unmatch control word hello, again. Well I remember Han explaining that when home and cas Exchange data or call functions of the other part, their arguments are resolved if possible and therefore do harm. "pass them as strings" I thought. But I fail, again... I cannot get "f1" from the original parameter.
Code:

EXPORT plot(args)
BEGIN
 LOCAL expr:=STRING(args); //CAS.string Fails aswell
END;



How do I use my cas-function expression() from a home program. Or in my specific case: how do I deal with it
Find all posts by this user
Quote this message in a reply
04-01-2015, 10:10 AM
Post: #2
RE: Calling sub programs
Or, in other words, if it is the sollution to pass f1 as a string i.e. unevaluated to Expression(), how to achieve that.
Find all posts by this user
Quote this message in a reply
04-01-2015, 03:17 PM
Post: #3
RE: Calling sub programs
It would help if you could explain what args are needed for the CAS function. If you are doing multiple arguments, then the non-CAS function must be defined explicitly in terms of those multiple arguments. I.e. the non-CAS program does not treat multiple arguments as a single "list" like CAS programs unless you literally pass a list of arguments to the non-CAS program in the form {arg1, arg2, ..., argn}

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
04-02-2015, 04:46 AM
Post: #4
RE: Calling sub programs
In that case the argument args is a function called by its name. e.g. if f(b):=b^2 then I want to call expression(f) where expression() is a cas program. Expression() Returns the expression of a function.

cas programs should Show in the toolbox. I have the Feeling that cas is more powerful than home. In both view and programs. As a result I tend to use the prime almost only in cas mode! I want to get used to it there. Custom programs are tools and you should not Need to have to get to the idea to do in a search in both, Tools and variables if you look for one.
Find all posts by this user
Quote this message in a reply
04-02-2015, 01:32 PM
Post: #5
RE: Calling sub programs
(04-02-2015 04:46 AM)leprechaun Wrote:  cas programs should Show in the toolbox. I have the Feeling that cas is more powerful than home. In both view and programs. As a result I tend to use the prime almost only in cas mode! I want to get used to it there. Custom programs are tools and you should not Need to have to get to the idea to do in a search in both, Tools and variables if you look for one.

Ha ha! I'm just the opposite. I need numbers, not symbolics. I spend my time in RPN function mode and programming in HPPL. If CAS were to disappear, I wouldn't miss it a bit.

Tom L

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




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