HP Forums
wp34s doesn't give correct zeta function value - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: wp34s doesn't give correct zeta function value (/thread-18098.html)



wp34s doesn't give correct zeta function value - BINUBALL - 03-06-2022 07:18 AM

I'm using wp34s emulator on iPhone. Zeta function doesn't work as I expected.

0 ZETA > -0.5
1 ZETA > -5.17682194565
2 ZETA > -2.87602208383E-32
3 ZETA > 204.372738634

Can you guess why these number appeared? Double precision mode doesn't matter.


RE: wp34s doesn't give correct zeta function value - Paul Dale - 03-06-2022 08:40 AM

These don't match the results I see....


Pauli


RE: wp34s doesn't give correct zeta function value - pascal_meheut - 03-07-2022 08:05 AM

It seems to be a bug in the iOS version and this is strange as it uses the same C code as the other emulators.
Even stranger: it occurs on my iPhone but not my Ipad nor on the emulator.

I do not know if I can find the time to look at it (quite busy at the moment) but I'll try.


RE: wp34s doesn't give correct zeta function value - ijabbott - 03-07-2022 09:57 PM

FWIW, the Android port (awp34s by Pablo Martin) works fine (or at least it agrees with the HP 20b/30b version). I'm not sure exactly which revision it is based on. The VERS command shows "34S 3.3 0".


RE: wp34s doesn't give correct zeta function value - BINUBALL - 03-08-2022 08:52 AM

(03-07-2022 09:57 PM)ijabbott Wrote:  FWIW, the Android port (awp34s by Pablo Martin) works fine (or at least it agrees with the HP 20b/30b version). I'm not sure exactly which revision it is based on. The VERS command shows "34S 3.3 0".

For me it crashes the app.

(06-17-2021 12:15 PM)BINUBALL Wrote:  If you still develop this app, I can give bug report for you.

- Trying to calculate Zeta function results crash.
- In double mode, 5 sqrt f x<>y results crash.
- Integrate x^x from 0 to 1 results crash.
ex)
Code:
LBL 'O'
y^x
RTN



RE: wp34s doesn't give correct zeta function value - Paul Dale - 03-09-2022 02:56 AM

I verified that this works with an iOS version. I've no real hardware available currently.


Pauli


RE: wp34s doesn't give correct zeta function value - Maximilian Hohmann - 03-09-2022 12:25 PM

Hello!

I have tried the following versions:
iPad2, iOS 9.3.5, WP34s 1.18
iPhone8, iOS 15.3.1, WP34s 1.18
Samsung Galaxy A71, Android 11, WP34s 0.0.6 (?)

All three do what they are supposed to do.

Regards
Max


RE: wp34s doesn't give correct zeta function value - Nigel (UK) - 03-09-2022 01:18 PM

The WP34S implementation on the DM42 gives the wrong answers - the same wrong answers that have been reported on the iPhone version.

I've looked at the XROM code for the zeta function. It includes these lines:
Code:

zeta_int::        LocR 08
            STO .01
            STO .07
            Num 1/2
            x>? 0
                JMP zeta_calc
Changing this code to
Code:

zeta_int::        LocR 08
            STO .01
            STO .07
            x>0?
                JMP zeta_calc
gives the correct answers.

There are two things going on. First, I believe that the comparison "x>? 0" compares the value of x with the contents of register zero, rather than with the number zero. Second, as the code stands the comparison is with the fixed value of 1/2 that the previous command puts on the stack.

This page here shows the most recent change to zeta.wp34s. It shows that Num 1/2 has been removed from the WP31S branch but not from other branches. All three branches contain what I believe to be the incorrect comparison operation. As a result of this, evaluating \(\zeta(x)\) for negative values of \(x\) gives incorrect answers. For example, on my iPad, my physical WP34S, and on a Windows emulator I get \(\zeta(-7)=4.547\dots\times10^{-3}\), whereas Wolfram Alpha gives \(\frac1{240}=4.166\dots\times10^{-3}\). The code with the corrected comparison operator gives the correct answer.

Nigel (UK)


RE: wp34s doesn't give correct zeta function value - Paul Dale - 03-10-2022 12:40 AM

Nice work Nigel. I don't know what I was smoking when I made those changes...

Pauli


RE: wp34s doesn't give correct zeta function value - Paul Dale - 03-10-2022 02:20 AM

I've applied your suggested change to the code base.

Pauli


RE: wp34s doesn't give correct zeta function value - BINUBALL - 03-10-2022 08:40 AM

I put 0 into register 0 and zeta function worked correctly.
Previously I had 10 in register 0. Probably it can give correct value after reset.


RE: wp34s doesn't give correct zeta function value - Paul Dale - 03-11-2022 01:21 AM

It will give incorrect answers for some of the domain. Negative values e.g. would skip the reflection formula I think.