I started writing an explanation
which ended up being an explanation to myself
of what went wrong.
I still don’t get expected results but I guess
I’ll have to double-check what I’m doing first.
Sorry for the noise,
Hauke
Am 11.09.21 um 20:13 schrieb Henry Rich:
I would be willing to help, but you have shown a bunch of code
without explaining what it does and what you expect. If you have
something that is producing the wrong result, and you tell us what
the proper result is, I will have a look.
Henry Rich
On 9/11/2021 6:56 AM, Hauke Rehr wrote:
maybe I found it but then again, these results look too good to me
ps2 =: 0 -/@:(0,|.)@:((nxt2 ,^:(0~:[) ])^:_)~ ] (ps2 - ^.@>:)"0 %
2^>:i.5 0 0 0 0 0
Am 11.09.21 um 12:37 schrieb Hauke Rehr:
Hello,
I just wanted to look at some power series, here is code for
^.@>: (quite literal translation from the maths)
nxt1 =: [ (^ % (* _1 ^ >:)@]) #@] ps1 =: 0 +/@:((nxt1 ,^:(0~:[)
])^:_)~ ]
now executing (ps1 - ^.@>:)"0 % 2^>:i.5 gives _1.11022e_16
_5.55112e_17 _1.38778e_17 6.93889e_18 0 or _1.11022e_16 0
2.77556e_17 6.93889e_18 0 depending on J version not bad
I thought I made an improvement when I rewrote it thus: nxt2 =: [
(^ % ]) #@] ps2 =: 0 -/@:((nxt2 ,^:(0~:[) ])^:_)~ ]
but now I get (ps2 - ^.@>:)"0 % 2^>:i.5 _0.81093 _0.446287
2.77556e_17 _0.121249 0 ouch!
… and now I’d have expected +/@:(* 1 _1 $~ #)@: instead of -/@:
not to help with that bad result but it did _0.81093 _0.446287
_1.38778e_17 _0.121249 0
Okay, this will be representation/fp issues; still the difference
in accuracy puzzles me when comparing ps1 and ps2 …
Does anyone have an explanation?
--
----------------------
mail written using NEO
neo-layout.org
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm