HP Forums

Full Version: [BUG] weird Zeta function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Zeta(3) returns... Zeta(3). I tried Eval, no luck.
So I decided to define F1(X)=Zeta(X) but it doesn't help since F1(3) also returns Zeta(3).
I plotted F1 and then I see the curve on screen. Using the touch screen, menu, I tried "go to" and "3" "Enter". Now I got an error message: function is not defined for x=3.
I tried a manual approximation and entered sum(n^ -3,n,1,1000) which returns 1.20 which is close enough and consistent with what I see on the curve.
So why zeta(3) fails?

Also the zeta help says that Re(x) shall be >1 while zeta returns values for negative x?
(01-12-2014 10:38 PM)Tugdual Wrote: [ -> ]Zeta(3) returns... Zeta(3).

In CAS mode, forcing the argument to be real does provide an approximation of Apéry's constant.

Zeta(3.) = 1.20205690316

But this doesn't work in Home mode.

Mark Hardman
(01-12-2014 10:55 PM)Mark Hardman Wrote: [ -> ]In CAS mode, forcing the argument to be real does provide an approximation of Apéry's constant.

Zeta(3.) = 1.20205690316

Hi Mark, thanks for the hint!

I find it even more bizarre that the only way to get an approximation is in CAS which seems to be dedicated to symbolic calculations.

Also in the meantime I tried Zeta(1+i) it says Eta(1+i)/(1-2^-i)
I think this is correct but suprisingly we see Dirichelt's Eta function popping up while it is neither documented nor listed in the catalog.

Note: I have edited the first post to call it a BUG
Yes,

This was already noted a while back (if you peruse the archives).

Dirichlet's eta function also won't get evaluated numerically.
(01-13-2014 06:55 AM)Tugdual Wrote: [ -> ]I find it even more bizarre that the only way to get an approximation is in CAS which seems to be dedicated to symbolic calculations.

Zeta(approx(3)) returns a real in Home. So does turning off "Change apparent integers into exact integers" in the CAS Settings (page 1, end of 3rd line), but since that's not programmable, I suggest using the Zeta(approx(3)) method.

These two methods are related. If you type Zeta(3.) in Home, CAS turns the real 3 into an integer automatically (not a bug; it's due to that CAS setting), hence the symbolic result. But approx is a CAS function, so it turns approx(3) into a real 3 in the CAS, and feeds that to the Zeta function. OR you can turn off the "convert whole numbers into integers" mode, and avoid using approx.
(01-13-2014 07:51 PM)Joe Horn Wrote: [ -> ]
(01-13-2014 06:55 AM)Tugdual Wrote: [ -> ]I find it even more bizarre that the only way to get an approximation is in CAS which seems to be dedicated to symbolic calculations.

Zeta(approx(3)) returns a real in Home. So does turning off "Change apparent integers into exact integers" in the CAS Settings (page 1, end of 3rd line), but since that's not programmable, I suggest using the Zeta(approx(3)) method.

These two methods are related. If you type Zeta(3.) in Home, CAS turns the real 3 into an integer automatically (not a bug; it's due to that CAS setting), hence the symbolic result. But approx is a CAS function, so it turns approx(3) into a real 3 in the CAS, and feeds that to the Zeta function. OR you can turn off the "convert whole numbers into integers" mode, and avoid using approx.
Hi Joe, that's interesting, I didn't even notice this option in CAS parameters (a simple check box with no further explanation...). I understand what you say but I'm happy I don't have to enter sin(approx(3)) everytime I need to do a sinus calculation ;-)
(01-13-2014 09:48 PM)Tugdual Wrote: [ -> ]
(01-13-2014 07:51 PM)Joe Horn Wrote: [ -> ]... "Change apparent integers into exact integers" in the CAS Settings (page 1, end of 3rd line) ...
... I didn't even notice this option in CAS parameters (a simple check box with no further explanation...)
The explanation is at the bottom of the screen, immediately above the soft keys. Those prompts are often the only explanation offered by input forms.
I had noticed this phenomenon with the Prime. My own opinion FWIW is that Zeta(r) is evaluated in terms of Zeta(r-2), recursively until a value between 0 and 2 is reached. Faced with Zeta() of an odd integer, it will backtrack successfully until it reaches Zeta(1) and boggles.
Zeta(n) is left as is if n>0 is odd, and computed using bernoulli numbers if n is even. You can't do any better if you want an exact answer. Of course, you can enter Zeta(d) where d is a floating point number to get an approximation.
Code:

...
    if ( (x.type==_INT_)){
      int n=x.val;
      if (!n)
    return minus_one_half;
      if (n==1)
    return plus_inf;
      if (n<0){
    if (n%2)
      return -rdiv(bernoulli(1-n),(1-n),contextptr) ;
    else
      return zero;
      }
      if (n%2)
    return symbolic(at_Zeta,x);
      else
    return pow(cst_pi,n)*ratnormal(abs(bernoulli(x),contextptr)*rdiv(pow(plus_two,n-1),factorial(n),contextptr));
    }
...
Yet if I ask for Zeta(3) on my WP-34S, I get the perfectly sensible answer of 1.20205690316, the same answer that Zeta(approx(3)) gives on the Prime.
So on top of hidden Eta (see my previous posts) I see that we also have Benouilli numbers. Why don't we have access to those functions?

Also I agree with Curlytop, why don't you simply cast to real and return an estimate instead of "symbolic(at_Zeta,x);"?
Reference URL's