On Tue, Oct 18, 2011 at 11:30 AM, David Vaughan
<[email protected]> wrote:
> Can J represent surds exactly instead of reverting to floating point? It 
> would be more convenient if I could do that rather than storing the squared 
> version.

Yes, but by generating a verb which would generate the floating point
value and not as a number.

cubeRootOf5=: %:&5 bind 3

Of course you can manipulate the resulting numbers but those results
are still floating point:

   (cubeRootOf5 ^ 3:) ''
5
   5-(cubeRootOf5 ^ 3:) ''
8.88178e_16

That said, in some cases, J can clean up floating point discrepancies

   5-x:(cubeRootOf5 ^ 3:) ''
0

but that's from direct manipulation of the values and does not care
about delayed evaluation:

   5-x:((3 %:5) ^ 3:) ''
0

Anyways, J implements the data structures to support symbolic
manipulation but it does not have a particularly large library of
prebuilt symbolic manipulation routines.

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to