On Tue, December 11, 2012 1:49 pm, km wrote:
> What is the coolest way of programming the quadratic formula in J?  We are
> finding the roots of polynomial c + x*(b + x*a) without using p. .

I can't claim the coolest implementation, but you should certainly be
aware of my work on a J edition of Iverson's Algebra: An Algorithmic
Treatment. It also has working code for solving cubics and quartics
apart from p. .

booki.treehouse.su/algebra-an-algorithmic-treatment/_v/1.0/edit/

   qe=.3 : 0
('c';'b';'a')=.y
((-b)+(1 _1*%:(*:b)-4*a*c))%2*a
)

>  I offer
>
>     roots
>  3 : 0
>  'a b c' =. y
>  q =. %: (b^2) - 4*a*c
>  (2*a) %~ (-b) + q,-q
>  )
>     roots 1 3 2
>  _1 _2
>     roots 1 0 1
>  0j1 0j_1
>     roots 1 _2 1
>  1 1
>
> partly as problem definition.  I am looking for cool roots verbs!
>
> Kip Murray

--
Edward Mokurai (默雷/निशब्दगर्ज/نشبدگرج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to