Post Reply 
Help with Cas program
01-03-2014, 08:48 PM
Post: #1
Help with Cas program
Hi, I wonder if someone could please help.
After reading many posts about using Cas commands/functions in Home view, I think I am now totally confused AND frustrated.
I have written a program which requests the user to input a function and this is then stored in F1. I then use a loop to generate a table of values based on a start and end value (interval) using a step increment. I store these values in list, say L1.
This works well for any non Cas function, eg e^X, Sin(X), X^2 etc.

The problems start when a Cas function is entered, for example int(Sin(X^2),X,0,X).
I have tried various suggestions in my program to correctly evaluate this function eg:

1. L1(1):=Cas('F1(.1)')

2. L1(1):=Cas("F1(.1)")

3. L1(1):=Eval(Cas('F1(.1)') etc,etc.

I either get some value*X, or incorrect values or just plain 0.

I hope I have explained the problem in an understandable manner.
Thanks for any advice.
John
Quote this message in a reply
01-03-2014, 09:14 PM (This post was last modified: 01-03-2014 09:40 PM by Michael de Estrada.)
Post: #2
RE: Help with Cas program
Replace X with x for your function variable. Also, do not make your upper limit of integration the same as your function variable. It should be your input value. For example: int(SIN(x^2),x,0,X) will work. Make sure you have complex checked in your CAS settings, since SIN is converted to its complex exponential form. If you use it in a program, use the form CAS("L1(1):=int(SIN(x^2),x,0,X) ").
Find all posts by this user
Quote this message in a reply
01-03-2014, 09:47 PM
Post: #3
RE: Help with Cas program
Try the above suggestions by Michael. If that doesn't help, post your code, that will make it easier to ferret out any problems.
Find all posts by this user
Quote this message in a reply
01-07-2014, 07:32 PM
Post: #4
RE: Help with Cas program
Hi Michael and Helge, apologies for not replying earlier to your advice.

In the end, I used the integral template enclosed in single quotes and used a variable other than X for the upper limit.
A simple L1(var):=Eval(F1); worked!!
No use of Cas. or Cas("L1():=..."). Really confusing at times.

By the way Michael, if I used lower case x in defining the function in Home view,as suggested, results in an error.
Thanks to both of you for the suggestions.
Regards
John
Quote this message in a reply
01-07-2014, 11:10 PM
Post: #5
RE: Help with Cas program
Glad that worked out for you!
Find all posts by this user
Quote this message in a reply
Post Reply 




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