Using SLOPE function in Function APP with CAS defined function
12-08-2014, 06:43 PM
Post: #1
 cdecastro Junior Member Posts: 22 Joined: Dec 2013
Using SLOPE function in Function APP with CAS defined function
Here's a little problem I encountered with SLOPE.

in CAS, enter,

f(x):=x^2

then go to the Function App and enter f(X) to graph. Now try to obtain the slope using the SLOPE function and the calculator reports NaN.

FYI: The SLOPE function does work if I enter F1(x) = X^2 in the Function App and find the slope.

Thanks,
Chris
12-09-2014, 03:58 AM (This post was last modified: 12-09-2014 04:01 AM by mpowell@rogershsa.com.)
Post: #2
 mpowell@rogershsa.com Junior Member Posts: 17 Joined: Dec 2014
RE: Using SLOPE function in Function APP with CAS defined function
(12-08-2014 06:43 PM)cdecastro Wrote:  Here's a little problem I encountered with SLOPE.

in CAS, enter,

f(x):=x^2

then go to the Function App and enter f(X) to graph. Now try to obtain the slope using the SLOPE function and the calculator reports NaN.

FYI: The SLOPE function does work if I enter F1(x) = X^2 in the Function App and find the slope.

Thanks,
Chris

Tried it out, I think it is a bug in the calculation. I enter f1(12) to plot it and only got a straight line.

Attached File(s) Thumbnail(s)

12-09-2014, 02:26 PM
Post: #3
 DrD Senior Member Posts: 1,133 Joined: Feb 2014
RE: Using SLOPE function in Function APP with CAS defined function
SLOPE() is a HOME function. Mixing HOME with CAS is just evil.

It can be done though (case matters!):

CAS View
f(x):=x^2; ---> x^2
g:=SLOPE(X^2,2); ---> 4;

Function app symbolics:
F1(X)=f(X)
F2(X)=g
12-09-2014, 02:46 PM (This post was last modified: 12-09-2014 02:47 PM by cdecastro.)
Post: #4
 cdecastro Junior Member Posts: 22 Joined: Dec 2013
RE: Using SLOPE function in Function APP with CAS defined function
I understand many of the issues related to the "culture clash" between the HOME environment and the CAS environment but find it unfortunate that there is not better integration. Students working in the CAS will certainly have occasion to work with the graphical representations of expressions derived within the CAS. When options for finding slope, zeros, etc, present themselves to the user, one expects they will operate correctly. I like the Prime but hope future developments will include a more seamless integration.

Thank you for the replies!

Regards,
Chris
12-09-2014, 02:52 PM (This post was last modified: 12-09-2014 02:55 PM by Han.)
Post: #5
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: Using SLOPE function in Function APP with CAS defined function
(12-08-2014 06:43 PM)cdecastro Wrote:  Here's a little problem I encountered with SLOPE.

in CAS, enter,

f(x):=x^2

then go to the Function App and enter f(X) to graph. Now try to obtain the slope using the SLOPE function and the calculator reports NaN.

FYI: The SLOPE function does work if I enter F1(x) = X^2 in the Function App and find the slope.

Thanks,
Chris

It does seem there is a bug with using CAS functions for the definition of the F0 through F9 variables. I think there was some discussion about this a while back.

That said, unless you plan to use the formula for f(x) for other calculations and you don't want it to affect F1, you can ignore creating f(x) and simply type:

F1(x):=x^2; // you can use any dummy variable, just be consistent
F2:=diff(F1); // this is "functional" derivative as opposed to the derivative with respect to a specific variable

F1 can be used like any regular function you create in the CAS.

On the other hand if you need to have f(x) separately defined, then:

f(x):=x^2;
F1:=f;

will do what you want.

As usual, this is only one of many ways to do what you want.

Graph 3D | QPI | SolveSys
12-09-2014, 03:01 PM (This post was last modified: 12-09-2014 03:09 PM by Han.)
Post: #6
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: Using SLOPE function in Function APP with CAS defined function
(12-09-2014 02:46 PM)cdecastro Wrote:  I understand many of the issues related to the "culture clash" between the HOME environment and the CAS environment but find it unfortunate that there is not better integration. Students working in the CAS will certainly have occasion to work with the graphical representations of expressions derived within the CAS. When options for finding slope, zeros, etc, present themselves to the user, one expects they will operate correctly. I like the Prime but hope future developments will include a more seamless integration.

Thank you for the replies!

Regards,
Chris

For me, a lot of it was due to unfamiliarity with the CAS itself. After I spent some time reading up on xcas/giac I felt a bit more comfortable with using CAS and Home together. One of the most important things I learned was how the CAS handles functions.

A function can be created several ways:

f(x):=x^2;
OR
f:=(x)->(x^2); // like in Maple

Functions can be "copied":

F1:=f;

and there is also functional algebra:

g(x):=x^2;
h(t):=3*t+1;
f:=g+h;

f(s); // -> s^2 + 3*s + 1

There is also a difference between a mathematical function vs a CAS function. When we read $$f(x) = x^2$$ in a textbook, then $$f(x)$$ is both a (mathematical) function _and_ the evaluation of the function $$f$$ at an input of $$x$$. In the CAS (and most CAS) typing f(x) results in the evaluation of a function at x -- which is an expression in terms of x, and typing f alone actually produces a (CAS) function.

Hope that helps.

Edit: The command f:=g+h; is the same as f(x):=g(x)+h(x). If you had wanted to create $$f(x) = x^2 + 3t+1$$ so that the $$t$$ is a constant with respect to $$x$$, then type: f(x):=g(x)+h(t); as the right hand side is an expression in terms of x and t, and the := operator creates a function with only x as the variable as specified by the (x) after f.

Graph 3D | QPI | SolveSys
12-09-2014, 04:26 PM
Post: #7
 DrD Senior Member Posts: 1,133 Joined: Feb 2014
RE: Using SLOPE function in Function APP with CAS defined function
It's not so bad having dual personalities in this device. I'm finding more difficulty with the help resources, due to inconsistencies and lack of clarity. Documentation really needs improvement.
12-10-2014, 11:49 AM
Post: #8
 parisse Senior Member Posts: 1,322 Joined: Dec 2013
RE: Using SLOPE function in Function APP with CAS defined function
(12-09-2014 03:01 PM)Han Wrote:  Edit: The command f:=g+h; is the same as f(x):=g(x)+h(x). If you had wanted to create $$f(x) = x^2 + 3t+1$$ so that the $$t$$ is a constant with respect to $$x$$, then type: f(x):=g(x)+h(t); as the right hand side is an expression in terms of x and t, and the := operator creates a function with only x as the variable as specified by the (x) after f.
Unfortunately, it's a little more tricky, f:=g+h is not equivalent to f(x):=g(x)+h(x). The reason is that when you write f(x):=g(x)+h(x), the right handside is not eval-ed, g and h are not replaced by their value, if g or h is modified, f will reflect the modification.
 « Next Oldest | Next Newest »