HP Forums
[48] how to simplify derivative? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: [48] how to simplify derivative? (/thread-20183.html)



[48] how to simplify derivative? - grbrum - 07-15-2023 09:11 PM

I need help to simplify derivative of sin(x)/(1+cos(x))
Try it out.


RE: [48] how to simplify derivative? - Thomas Klemm - 07-16-2023 08:53 AM

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.


RE: [48] how to simplify derivative? - Gilles - 07-16-2023 10:46 AM

(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.)


RE: [48] how to simplify derivative? - grbrum - 07-16-2023 09:57 PM

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.



RE: [48] how to simplify derivative? - Gilles - 07-17-2023 07:44 AM

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


RE: [48] how to simplify derivative? - BruceH - 07-18-2023 07:54 PM

(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.


RE: [48] how to simplify derivative? - FLISZT - 07-18-2023 08:35 PM

(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! Smile


RE: [48] how to simplify derivative? - Thomas Klemm - 07-19-2023 12:59 AM

(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.


RE: [48] how to simplify derivative? - BruceH - 07-19-2023 11:33 PM

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.