I didn't know about a table of complex numbers either, till I tried it. It seems to recognize each row as a separate dataset, thus avoiding the line between them. Thorough man, that Chris.

+ for - would work for this hyperbola, but for the other orientation you would need to change sign on the real parts - it seemed safer to change both.

Your toh is elegant.

Henry Rich

On 9/15/2013 7:39 PM, km wrote:
Henry, this is outstanding.  I didn't know about plotting a table of complex 
numbers.


Two comments.  First, as I specified

     a hyperbola b

for

     y^2/a^2 - x^2/b^2 = 1  ,

you need comma tilde (,~) not comma.

Second, you could have used  +  (conjugate) instead of  -  (negative).


Cribbing from you, I have

     hyperb =: 2 : '[: (,: +) [: j./ (n,m) * (sinh ,: cosh)'

     toh =:  [: to/ [: arcsinh %~

     NB. b toh c,d is (arcsinh c%b) to (arcsinh d%b)

The command

     plot a hyperb b [ b toh c,d

plots the hyperbola y^2/a^2 - x^2/b^2 = 1 for x going from c to d .


--Kip Murray

Sent from my iPad


On Sep 15, 2013, at 3:51 PM, Henry Rich <[email protected]> wrote:

hyperbola =: [: (,: -) [: j./ ((sinh ,: cosh) _0.4p1 to 0.4p1) * ,

Henry Rich

On 9/15/2013 12:27 AM, km wrote:
The next challenge is to write a conjunction hyperbola so that

a hyperbola b is a verb that creates complex numbers for both

branches of the hyperbola  y^2/a^2 - x^2/b^2 = 1  (opens up and

down not left and right) .  The command

     plot a hyperbola b [ c to d

  plots the hyperbola.  You have to work to move a stray

straight line to the edge of the plot.  Give it a try.


Verb "to" is

     to =: [ + -~ * 1r512 * [: i. 513"_

NB.  c to d  produces 513 equally spaced values from (real) c to d


--Kip Murray

Sent from my iPad


On Sep 14, 2013, at 9:57 PM, Henry Rich <[email protected]> wrote:

Yes, that's better.

Henry Rich

On 9/14/2013 6:38 PM, km wrote:
Very cool, Henry!  You can also use

     ellipse2 =: [: j./ ((cos ,: sin) 0 to 2p1) * ,

An advantage of complex number plots is they are easy to rotate and translate.  
Try

     plot (^&j. _1r4p1) * 2 ellipse 1  NB. rotates -45 degrees

--Kip Murray

Sent from my iPad


On Sep 14, 2013, at 12:04 PM, Henry Rich <[email protected]> wrote:

Verb rather than conjunction:

   ellipse =: [: +.^:_1 ((cos ,. sin) 0 to 2p1) *"1 ,

If you just want to plot, you can leave the real/imaginary separate:

   ellipse2 =: ((cos ; sin) 0 to 2p1) *&.> ,

Henry Rich

On 9/13/2013 6:22 PM, km wrote:
You can plot a complex list.

Try

L =: _1j1 0 1j1

and

plot L

plot 0j1 + L

plot 0j1 * L

(It is easy to translate and rotate a plot defined by a complex list.)


Challenge: devise a conjunction ellipse that produces a complex list for 
plotting the ellipse

1 = (*: x % a) + (*: y % b)   NB.  In algebra x^2/a^2 + y^2/b^2 = 1

The command

plot a ellipse b

should produce a plot of the above ellipse.


Easier: devise an adverb parabola that produces complex numbers for plotting 
the parabola

(*: x) = 4 * p * y

You want the command

plot p parabola c to d

to plot the above parabola for x in the interval from c to d.


Here is verb "to"

  to =: [ + -~ * 1r512 * [: i. 513"_

  NB. c to d produces 513 equally spaced values from (real) c to d


Above tested on my iPad

     IFIPAD
  1
     VERSION
  1.3 5


--Kip Murray

Sent from my iPad

----------------------------------------------------------------------
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to