sqr=: 3 : '0j50": (<. @ %: y * 10x^100) % 10x^50'
sqr 1023810239x
31997.03484699793241139948300855562366372711733217036789
On Sun, Sep 24, 2023 at 10:19 AM 'Skip Cave' via Programming <
programm...@jsoftware.com> wrote:
> How to get more accurate square roots?
>
> %:1023810239x
>
> 31997
>
> 1
How to get more accurate square roots?
%:1023810239x
31997
1023810239x ^ 1r2
31997
31997x^2
1023808009
Skip Cave
Cave Consulting LLC
--
For information about J forums see http://www.jsoftware.com/forums.htm
8 12:25 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Square Roots and Extended Arithmetic
Linda,
NB. Generate the integers from 2 to 21, store them in a, and display a:
]a=.2+i.20
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
NB. Take the square root of the integers in a, store t
│ ┌─ 2
│ ├─ |
└─┤ ┌─ _
└─┼─ q:
└─ ]
Linda
-Original Message-
From: Programming On Behalf Of Linda
Alvord
Sent: Saturday, November 3, 2018 10:03 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Square Roots and Extended Arithmetic
8 10:43 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Square Roots and Extended Arithmetic
Also, there's a completely different way to attack the problem of finding
perfect squares using the dyadic form of q: (Prime Exponents). I discovered
this while reading NuVoc about q:
fps1 =
t: Re: [Jprogramming] Square Roots and Extended Arithmetic
Also, there's a completely different way to attack the problem of finding
perfect squares using the dyadic form of q: (Prime Exponents). I discovered
this while reading NuVoc about q:
fps1 =: 13 :'y#~0=+/"1]2|_ q:y'
fps1 2
Also, there's a completely different way to attack the problem of finding
perfect squares using the dyadic form of q: (Prime Exponents). I discovered
this while reading NuVoc about q:
fps1 =: 13 :'y#~0=+/"1]2|_ q:y'
fps1 2+i.100
4 9 16 25 36 49 64 81 100
fps1 8200+i.1000
8281 8464 8649 8836
8281
%:8281
91
fps
] #~ [: (= >.) %:
;:' ] #~ [: (= >.) %:'
┌─┬─┬─┬──┬─┬─┬──┬─┬──┐
│]│#│~│[:│(│=│>.│)│%:│
└─┴─┴─┴──┴─┴─┴──┴─┴──┘
You can spot a hook by the parentheses.
Linda
Sent from my Verizon, Samsung Galaxy smartphone
Original message
From: Skip Cave
Date: 11/3/18 12:25 AM (GMT-05:00)
To: "programm...@jsoftware.com"
Subject: Re: [Jprogramming
kip Cave
> Date: 11/2/18 12:06 PM (GMT-05:00)
> To: "programm...@jsoftware.com"
> Subject: Re: [Jprogramming] Square Roots and Extended Arithmetic
>
> Thanks for all the comments and help in understanding why trying to get an
> extended integer result from a square root
What does (=>.) do in this example?
Linda
Sent from my Verizon, Samsung Galaxy smartphone
Original message
From: Skip Cave
Date: 11/2/18 12:06 PM (GMT-05:00)
To: "programm...@jsoftware.com"
Subject: Re: [Jprogramming] Square Roots and Extended Arithmetic
T
Thanks for all the comments and help in understanding why trying to get an
extended integer result from a square root is a bad idea.
I think the functional symmetry of square *: and square root %: led me to
subconsciously forget that the results of squared integers (all integers)
are not symmetric
Heron was ahead of his time- this is actually now called Newton
Rhapson iteration . The basic process can be used to solve some very
large order (in variables) simultaneous non-linear equations as in
power system load flow problems that can have hundreds or more
variables (first applie
See https://code.jsoftware.com/wiki/Essays/Extended_Precision_Functions, in
particular the Square Root section.
On Thu, Nov 1, 2018 at 12:13 PM Skip Cave wrote:
> a=:1234567890101020405060708090x
>
>
> a=2^~a^1r2
>
> 1
>
> a=2^~%:a
>
> 1
>
> a-:2^~a^1r2
>
> 1
>
> a-:2^~%:a
>
> 1
>
>
> NB. All l
If the number is not a perfect square, square root always converts the
result to float. b is not an integer. It is float. And there are digits
after the decimal.
0j6":b
35136418287882.219000
But when b is squared only the first 16 (approx) digits are kept.
0j3":b^2
1234567890101024100
Hi,
A good read on the subject of square roots :
A Perfect Square Root Routine
E.E. McDonnell
http://www.jsoftware.com/papers/eem/sqrt.htm
On Thu, Nov 1, 2018 at 3:32 PM Raul Miller wrote:
> Square roots cannot (in the typical case) be represented using
> extended precision numbers (which are
Square roots cannot (in the typical case) be represented using
extended precision numbers (which are integers).
a=:1234567890101020405060708090x
a^1r2
3.51364e13
datatype a^1r2
floating
This floating representation represents numbers using a representation of
sign * 1+fraction * 2^exp
a=:1234567890101020405060708090x
a=2^~a^1r2
1
a=2^~%:a
1
a-:2^~a^1r2
1
a-:2^~%:a
1
NB. All looking good. However:
x:2^~a^1r2
1234567890101024064259751936
a
1234567890101020405060708090
NB. Clearly not equal.
x:2^~%:a
1234567890101020490846961664
a
1234567890101020405060708090
17 matches
Mail list logo