You can certainly use the standard algebraic formulas y = mx + b, x^2 =
4py, x^2/a^2 + y^2/b^2 = 1, y^2/a^2 - x^2/b^2 = 1 for line, parabola,
ellipse/circle, and hyperbola, solving for y and plotting as I do below
for the parabola. There is an ingenious way for dealing with y = (+ or
minus) blah which you see suggested in the treatment of hyperbola below.
Plots not available from these formulas can be dealt with using the
simple methods of rotating, translating, reflecting,
stretching/shrinking complex data. About y = 1/x, it has mutually
perpendicular asymptotes y = 0 and x = 0 ; no rotation would make it
into a hyperbola whose asymptotes look like an x . --Kip Murray
On 9/16/2013 6:02 PM, William Tanksley, Jr wrote:
Is it possible to do these plots using only algebraic functions -- for
example, using 1/x and then a rotation to plot the hyperbolae? I know
of an algebraic parameterization for the unit circle, but I'm not sure
about the ellipse.
-Wm
On Mon, Sep 16, 2013 at 3:40 PM, km <[email protected]> wrote:
Summary of results. The strategy of hyperbola below (plotting a complex table)
is not well known. Henry Rich found it and reported it.
Bo Jacoby gave the best way to change the sign of the real part of a complex
number.
Simply do [: + - .
NB. Complex Analytic Geometry
NB. How to calculate complex number lists and tables for
NB. plotting lines, circles, ellipses, and hyperbolas. How to
NB. modify these tables to achieve translations, rotations,
NB. and reflections. Begin with preliminaries:
steps =: {.@] + -~/@] * [ %~ [: i. >:@[
NB. n steps a,b produces n+1 equally spaced values from a to b
to =: 512 steps , NB. Usage a to b for 512 steps from a to b
sin =: 1&o.
cos =: 2&o.
sinh =: 5&o.
cosh =: 6&o.
arcsinh =: _5&o.
NB. Now, results
line =: 2 : 'm + (n-m)*]'
NB. A line B [ t is point "t of the way from A to B". Command
NB.
NB. plot 0 line 1j1 [ _1 to 2
NB.
NB. shows the line segment from _1j_1 to 2j2
NB. You are plotting a list of 513 complex numbers.
parabola =: 1 : '] j. (1 % 4 * m) * *:'
NB. p parabola x produces point x j. y on parabola
NB. (*: x) = 4*p*y . Command
NB.
NB. plot 1r4 parabola _2 to 2
NB.
NB. plots parabola y = *: x for x from _2 to 2
NB. You are plotting a list of 513 complex numbers.
ellipse =: 2 : '((m * cos) j. n * sin) 0 to 2p1'
NB. Suggested by Henry Rich
NB. Command
NB.
NB. plot a ellipse b
NB.
NB. plots the ellipse 1 = (*: x % a) + *: y % b .
NB. If a = b you get the circle (*: x) + (*: y) = *: a
hyperbola =: 2 : '[: (,: +) (n * sinh) j. m * cosh'
NB. Suggested by Henry Rich
toh =: [: to/ [: arcsinh %~
NB. b toh c,d is (arcsinh c%b) to (arcsinh d%b)
NB. Command
NB.
NB. plot a hyperbola b [ b toh c,d
NB.
NB. plots y^2/a^2 - x^2/b^2 = 1 for x from c to d.
NB. Remember the pattern b [ b toh c,d
NB. You are plotting rows of a 2 by 513 table to get the two
NB. branches of the hyperbola.
NB. Rotations, translations, and reflections
NB. Multiply a complex number list or table by (^&j. theta)
NB. to rotate all of its points by theta radians. The center
NB. of rotation is the origin 0 = 0j0 .
NB. Add 5j3 to a complex list or table to move all of its points
NB. the distance and direction of 5j3 from 0j0.
NB. Use (+ list) or (+ table) (monadic + is conjugate) to
NB. reflect all the points of the list or table across the
NB. line through 0j0 and 1j0 -- the x-axis. Afterwards
NB. multiply by (^&j. theta) to achieve a reflection across
NB. the line through 0j0 and (^&j. theta).
NB. Multiply a positive number p times a list or table to
NB. achieve an expansion from 0 or compression toward 0
NB. according as p > 1 or p < 1 .
NB. If you want to combine several operations do the
NB. reflection first and the translation last.
NB. Example
NB.
NB. plot (^&j. theta) * p parabola _2 to 3
NB.
NB. plots a parabola rotated by theta radians, with 0j0
NB. the center of rotation. If theta is _1r2p1 (that is
NB. - pi%2 radians) you have converted a (*: x) = 4 * p * y
NB. parabola into a (*: y) = 4 * p * x parabola.
--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