Post Reply 
WP 34S problem in solving f'(x)=0
02-17-2015, 05:55 PM
Post: #1
WP 34S problem in solving f'(x)=0
Calculus book example function (x^2 * (x+1)^3)/((x-2)^2 * (x-4)^4).

Trying to solve f'(x)=0 proves difficult. It really requires a close narrow interval to try solve with. Using an interval as narrow as 2.4 to 2.6 produces error +inf (correct answer is ~2.46675). Keep in mind that f(x) is continuous x>2 to x<4. Using a narrower solve interval of 2.46 to 2.48 produces an inaccurate answer of ~2.4774. Using an interval of 2.44 to 2.47 is even worse, producing a zero at a nonsensical 4.0002. Even using 2.466 to 2.467 gives the 2.4774 result.

The TI 36X Pro, by contrast quickly produces a much more accurate result using single guesses such as 2.1 or 3.9.

The Prime agrees with the TI answer to 5 decimal points.

Any ideas?
Find all posts by this user
Quote this message in a reply
02-17-2015, 06:55 PM
Post: #2
RE: WP 34S problem in solving f'(x)=0
(02-17-2015 05:55 PM)lrdheat Wrote:  Any ideas?

Maybe solve \(x^3+18x^2-44x-16=0\) instead?
Code:
LBL'FX'
# 018
+
×
# 044
-
×
# 016
-
END

Now it works using [2, 4] as interval.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
02-17-2015, 07:41 PM
Post: #3
RE: WP 34S problem in solving f'(x)=0
That, of course, works...

I have a vague memory of changing the dX value stored in the small Greek letter d that the solve routine uses to .029 I think the default was an arbitrary.1 I can't remember the keystrokes that allow me to experiment with the dx increment used by solve. Perhaps the default or another choice for the increment would work better. Do you remember the keystrokes to set dx?
Find all posts by this user
Quote this message in a reply
02-17-2015, 08:10 PM
Post: #4
RE: WP 34S problem in solving f'(x)=0
(02-17-2015 07:41 PM)lrdheat Wrote:  Do you remember the keystrokes to set dx?

From the INDEX OF OPERATIONS for f’(x):
Quote:This command will attempt to call a user routine
labeled 'δx' to provide a fixed step size dx. If that
routine is not defined, a step size of 0.1 is used.

HTH
Thomas
Find all posts by this user
Quote this message in a reply
02-17-2015, 11:01 PM (This post was last modified: 02-17-2015 11:45 PM by BarryMead.)
Post: #5
RE: WP 34S problem in solving f'(x)=0
(02-17-2015 08:10 PM)Thomas Klemm Wrote:  
(02-17-2015 07:41 PM)lrdheat Wrote:  Do you remember the keystrokes to set dx?

From the INDEX OF OPERATIONS for f’(x):
Quote:This command will attempt to call a user routine
labeled 'δx' to provide a fixed step size dx. If that
routine is not defined, a step size of 0.1 is used.

HTH
Thomas
In program edit mode at the end of your program simply press f lbl Enter g D . Enter
This will enter a label of 'ΔX' Upper case delta works just as well as lower case delta for dx.
Then enter whatever program steps you want to define the delta x value "EEX" "+/-" "3" for instance,
and "g" "RTN" to return from the delta x routine.

Hope this helps, Barry
Find all posts by this user
Quote this message in a reply
02-17-2015, 11:21 PM (This post was last modified: 02-17-2015 11:27 PM by Dieter.)
Post: #6
RE: WP 34S problem in solving f'(x)=0
(02-17-2015 05:55 PM)lrdheat Wrote:  Trying to solve f'(x)=0 proves difficult. It really requires a close narrow interval to try solve with. Using an interval as narrow as 2.4 to 2.6 produces error +inf (correct answer is ~2.46675). Keep in mind that f(x) is continuous x>2 to x<4.
...
Any ideas?

As already stated, setting a suitable dx is crucial. Once this is done, everything works nicely:

Code:
LBL"δX"
x=0?
INC X
SDR 004   // set dx=x/10000, resp. 0,0001 for x=0
RTN

LBL"FX"
FILL      // just to be sure - usually not required for SLV
x^2
x<>Y
INC X
x^3
x
x<>Y
2
-
x^2
/
x<>Y
4
-
x^2
x^2
/
RTN

