Post Reply 
Bug or badly suboptimal result for derivative
12-18-2015, 03:18 PM
Post: #1
Bug or badly suboptimal result for derivative
The CAS, when asked to derive the expression sin(x-cos x) returns a gigantic expression (I am not going to copy it here), containing imaginary units and otherwise close to unreadable.

The derivative could be properly determined according to the following steps (chain rule):
f(u)=sin(u) => f'(u)=cos(u)
f'(g(x))=cos(x-cos(x))
g(x)=x-cos(x) => g'(x)=1+sin(x), therefore
dy/dx=f'(g(x))g'(x)=(cos(x-cos(x)))*(1+sin(x))

I am having software 2015.6.17 (8151); HW ver C; CAS ver 1.1.2-11; OS v0.037.526.
Find all posts by this user
Quote this message in a reply
12-18-2015, 03:39 PM (This post was last modified: 12-18-2015 03:39 PM by CR Haeger.)
Post: #2
RE: Bug or badly suboptimal result for derivative
(12-18-2015 03:18 PM)quinyu Wrote:  The CAS, when asked to derive the expression sin(x-cos x) returns a gigantic expression (I am not going to copy it here), containing imaginary units and otherwise close to unreadable.

The derivative could be properly determined according to the following steps (chain rule):
f(u)=sin(u) => f'(u)=cos(u)
f'(g(x))=cos(x-cos(x))
g(x)=x-cos(x) => g'(x)=1+sin(x), therefore
dy/dx=f'(g(x))g'(x)=(cos(x-cos(x)))*(1+sin(x))

I am having software 2015.6.17 (8151); HW ver C; CAS ver 1.1.2-11; OS v0.037.526.

Works okay for me with CAS and Radians set. Get interesting results with Degrees set.

   
Find all posts by this user
Quote this message in a reply
12-18-2015, 03:49 PM (This post was last modified: 12-18-2015 03:57 PM by Maro.)
Post: #3
RE: Bug or badly suboptimal result for derivative
which CAS settings do you use?

when using "Simplify: Minimum" (page 1 settings) I get the compact result as expected. However, when using "Simplify: Maximum" I get a very (!) large expression too. I would expect it the other way around ... really strange ...

Edit: HP 50g: gives the expected (sin(x)+1)*cos(x-cos(x))
Find all posts by this user
Quote this message in a reply
12-18-2015, 04:02 PM (This post was last modified: 12-18-2015 04:38 PM by quinyu.)
Post: #4
RE: Bug or badly suboptimal result for derivative
I'm also set to radians. Also, Exact, Use Root, no Princ, no Comp, no i, simplify=maximum. I'd expect it to work at least as good as simplify=minimum...

By the way, the HP 50g finds the proper derivative. So does the TI-nSpire CAS, the TI-89 Titanium, the TI-92, Mathematica 10.0, Maple 18, MATLAB R2015a (in MuPAD as well as in the main prog). Casio ClassPad II emu 2.0000.4000 does well with it too. So something is happening that's pretty specific to the prime.
Find all posts by this user
Quote this message in a reply
12-18-2015, 08:24 PM
Post: #5
RE: Bug or badly suboptimal result for derivative
Try doing this:

   

With these settings:

   

Do you get something different?

-road
Find all posts by this user
Quote this message in a reply
12-18-2015, 09:23 PM
Post: #6
RE: Bug or badly suboptimal result for derivative
Settings I set as required, but I get a red X error for f:=(u) -> sin(u) already. How to resolve?
Find all posts by this user
Quote this message in a reply
12-19-2015, 12:10 PM
Post: #7
RE: Bug or badly suboptimal result for derivative
That's weird. It only gives me the red X error when I do that assignment in Home. In CAS it works ok.

Sometimes I get strange random CAS variables that mess things up. I don't know what I do to get them but maybe you have some too. Check your CAS variables and reset any that look strange, also make sure you don't have f, g, u, x, etc. predefined as something strange.

-road
Find all posts by this user
Quote this message in a reply
12-19-2015, 01:46 PM
Post: #8
RE: Bug or badly suboptimal result for derivative
Uhm, maybe I am wrong at some very basic level... is that a colon and an equal sign, after each other, or is that the symbolic depiction of some other (likely assignment) function? Because I have typed a : then an = in the input.
Find all posts by this user
Quote this message in a reply
12-20-2015, 12:37 PM
Post: #9
RE: Bug or badly suboptimal result for derivative
A colon and an equal sign := is correct. Something else must be wrong. If you have an emulator you can try copy and pasting this:

f(u):=sin(u)

or this:

f:=(u)->sin(u)

They should both give the same result.

-road
Find all posts by this user
Quote this message in a reply
12-20-2015, 02:05 PM
Post: #10
RE: Bug or badly suboptimal result for derivative
Okay, now it works; no clue why it did not previously. Either way, even though I can now make the calculator to follow what I would do in that given situation (which is good for checking the procedure), I am still unable to get the calculator do it on its own. Are there any (hidden) switches to diff so as to influence the preference to the possible strategical steps in the evaluation tree?
Find all posts by this user
Quote this message in a reply
12-21-2015, 03:18 PM
Post: #11
RE: Bug or badly suboptimal result for derivative
There are no hidden switches that I am aware of. I'm glad you got it working.

-road
Find all posts by this user
Quote this message in a reply
Post Reply 




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