how to simplify derivative?
07-15-2023, 09:11 PM (This post was last modified: 07-15-2023 10:41 PM by grbrum.)
Post: #1
 grbrum Junior Member Posts: 26 Joined: May 2023
 how to simplify derivative?
I need help to simplify derivative of sin(x)/(1+cos(x))
Try it out.
07-16-2023, 08:53 AM
Post: #2
 Thomas Klemm Senior Member Posts: 1,885 Joined: Dec 2013
RE:  how to simplify derivative?
I assume that you are familiar with calculating the derivative on the HP-48G:

$$\begin{matrix} \frac{\mathrm{d} }{\mathrm{d} x} \frac{\sin(x))}{1 + \cos(x)} = \frac{\cos(x)}{1 + \cos(x)}-\frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)^2} \\ \end{matrix}$$

We have to cheat a bit and use the following identities:

$$\begin{matrix} \sin(x)^2 + \cos(x)^2 &=& 1 \\ \left(1 + \cos(x)\right)^2 &=& \left(1 + \cos(x)\right) \cdot \left(1 + \cos(x)\right) \end{matrix}$$

Therefore we put everything on the stack for the later substitutions:

3: 1
2: '(1+COS(X))*(1+COS(X))'
1: 'COS(X)/(1+COS(X))-SIN(X)*-SIN(X)/(1+COS(X))^2'

Now we can enter the equation editor by pressing the ▼ key.
Select the expression $$\left(1 + \cos(x)\right)^2$$ and use REPL to replace it with $$\left(1 + \cos(x)\right) \cdot \left(1 + \cos(x)\right)$$.

Select this whole expression:

$$\begin{matrix} \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right) \cdot \left(1 + \cos(x)\right)} \end{matrix}$$

Use ←A to associate left which leaves us with:

$$\begin{matrix} \frac{\cos(x)}{1 + \cos(x)}-\frac{\frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)}}{\left(1 + \cos(x)\right)} \end{matrix}$$

Use ←→ to commute the arguments:

$$\begin{matrix} \frac{\cos(x)}{1 + \cos(x)}-\text{inv}\left(1 + \cos(x)\right) \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

We do the same on the left expression as well:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \cos(x) -\text{inv}\left(1 + \cos(x)\right) \cdot \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

This allows using ←M to merge-factors-left:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \left(\cos(x) - \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)}\right) \end{matrix}$$

Now we can use AF to add the fractions:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{\left(\left(1 + \cos(x)\right) \cdot \cos(x) - \sin(x) \left(-\sin(x)\right)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

We use ←D to distribute-left the expression: $$\left(1 + \cos(x)\right) \cdot \cos(x)$$ to end up with:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{1 \cdot \cos(x) + \cos(x) \cdot \cos(x) - \sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

With COLCT we can clean that up a bit:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{\cos(x)^2 + \sin(x)^2 + \cos(x)}{\left(1 + \cos(x)\right)} \end{matrix}$$

Now we substitute $$\cos(x)^2 + \sin(x)^2$$ by $$1$$ using the REPL command again:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{1 + \cos(x)}{\left(1 + \cos(x)\right)} \end{matrix}$$

We can now use COLCT on the fraction and then on the whole expression and end up with:

$$\begin{matrix} \frac{1}{1 + \cos(x)} \end{matrix}$$

The result is then:

1: '1/(1+COS(X))'

Conclusion

The equation writer is severely limited:
• the ←M command works only for multiplication but not for division
• the AF command doesn't consider the least common denominator
• I haven't figured out a way to expand $$(a+b)^2$$ to $$(a+b)(a+b)$$
• it doesn't know about trigonometric identities

This makes it close to useless.
07-16-2023, 10:46 AM (This post was last modified: 07-16-2023 10:46 AM by Gilles.)
Post: #3
 Gilles Member Posts: 225 Joined: Oct 2014
RE:  how to simplify derivative?
(07-16-2023 08:53 AM)Thomas Klemm Wrote:  The equation writer is severely limited:
• I haven't figured out a way to expand $$(a+b)^2$$ to $$(a+b)(a+b)$$
• it doesn't know about trigonometric identities

This makes it close to useless.

Hi, with the 49-50g, its easy, you select the portion of the equition that you want manipulate and then :
1/ expand $$(a+b)^2$$ to $$(a+b)(a+b)$$
In the equation writer juste push soft menu FACTO
2/[*] it doesn't know about trigonometric identities
In the EQW choose Right Shift TRIG and then there are a lot of possibilité (TCOLLECT, TEXPAND etc.)
07-16-2023, 09:57 PM
Post: #4
 grbrum Junior Member Posts: 26 Joined: May 2023
RE:  how to simplify derivative?
Thank you. I love your explanation. I will study it carefully. I guess the 48 can’t see the sin(x)2+cos(x)2 =1. And the answer is super crazy.
Thank you.

(07-16-2023 08:53 AM)Thomas Klemm Wrote:  I assume that you are familiar with calculating the derivative on the HP-48G:

$$\begin{matrix} \frac{\mathrm{d} }{\mathrm{d} x} \frac{\sin(x))}{1 + \cos(x)} = \frac{\cos(x)}{1 + \cos(x)}-\frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)^2} \\ \end{matrix}$$

We have to cheat a bit and use the following identities:

$$\begin{matrix} \sin(x)^2 + \cos(x)^2 &=& 1 \\ \left(1 + \cos(x)\right)^2 &=& \left(1 + \cos(x)\right) \cdot \left(1 + \cos(x)\right) \end{matrix}$$

