Freethought & Rationalism ArchiveThe archives are read only. |
07-09-2003, 11:58 PM | #1 |
Senior Member
Join Date: Feb 2003
Location: San Diego, California
Posts: 719
|
Fun with parametric equations...Woo!
All this recent talk of programming reminded me of a little applet I wrote just for the hell of it about five months back. Ever since then it's simply sat around gathering electronic dust, which strikes me as a shame because I'm a small bit proud of it and would like at least a few people to actually see it. At any rate, it uses math (specifically parametric equations) to make pretty pictures and I thought there might be some people (i.e. nerds who don't cringe when they hear the word "parametric") here who would enjoy that sort of thing.
Parametric Insanity (small: 850x400) or Parametric Insanity (large: 1000x550) On the top of the right hand side you can specify equations for x and y as a function of the parameter t (theta, time ... whatever you want to call it, really). Just below these equation fields you can specify the range over which t runs. Pressing the "graph" button instantaneously plots the entire curve [x(t), y(t)] with t running from its minimum value to its maximum value. Pressing ENTER or the "animate" button animates the plot, drawing the curve over a finite amount of time as specified by the "Anim Time" field. I personally prefer the animate option to instantaneous graphing, which is why ENTER usually results in animation. The "data points" field specifies how many discrete points will be used to form the curve, so if the curve gets long, you might need to up this number from its default value. The rest of the fields basically have to do with the scaling of the plot window and usually can be ignored in favor of the auto-scaling feature. Just below the animate and graph buttons are two drop-down lists. The left one, labelled "Plot Color," determines the color scheme that will be used. The use of color can often be very key to achieving a "pretty" picture, which is why so many options are available. My favorites happen to be the top four. The right list, labelled "Some Equations," lists some of the more interesting curves I have invented/stumbled across and pre-programmed into the applet. Simply select one and its equations are automatically entered into the equation fields. You can feel free to simply use the pre-programmed equations, to modify these equations, or to simply come up with your own. The syntax is pretty standard. Order of operations is as expected, with exponentials (^) receiving the highest precidence, followed by multiplication (*) and division (/), followed by addition (+) and subtraction (-). Parentheses can be used where needed. t is treated as the independent variable. e and pi are treated as numbers--the program knows what values to assign them. The program also recognizes the functions: sin() -- sine cos() -- cosine tan() -- tangent csc() -- cosecant (1/sin()) sec() -- secant (1/cos()) cot() -- cotangent (1/tan()) asin() -- arcsine acos() -- arccosine atan() -- arctangent sqrt() -- square root ln() -- natural logarithm (log base e) log() -- logarithm (log base ten) exp() -- exponential (e^()) abs() -- absolute value For sample equations just select any of the pre-programmed equations from the equation list. If your equation has a syntax error when you try to graph it, the field containing the error will turn red. If anyone here comes up with something cool, feel free to post it and I'll add it to the list. You can be immortalized in a program no one will ever see! Yay! |
07-10-2003, 12:05 AM | #2 |
Contributor
Join Date: Jun 2000
Location: Los Angeles area
Posts: 40,549
|
When I click on your first link, I get a message telling me that I am Forbidden.
|
07-10-2003, 12:40 AM | #3 |
Senior Member
Join Date: Feb 2003
Location: San Diego, California
Posts: 719
|
Oops, forgot the chmod 755 for that one. Thanks, it should be fixed momentarily.
|
07-10-2003, 07:21 AM | #4 |
Contributor
Join Date: Jan 2001
Location: Folding@Home in upstate NY
Posts: 14,394
|
I took Flower #4 and just replaced the second 'sin' in y(t) with 'cos' (i.e. y(t) = sin(t)*(.2+cos(8.1*t)) )
I've just been taking some of the preset ones and playing with the constants or the powers. There was one that ended in powers of 2, that I found got interesting if you changed one of them to a 3, or one to 3 and another to 5. I just started playing with 'The Eye of Sauron'. I found out if you set the multipliers in the end terms the same, you get circles. And then if you start adding powers to those same end terms, you get some interesting stuff. |
07-10-2003, 07:42 AM | #5 |
Contributor
Join Date: Jan 2001
Location: Folding@Home in upstate NY
Posts: 14,394
|
Woo!
Here's some more: x(t) = 2*cos(t)*sin(120*t) y(t) = 2*sin(t) * sin(120*t) x(t) = 2*cos(t)*sin(120*t) y(t) = 2*sin(t) + sin(120*t) |
07-10-2003, 08:25 PM | #6 | |
Senior Member
Join Date: Feb 2003
Location: San Diego, California
Posts: 719
|
Quote:
Oh, and just to provide a tiny bit more information on the color schemes: "Random 1" randomly chooses five colors and then morphs from each color to the next as the plot is drawn. This one will provide a smoothly blended spread of colors. "Random 2" randomly chooses five colors and morphs each into a different set of five randomly chosen colors. Basically, this one provides five segments of smoothly blended colors, but each segment itself will stand out from the others as colors will discontinuously change at the boundaries between adjacent segments. You can get some really nice looking results with these, but you can also get some pretty ugly ones, too. |
|
07-12-2003, 01:37 AM | #7 |
Senior Member
Join Date: Feb 2003
Location: San Diego, California
Posts: 719
|
As an aside, comments and/or suggestions would be welcomed, however I'm content to let this thread die its natural death should no one actually care (as it seems is the case).
|
07-12-2003, 04:53 AM | #8 |
Veteran Member
Join Date: Aug 2002
Location: Cleveland, OH, USA
Folding@Home Godless Team
Posts: 6,211
|
When I run it the equations x(t) and y(t) disappear but if I switch windows, they reappear. Weird.
Nice program. |
Thread Tools | Search this Thread |
|