A Cute Lil Somethin’

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

Advertisements

One response to this post.

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

    You are funny with that adorable thing. xD

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: