HP Forums
Phi Function - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Phi Function (/thread-4402.html)



Phi Function - douganc - 07-21-2015 08:39 PM

Hello,
Can anyone tell me where I am going wrong in this Program?

It's purpose is to display the value of Phi to 50 Decimal Places
When "phi()" is typed on the home screen.

Here is the program:

#cas
phi():=BEGIN
//
LOCAL x;
x:=(1.61803398874989484820458683436563811772030917980576);
RETURN(x);
//
END;
#end

Output: See attached Screenshot.

Thanks !
Colm


RE: Phi Function - salvomic - 07-21-2015 09:06 PM

(07-21-2015 08:39 PM)douganc Wrote:  Hello,
Can anyone tell me where I am going wrong in this Program?

It's purpose is to display the value of Phi to 50 Decimal Places
When "phi()" is typed on the home screen.

Here is the program:

#cas
phi():=BEGIN
//
...

hi,
first detach BEGIN after the :=
Code:

#cas
phi():=
BEGIN
//
LOCAL x;
x:=(1.61803398874989484820458683436563811772030917980576);
RETURN(x);
//
END;
#end

after this you won't have that error, but
1.61803398875.
then the rest...

For "all dec" output see here.

Salvo


RE: Phi Function - douganc - 07-21-2015 11:28 PM

Thank You for Help.
Much Appreciated
Colm. :-)


RE: Phi Function - Gerald H - 07-22-2015 05:24 AM

The term "phi function" is already occupied

https://en.wikipedia.org/wiki/Euler%27s_totient_function

You could amend to "phi constant"?


RE: Phi Function - douganc - 07-22-2015 08:58 AM

Yes of course, it's a constant not a function.
Colm :-)