Function-defines-curvature curves

These images are fun pretty images made by defining a function for the curvature of the shape and then drawing forward and/or backwards.

The curves that jump off a smooth path are I guess a result of computational inaccuracies, but I haven't confirmed that. They make pretty shapes either way.

These are drawn with GNU Octave. The code to produce these is very simple, see the end of the page. TODO: add the codes here for each.

alt text alt text alt text alt text alt text alt text alt text alt text alt text alt text alt text alt text

One example with numerical integration: (change the function and the drawing interval and step to make your own curves). These run in GUN Octave or MATLAB.

t = -10:0.01:10; %väli
kaarevuus =t.^2 -2.19;
x = cumtrapz(cos(cumtrapz(kaarevuus)));
y = cumtrapz(sin(cumtrapz(kaarevuus)));
plot(x,y)

Or alternatively with symbolic integration:

pkg load symbolic %octave tarvii tän
v = -20:0.1:20; %väli

%käytetään symbolista integrointia
syms t;
kaarevuusfunktio = symfun(t-2,t); %sym
integraalifunktio = int(kaarevuusfunktio,t); %sym  

kosinifunktio = cos(integraalifunktio);
xfunktio = int(kosinifunktio);
xx =matlabFunction(xfunktio); %this breaks on octave with complicated integrations, matlab can handle more

sinifunktio = sin(integraalifunktio);
yfunktio = int(sinifunktio);
yy =matlabFunction(yfunktio);

x=xx(v);
y=yy(v);
plot(x,y)
CC BY-SA 4.0 Ilkka Laine. Last modified: January 07, 2025. Please contact me by email for any suggestions, comments or improvements.