Therefore we put everything on the stack for the later substitutions:

3: 1
2: '(1+COS(X))*(1+COS(X))'
1: 'COS(X)/(1+COS(X))-SIN(X)*-SIN(X)/(1+COS(X))^2'

Now we can enter the equation editor by pressing the ▼ key.
Select the expression $$\left(1 + \cos(x)\right)^2$$ and use REPL to replace it with $$\left(1 + \cos(x)\right) \cdot \left(1 + \cos(x)\right)$$.

Select this whole expression:

$$\begin{matrix} \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right) \cdot \left(1 + \cos(x)\right)} \end{matrix}$$

Use ←A to associate left which leaves us with:

$$\begin{matrix} \frac{\cos(x)}{1 + \cos(x)}-\frac{\frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)}}{\left(1 + \cos(x)\right)} \end{matrix}$$

Use ←→ to commute the arguments:

$$\begin{matrix} \frac{\cos(x)}{1 + \cos(x)}-\text{inv}\left(1 + \cos(x)\right) \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

We do the same on the left expression as well:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \cos(x) -\text{inv}\left(1 + \cos(x)\right) \cdot \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

This allows using ←M to merge-factors-left:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \left(\cos(x) - \frac{\sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)}\right) \end{matrix}$$

Now we can use AF to add the fractions:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{\left(\left(1 + \cos(x)\right) \cdot \cos(x) - \sin(x) \left(-\sin(x)\right)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

We use ←D to distribute-left the expression: $$\left(1 + \cos(x)\right) \cdot \cos(x)$$ to end up with:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{1 \cdot \cos(x) + \cos(x) \cdot \cos(x) - \sin(x) \left(-\sin(x)\right)}{\left(1 + \cos(x)\right)} \end{matrix}$$

With COLCT we can clean that up a bit:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{\cos(x)^2 + \sin(x)^2 + \cos(x)}{\left(1 + \cos(x)\right)} \end{matrix}$$

Now we substitute $$\cos(x)^2 + \sin(x)^2$$ by $$1$$ using the REPL command again:

$$\begin{matrix} \text{inv}\left(1 + \cos(x)\right) \cdot \frac{1 + \cos(x)}{\left(1 + \cos(x)\right)} \end{matrix}$$

We can now use COLCT on the fraction and then on the whole expression and end up with:

$$\begin{matrix} \frac{1}{1 + \cos(x)} \end{matrix}$$

The result is then:

1: '1/(1+COS(X))'

Conclusion

The equation writer is severely limited:
• the ←M command works only for multiplication but not for division
• the AF command doesn't consider the least common denominator
• I haven't figured out a way to expand $$(a+b)^2$$ to $$(a+b)(a+b)$$
• it doesn't know about trigonometric identities

This makes it close to useless.
07-17-2023, 07:44 AM (This post was last modified: 07-17-2023 07:45 AM by Gilles.)
Post: #5
 Gilles Member Posts: 225 Joined: Oct 2014
RE:  how to simplify derivative?
There is no native CAS with the 48 serie (49-50 got it). I never used it, but I think that if you want to do this kind of thing on a 48, you can use erable library
07-18-2023, 07:54 PM
Post: #6 BruceH Senior Member Posts: 470 Joined: Dec 2013
RE:  how to simplify derivative?
(07-16-2023 08:53 AM)Thomas Klemm Wrote:
• I haven't figured out a way to expand $$(a+b)^2$$ to $$(a+b)(a+b)$$
• it doesn't know about trigonometric identities

This makes it close to useless.

You can use the MATCH↓ and MATCH↑ commands to create your own functions to carry out these transformations.
07-18-2023, 08:35 PM
Post: #7
 FLISZT Member Posts: 61 Joined: Nov 2022
RE:  how to simplify derivative?
(07-18-2023 07:54 PM)BruceH Wrote:
(07-16-2023 08:53 AM)Thomas Klemm Wrote:
• I haven't figured out a way to expand $$(a+b)^2$$ to $$(a+b)(a+b)$$
• it doesn't know about trigonometric identities

This makes it close to useless.

You can use the MATCH↓ and MATCH↑ commands to create your own functions to carry out these transformations.

… the hard way! Bruno
Sanyo CZ-0124 ⋅ TI-57 ⋅ HP-15C ⋅ Canon X-07 + XP-140 Monitor Card ⋅ HP-41CX ⋅ HP-28S ⋅ HP-50G ⋅ HP-50G
07-19-2023, 12:59 AM
Post: #8
 Thomas Klemm Senior Member Posts: 1,885 Joined: Dec 2013
RE:  how to simplify derivative?
(07-18-2023 07:54 PM)BruceH Wrote:  You can use the MATCH↓ and MATCH↑ commands to create your own functions to carry out these transformations.

The second argument would be for instance:

{'(&Z)^2' '&Z*&Z'}

This can be done before entering the equation editor.

Not sure about the trigonometric identity though.
It seems easier to replace the sum by 1 manually in the editor than writing a pattern.
But then you'd have to know in advance that you will need this value and put it on the stack.
07-19-2023, 11:33 PM
Post: #9 BruceH Senior Member Posts: 470 Joined: Dec 2013
RE:  how to simplify derivative?
The MATCH commands return a test result to say whether a match occurred or not. So for trigonometric identities you would, I presume, create a program that tries several identities in succession, noting which succeed, and then, based on that information, decide which one or ones were the appropriate ones to apply.
 « Next Oldest | Next Newest »

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