----------------

Simple trig

A pair of sine and cosine equations generated these images

home Balloting Simple trig Logistic map The Attractor of Henon Number doubling Barnsley's Fern The Sierpinski Triangle |

Simple trigFor C = 1 To iterations xangle = xangle + xinc yangle = yangle + yinc RN1 = RN1 + xinc: If RN1 > 1 Then RN1 = 0 RN2 = RN2 + yinc: If RN2 > 1 Then RN2 = 0 X = RN1 * (Cos(xangle) * ra) + 400 Y = RN2 * (Sin(yangle) * ra) + 400 viewport.PSet (X, Y), RGB(redd, greenn, bluee) Next C I played a hunch and came up with an algorithm for a pair of iterated trig equations, with offsetting scalar multipliers for each equation. Elaborate patterns appeared which went way beyond what I could have imagined. This program plots the sine of an incremently increasing angle and the cosine of an incremently increasing angle on the same graph. The user has the option of making those increments the same or different. The user can also specify whether the scalar mulitplier is the same or different for the two equations. The most interesting patterns are generated when the increments are the same or extremely close to the same. Offsetting the scalar multipliers affects the symmetry in interesting ways. 40,000 to 1,000,000 iterations are typically optimum. The complete VisualBASIC program code is displayed further down. (02/04/17 update: I've just begun generating 3D images of these trig functions, which automatically have even more complex shapes. Great stuff. Some of the images have been included at the bottom of this page.) First up, are some spheres with various parameters. Further down, are displayed some very surprising images -- squares, triangles, spirals, and a host of shapes that defy classification. Shrinking to 1/2 size: A couple half size images using different parameters: Shrinking to 1/2 size: Here are some 3D images. (My program code for 3D is not yet listed here.)The VisualBASIC program code:(2D only so far) Private Sub trigrunbtn_Click() iter = Val(iterbox.Text) xinc = Val(xincbox.Text) * (3.14159265358979 / 180) yinc = Val(yincbox.Text) * (3.14159265358979 / 180) RN1 = Val(rn1box.Text) RN2 = Val(rn2box.Text) For C = 1 To iter xangle = xangle + xinc yangle = yangle + yinc RN1 = RN1 + xinc: If RN1 > 1 Then RN1 = 0 RN2 = RN2 + yinc: If RN2 > 1 Then RN2 = 0 X = RN1 * (Cos(xangle) * 380) + 400 'user can also choose Y = RN2 * (Sin(yangle) * 380) + 400 'sine sine instead of cosine sine viewport.PSet (X, Y), RGB(redd, greenn, bluee) Next C End Sub ================================================================ home Balloting Simple trig Logistic map The Attractor of Henon Number doubling Barnsley's Fern The Sierpinski Triangle