Is there a standard verb for displaying arrays my way?---Bo. Den 15:57 lørdag den 10. marts 2018 skrev 'Bo Jacoby' via Programming <programm...@jsoftware.com>:
Yes Raul. I do not at all claim that (p5) is better that (p.). Perhaps J should always display the same number of decimals for the real part and the imaginary part of a complex number, such that the result would read _1.00000j0.00000 _1.00000j0.00000 (%:i.2) is (0 1) , and (%:i.3) is (0 1 1.41421) , but perhaps should be 0.00000 1.00000 1.41421 with the same number of decimals in every component of a vector. See what I mean? Thanks. Bo. Den 15:26 lørdag den 10. marts 2018 skrev Raul Miller <rauldmil...@gmail.com>: Looks like you could use another stage to clean up results? 1 {:: p. 1 2 1 _1 _1 p5 1 2 1 _1j1.54593e_9 _1j3.48012e_9 P.S. looking at the source, J is using Laguerre's method (so I'd use p.. if I were re-implementing it in J). Thanks, -- Raul On Sat, Mar 10, 2018 at 2:13 AM, 'Bo Jacoby' via Programming <programm...@jsoftware.com> wrote: > (p.) is OK, but I do not know how it works. > Thanks to Raul Miller and to R.E.Boss, my home-cooked equation solver looks > like this. > p1=.+`*/&}:&|:@(,@,."_ 0) NB. evaluate polynomial x at point y > p2=.*/&|:&(+0&=)&(-/~) NB. multiply differences between approximate roots > p3=.]-p1%p2@:] NB. iteration step > p4=.](p3^:_)0.8j0.6^i.@:<:&$ NB. solve a normalized equation > p5=.p4&(%{:)&({.~>:&{:&(-.&(0&=)#i.&#)) NB. normalize and solve > NB. This J code can probably be further compacted. > NB. test runs: > load'plot' > pl=:[:'dot;pensize 5'&plot 0j1*] NB. vertical real axis > a=. 0 1 2 3 4 5 0 NB. test coefficients > pl p5 a NB. show complex roots using (p5) > pl >}.p.a NB. show complex roots using (p.) > p5 1 NB. show no roots using (p5) > > p.1 NB. show no roots using (p.) > |domain error > | p.1 > > Thanks! Bo. > > Den 20:53 onsdag den 7. marts 2018 skrev R.E. Boss <r.e.b...@outlook.com>: > > > a |:@:(,@,."_ 0) b > > > R.E. Boss > > >> -----Original Message----- >> From: Programming <programming-boun...@forums.jsoftware.com> On >> Behalf Of 'Bo Jacoby' via Programming >> Sent: maandag 5 maart 2018 14:35 >> To: Programming Forum <programm...@jsoftware.com> >> Subject: [Jprogramming] (,a,.2),.,a,.3 >> >> Let (a =. _1 _1 0 0 0 1) and (b =. 2 3). >> For my own education I am trying to make a homecooked version of (p.). >> >> (+`*/}:(,a,.2),.,a,.3) produces the same result as (a p. b) I need a nice >> verb (f) >> such that (a f b) produces ((,a,.2),.,a,.3) Thanks! Bo. >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm