Post Reply 
CAS.diff command results diff command again
06-15-2017, 07:00 PM (This post was last modified: 06-15-2017 07:33 PM by roadrunner.)
Post: #8
RE: CAS.diff command results diff command again
Here is a function that will differentiate equations written with HOME variables WITHOUT substituting in the value contained in the variable:

PHP Code:
EXPORT HOMEDIFF(z,n)
BEGIN
 LOCAL a
;
 
a:=CAS("subst(z,n=t25369a)");
 RETURN 
CAS(EVAL("subst("+simplify(CAS(EVAL("diff("+a+",QUOTE(t25369a))")))+",t25369a=n)"));
END

example 1:

fx:='SEC(X)+X^2'
HOMEDIFF(fx,'X')

returns:

(2*X*SIN(X)^2-2*X-SIN(X))/(SIN(X)^2-1)

example 2:

HOMEDIFF('X^2+LN(SIN(X))','X')

returns:

(2*X*SIN(X)+COS(X))/SIN(X)

There are a few caveats:

1. It doesn't always work on the handheld calculator. It only works on the emulator and apps. Presumably, if the handheld is ever updated, it should start working there;

2. It doesn't work if you have either a CAS or user variable named t25369a;

3. Simplification isn't very good;

4. You have to use a valid CAS equation: X^3.2 won't work, X^(32/10) will work.

-road

edited to add caveat #4 and to correct a grammatical error
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: CAS.diff command results diff command again - roadrunner - 06-15-2017 07:00 PM



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