LBL"DER"
f'(x) "FX"
RTN

2,1 [ENTER] 3,9   SLV "DER"
     =>  2,466746549437220

The result agrees with the exact solution in 13 digits. A slight change in the δX routine (SDR 003, RSD 01) even returns the exact 16-digit result +1 ULP.
Not bad for a numeric approximation of the derivative, is it?

Dieter
Find all posts by this user
Quote this message in a reply
02-18-2015, 02:11 AM
Post: #7
RE: WP 34S problem in solving f'(x)=0
(02-17-2015 11:01 PM)BarryMead Wrote:  This will enter a label of 'ΔX' Upper case delta works just as well as lower case delta for dx.

It is case insensitive in both the delta and the x. I don't recommend having several differently named versions around.


- Pauli
Find all posts by this user
Quote this message in a reply
02-18-2015, 03:10 AM
Post: #8
RE: WP 34S problem in solving f'(x)=0
Thanks folks,

Dieter, thanks for the coding...I hadn't been aware of the SDR command, or using INC to take care of the case for x=0.

The TI 36X Pro is a great <$20 package.

The WP 34S is a most astounding shirt pocket mate!
Find all posts by this user
Quote this message in a reply
02-18-2015, 02:37 PM
Post: #9
RE: WP 34S problem in solving f'(x)=0
(02-18-2015 03:10 AM)lrdheat Wrote:  Dieter, thanks for the coding...I hadn't been aware of the SDR command, or using INC to take care of the case for x=0.

You may simply do it the way we did in the olden days:

Code:
001 LBL A
002 X=0?
003 e^x       // or x!
004 EEX
005 4
006 /
007 RTN

Rounding the dx value to a single significant digit may improve accuracy, so on the 34s I usually add a final RSD 01.

Dieter
Find all posts by this user
Quote this message in a reply
02-18-2015, 02:53 PM
Post: #10
RE: WP 34S problem in solving f'(x)=0
(02-18-2015 02:11 AM)Paul Dale Wrote:  It is case insensitive in both the delta and the x. I don't recommend having several differently named versions around.

Then the manual should also reflect this. My 3.2 version says:
Quote:f’(x) will look for a user routine labeled 'δx', returning a fixed step size dx in X.

If both delta and X are case insensitive I think this is an important detail that has to be mentioned. Otherwise the user may code a program starting with label ΔX, being confident that it does not interfere with the derivative functions as they require "...a user routine labeled 'δx'". Typing an uppercase "ΔX" also is easier and faster. Walter: please update the manual in this regard.

I would also suggest a different ΔX default value. The current 0.1 can be too large for many applications as the function is evaluated at x±5Δx. Something like the way I suggested should work better, i.e. x/1000 resp. 0,001, maybe rounded to one or two significant digits.

BTW what is the sequence the derivatives search for the delta-x label? δx → δX → Δx → ΔX? I also think it would make sense to demand a fixed uppercase label ΔX. This is the easiest version for the user and it frees three other labels to be used for other purposes. And it saves some memory and time since the derivatives do not have to search for four different labels.

Dieter
Find all posts by this user
Quote this message in a reply
02-18-2015, 05:02 PM
Post: #11
RE: WP 34S problem in solving f'(x)=0
(02-18-2015 02:53 PM)Dieter Wrote:  Then the manual should also reflect this. My 3.2 version says:
Quote:f’(x) will look for a user routine labeled 'δx', returning a fixed step size dx in X.

If both delta and X are case insensitive I think this is an important detail that has to be mentioned. Otherwise the user may code a program starting with label ΔX, being confident that it does not interfere with the derivative functions as they require "...a user routine labeled 'δx'". Typing an uppercase "ΔX" also is easier and faster. Walter: please update the manual in this regard.

Already done for v3.3 (since June 2014 at least). Smile The IOP reads:
Quote:ATTENTION: f’(x) will look for a user routine labeled δx (or δX, Δx, or ΔX, in this order), returning a fixed step size dx in X. If that routine is not defined, dx = 0.1 is set for default (arbitrary, but it had to be specified).

