Ramanujan's constant: Difference between revisions

Content added Content deleted
Line 73: Line 73:


=={{header|J}}==
=={{header|J}}==
Project: compute, expressed in mathematica notation, <pre>Exp[Pi*Sqrt[163]]</pre> .
Project: compute, expressed in mathematica then j notation, <pre>Exp[Pi*Sqrt[163]] ^ o. %: 163</pre> .


J natively supports Boolean 0 1, integer 9, extended integer 9x, rational 1r2, floating point as c double 0.5, and complex numbers 2ad90 (radius 2, 90 angle in degrees). J does not natively support arbitrary precision decimal, or ternary. J can format a rational number as an arbitrary precision base 10 literal.
J natively supports Boolean 0 1, integer 00 01 2 3 9, extended integer* 9x, rational 1r2, floating point as c double, and complex numbers 2ad90 (radius 2, 90 angle in degrees). J does not natively support arbitrary precision decimal, or ternary. J can format a rationals as arbitrary precision base 10 literals.


Rational arithmetic with series expansion therefor serves to compute Ramanujan's constant. We test for convergence in the base 10 literal expression over the required length. Exponential expansion is unwieldly. We divide by 8x, then raise the series sum to the 8th power. We also convert the rational exponent to a base 10 rational number of sufficient digits to reduce size.
Rational arithmetic with series expansion therefor serves to compute Ramanujan's constant. We test for convergence in the base 10 literal expression over the required length. Exponential expansion is unwieldly. We divide by 8x, then raise the series sum to the 8th power. We also convert the rational exponent to a base 10 rational number of sufficient digits to reduce size.

*Taking a rational power of an extended integer produces a floating-point result whenever the denominator of the power is not 1.


<pre>
<pre>