A Cute Lil Somethin’

2008 July 31
by S1TN

Over at this math blog I found this, and I found it totally adorable. In an Aww, you wyke yer wittle chew toy, dontcha? Yes you dooooo kind of way.

Basically, the idea is this. You take two functions f and g from \mathbb{R} \rightarrow \mathbb{R} and you plot g as if f were its x-axis. When you’re done you get some pretty sweet lookin’ plots.

Here are some of the ones I tried. The function f is in black, and T(g) is in green, (where T is the transformation discussed above). Note that using the same domains for f and T pretty much zooms f out of the picture a lot of the time.

f(x)=\lfloor x \rfloor
g(x)=\lfloor x \rfloor

f(x)=\lfloor x \rfloor
g(x)={\lfloor x \rfloor}^2

f(x)=\cos x
g(x)=\lfloor x \rfloor

f(x)=x \cos x^2
g(x)=x^2

f(x)=0.5x^2
g(x)=x^3 \cos x

f(x)=\cos x
g(x)=\exp (\cos x^2 )

A fountain

And here’s the Scilab code I used, if you’re interested:


function [r] = perpfunc(f,g,p) //f and g are functions
//p is a vector of x-values you want to plot

//The function perpfunc plots g as if f was its x-axis.

deff('y=df(f,x)','y=derivative(f,x)');
deff('y=T(x)','y=[x-g(x)*sin(atan(df(f,x))),f(x)+g(x)*cos(atan(df(f,x)))]');

lengthp=length(p);
b=ones(lengthp,2);

for i = 1:lengthp
b(i,:)=T(p(i));
end

plot2d(b(:,1),b(:,2),style=3); fplot2d(h,f);

endfunction

One Response leave one →
  1. 2008 August 4

    humm…
    floor(x) don’t have derivatives at some points. scilib can handle that, neat.

    You are funny with that adorable thing. xD

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS