Here are some odd things I found so far.
<[email protected]^30
3141592653589793238462643383279
#<[email protected]^30
1
#":<[email protected]^30
31
f=: 13 :'":x:<.o.10x^y'
f 30
3141592653589793216413703340032
#f 30
31
(<[email protected]^30),<[email protected]^30
3141592653589793238462643383279 3141592653589793238462643383279
(f 30),f 30
31415926535897932164137033400323141592653589793216413703340032
Why don't the original statement and my function f agree? Which is
correct?
If mine is correct, g provides the digits and h and I are the first and
last halves.
g=: 13 :'}:":x:<.o.10x^y'
g 30
314159265358979321641370334003
h=: 13 :'(-:y){.g y'
h 30
314159265358979
i=: 13 :'(-:y)}.g y'
i 30
321641370334003
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Sunday, March 25, 2012 11:42 AM
To: Programming forum
Subject: Re: [Jprogramming] Extracting digits of Pi
On Sun, Mar 25, 2012 at 6:19 AM, m l <[email protected]> wrote:
>
> The verb <[email protected]^n generates the n digits of Pi.
>
> Now, asign this to a variable, for example, a=.<[email protected]^200 (n=200 in
> this case)
>
> How to extract the n/2 first digts and asign to another variable ?
One issue here is that you generated 201 digits. But let's say we round up
for the first half:
b =: <. a % 10x^100
> How to extract the n/2 last digits and asign to a variable ?
c=: (10x^100) | a
Is this what you wanted, or did you want something different?
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm