Ψ(x)⁻¹ [wp 34s]
|
05-09-2016, 03:19 PM
Post: #1
|
|||
|
|||
Ψ(x)⁻¹ [wp 34s]
.
Code:
Examples 2 g FILL g LN x - 0.5772156649 STO B - A --> 1.5 (5.0 s) 4 ENTER 3 / 2 g LN 3 x - π 2 / + RCL B - A --> 1.75 (5.0 s) RCL B +/- A --> 9.99999999997e-1 (10.3 s) 1 +/- A --> 7.850033253 81e-1 (10.5 s) 0 A --> 1.46163214497 (5.0 s) 1 A --> 3.20317146836 (4.3 s) 2 A --> 7.88342863117 (1.7 s) 4 A --> 55.0973869103 (1.4 s) 9 A --> 8103.58392243 (0.7 s) 2.45 RCL B - A 1 - --> 6 (4.2 s); Hn⁻¹(2.45) = 6, that is, 1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 = 2.45 = H₆ 1.2 +/- A --> Domain Error x<>y XEQ 04 7.07122399 653e-1 Basically I have used a weighted mean of two assymptotic approximations, which are more accurate than any of them individually: \[\psi (x+\frac{1}{2})\approx \ln (x)\therefore \psi ^{-1}(x)\approx e^{x}+\frac{1}{2}\] \[\psi (x)\approx \ln (x)-\frac{1}{2x}\therefore \psi ^{-1}(x)\approx \frac{1}{2W_{p}\left ( \frac{1}{2e^{x}} \right )}\] \[\psi ^{-1}(x)\approx \frac{1}{3} \left [2\left ( e^{x}+\frac{1}{2} \right )+\frac{1}{2W_{p}\left ( \frac{1}{2e^{x}} \right )} \right ]\] or, \[\psi ^{-1}(x)\approx \frac{1}{3} \left [1+2 e^{x}+\frac{1}{2W_{p}\left ( \frac{1}{2e^{x}} \right )} \right ]\] This requires less evaluations of ψ(x), on the other hand it needs additional evaluations of Lambert's W function. I am not sure wether this takes more time, but it surely will require a lesser number of evaluations of the basic approximation, thus making the resulting code shorter than the equivalent to the one I used for the HP 50g here recently. The accuracy is mostly twelve digits in the valid range ( x ≥ -1 ). It depends also of the accuracy of the library function 'ψ'. |
|||
05-09-2016, 03:28 PM
Post: #2
|
|||
|
|||
RE: Ψ(x)⁻¹ [wp 34s]
Note to moderators:
When trying to edit the title of the post thread, I accidentaly created another one with the same content. I would ask you please to remove this one, as I am not allowed to do it myself. Thanks in advance, Gerson. |
|||
05-09-2016, 05:24 PM
(This post was last modified: 05-09-2016 05:35 PM by Ángel Martin.)
Post: #3
|
|||
|
|||
RE: Ψ(x)⁻¹ [wp 34s]
(05-09-2016 03:19 PM)Gerson W. Barbosa Wrote: Basically I have used a weighted mean of two assymptotic approximations, which are more accurate than any of them individually: Hi Gerson, thanks for this follow-up. What's the accuracy expected from this method? I must be doing something wrong (I admit it, I jumped into coding it without reading the other thread...) but I'm not getting the expected results beyond the second decimal digit. I'm using WL0 from the SandMath, with that it's an easy task to program your last expression: 01 LBL "APSI" 02 E^X 03 ST+ X 04 1 05 X<>Y 06 + 07 LASTX 08 1/X 09 WL0 10 ST+ X 11 1/X 12 + 13 3 14 / 15 END Do you see any flagrantly obvious mistake with the code above? Cheers, 'AM "To live or die by your own sword one must first learn to wield it aptly." |
|||
05-09-2016, 06:39 PM
Post: #4
|
|||
|
|||
RE: Ψ(x)⁻¹ [wp 34s]
(05-09-2016 05:24 PM)Ángel Martin Wrote:(05-09-2016 03:19 PM)Gerson W. Barbosa Wrote: Basically I have used a weighted mean of two assymptotic approximations, which are more accurate than any of them individually: Hi, Ángel! Your code is correct. For x = 2, the expect result is 7.88387350, good to four significant digits (the exact 10-digit result is 7.883428632). For smaller arguments things get worse, but then again the other two approximations get even worse. I don't claim this is a good method, but this is the only one I have so far. Perhaps a specific solver is a better option, the two first approximations being used as the initial guesses, since the true results lie between them (at least for the few arguments I've checked). Cheers, Gerson. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)