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