(02-18-2015 02:53 PM)Dieter Wrote:  BTW what is the sequence the derivatives search for the delta-x label? δx → δX → Δx → ΔX?

Please see above.

d:-)
Find all posts by this user
Quote this message in a reply
02-19-2015, 10:38 PM
Post: #12
RE: WP 34S problem in solving f'(x)=0
(02-18-2015 05:02 PM)walter b Wrote:  Already done for v3.3 (since June 2014 at least).

Fine. But the latest PDF-version still is 3.2 (if it's still around somewhere) or even 3.1. That's all the 34s users gets unless he invests in a a printed manual.

It's about time for a v. 3.3 PDF manual. Since June 2014, to be exact.

Dieter
Find all posts by this user
Quote this message in a reply
02-20-2015, 01:15 PM
Post: #13
RE: WP 34S problem in solving f'(x)=0
(02-19-2015 10:38 PM)Dieter Wrote:  ... the latest PDF-version still is 3.2 (if it's still around somewhere) or even 3.1. That's all the 34s users gets unless he invests in a a printed manual.

It's about time for a v. 3.3 PDF manual. Since June 2014, to be exact.

Ok, let me summarize as I understand it:
  • The WP 34S HW & FW as available in the net (various sources) requires some invest.
  • Powering it costs some money for batteries.
  • The comprehensive information to operate it shall be free?
Just want to make sure I didn't get you wrong.

d:-?
Find all posts by this user
Quote this message in a reply
02-20-2015, 07:38 PM
Post: #14
RE: WP 34S problem in solving f'(x)=0
(02-20-2015 01:15 PM)walter b Wrote:  Ok, let me summarize as I understand it:
  • The WP 34S HW & FW as available in the net (various sources) requires some invest.
  • Powering it costs some money for batteries.
  • The comprehensive information to operate it shall be free?
Just want to make sure I didn't get you wrong.

First of all I do not think it makes sense to offer an outdated manual that does not reflect the current software status.

But anyway: the WP34s software is free. Every contribution to the code was donated by the programmers - from the essentials of hardware control down to single algorithms humbly contributed by myself. I think the documentation is a part of this software, and the electronic version of a manual (which IMHO is required to use the software) should be free.

A printed manual is another story. If you want a "real" physical manual it is obvious that this cannot be given away for free - like any other book. If you lose the manual of your camera, your TV set or even your toaster, a new printed manual will cost you some money. A PDF, on the other hand, usually is free even for commercial products. Lost your EOS manual? Have your dealer order a new one for 20 EUR. A PDF is fine? Simply download it from Canon's website. Do you use a free image editor like Gimp? The documentation is free as well. Need a comprehensive tutorial on picture editing with this software? Buy a book.

Just my 2¢.

Dieter
Find all posts by this user
Quote this message in a reply
02-20-2015, 07:49 PM (This post was last modified: 02-20-2015 08:01 PM by BarryMead.)
Post: #15
RE: WP 34S problem in solving f'(x)=0
(02-20-2015 07:38 PM)Dieter Wrote:  A printed manual is another story. If you want a "real" physical manual it is obvious that this cannot be given away for free - like any other book. If you lose the manual of your camera, your TV set or even your toaster, a new printed manual will cost you some money. A PDF, on the other hand, usually is free even for commercial products. Lost your EOS manual? Have your dealer order a new one for 20 EUR. A PDF is fine? Simply download it from Canon's website. Do you use a free image editor like Gimp? The documentation is free as well. Need a comprehensive tutorial on picture editing with this software? Buy a book.

Just my 2¢.

Dieter
I believe that Walter is under the impression that if he makes the PDF available it would reduce his sales revenues for the printed manual. (Personally, for people like me, I can say for sure that it WOULD NOT). I have already purchased 3 of Walter's printed manuals. But I realize that I don't speak for everyone, so perhaps Walter is right and I am wrong. Perhaps keeping the manual under tight (NON OPEN SOURCE) control gives Walter more POWER to control what features do or don't get implemented in the WP-34S. I don't know what Walter's motives are. I do know that Dieter is not alone in wishing that a more updated PDF be released, even if it is only the 3.2 manual.
Find all posts by this user
Quote this message in a reply
02-20-2015, 08:06 PM
Post: #16
RE: WP 34S problem in solving f'(x)=0
(02-20-2015 07:49 PM)BarryMead Wrote:  I believe that Walter is under the impression that if he makes the PDF available it would reduce his sales revenues for the printed manual. (Personally, for people like me, I can say for sure that it WOULD NOT).

... for me neither. I would like the pdf file for quoting, copy n paste, searching, &c. But, I want the real paper manual for my arm-chair reading and personal study. I always buy the manual if its available to be purchased (always). CreateSpace still has not delivered my 3.3 copy yet, but its on the way (so I am told).

Cheers,
marcus
Smile

Kind regards,
marcus
Find all posts by this user
Quote this message in a reply
02-20-2015, 08:08 PM
Post: #17
RE: WP 34S problem in solving f'(x)=0
(02-20-2015 07:49 PM)BarryMead Wrote:  Perhaps keeping the manual under tight (NON OPEN SOURCE) control gives Walter more POWER to control what features do or don't get implemented in the WP-34S.

Nice theory though not true. Wink My "power" to control the UI is based on a very old agreement between Pauli and me. It grew on our experience during the WP 34S project: Pauli had and has expertise in numerical mathematics and coding, my strong points are in creating and maintaining consistent designs. That's all. And it works so far.

The copyright of the manual is an old story you find in the archives showing that one malicious person is sufficient to spoil an open information policy. Nevertheless I'm thinking of a way to make a pdf available.

d:-)
Find all posts by this user
Quote this message in a reply
02-20-2015, 08:20 PM (This post was last modified: 02-22-2015 04:38 PM by BarryMead.)
Post: #18
RE: WP 34S problem in solving f'(x)=0
(02-20-2015 08:08 PM)walter b Wrote:  Nice theory though not true. Wink My "power" to control the UI is based on a very old agreement between Pauli and me. It grew on our experience during the WP 34S project: Pauli had and has expertise in numerical mathematics and coding, my strong points are in creating and maintaining consistent designs. That's all. And it works so far.

The copyright of the manual is an old story you find in the archives showing that one malicious person is sufficient to spoil an open information policy. Nevertheless I'm thinking of a way to make a pdf available.

d:-)
Walter: I must admit that you and Pauli have done a fantastic job of keeping the UI clean, logical, and intuitive. I can understand why it is important to have someone review and reject changes that would destroy the integrity of this clean design. I admire and respect that noble objective. You probably don't get enough thanks for all of the hard work you have contributed to this project, so I wish to convey my sincere THANKS for that hard work. Also I think it is great that you ARE working on a method to make the PDF available to users who want to do computerized searches through the manual. I look forward to that day.
Find all posts by this user
Quote this message in a reply
02-22-2015, 05:04 PM
Post: #19
RE: WP 34S problem in solving f'(x)=0
(02-20-2015 08:08 PM)walter b Wrote:  Nevertheless I'm thinking of a way to make a pdf available.

If you'd like to make the PDF available to everyone, all you need to do is upload it to SVN, just like you did with version 3.1. The same can be done with an editable format, too.

Withholding access to the electronic manual deprives users of the speed and convenience of the PDF, crucially, they can't search. That alone should give one pause. You also can't copy-paste relevant parts when trying to help someone else. Moreover, the lack of an editable version prevents the community from contributing to the documentation in meaningful ways. You can submit corrections but that won't inspire a similar level of participation and inventiveness you could have if the process was very quick and transparent and experimentation was easy. If someone would like to take up this project and create e.g. a 36S, they'd have to duplicate the work that's already been done instead of being able to continue it and adapt the documentation.

I find it astounding that the lack of an up-to-date PDF is a choice and not some externally imposed restriction, especially since the other two major contributors, without whose work the documentation wouldn't be relevant or even exist in its current form, would clearly prefer the project to be truly open. Please reconsider it.
Find all posts by this user
Quote this message in a reply
02-22-2015, 05:55 PM
Post: #20
RE: WP 34S problem in solving f'(x)=0
Bit, I suggest you look a little bit into the archives before assessing particular contributions. Please don't forget history in this matter starts 2008. Looking forward to your research results.

d:-)
Find all posts by this user
Quote this message in a reply
Post Reply 




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