Function Warping is what I've begun to call, where you graph a function using another normally graphed function as the x axis.
This piece is divided into 4 individual parts:
If you just want the parametric curve, here it is:
L here is the arc length function of X from the 0 to t, and R is a rotation operator (specifically 90 degrees counter-clockwise): it could be a matrix, or a function, or however you want to define rotations.
There's a lot of symbols in the above equation, so let's break it down:
Now the basic foundation is set, all that's left is some cleanup to solve some injective faux paus' and cleanliness:
Now I can go and blab about how it's done, but that doesn't really matter unless I actually show you how I'm thinking about the problem and how I actually got to where I ended up.
First things first, how is a function actually graphed? Below you'll see a diagram that shows that for a point (x,f(x)), we go x units right from the origin, and directly up, we go f(x) units. Notice how the line that goes directly up makes a right angle with the x-axis.
Note: I'll only be showing the first quadrant, but all of these graphics should apply to the other quadrants as well.Instead of going x units along the x-axis and then f(x) units directly up orthogonaly from the x-axis, I wanted my warped function to go x' units along the axis function and f(x') units up. Below you'll see that with as our axis function and as our warped function
Another note: if you're screen is much wider than mine (1920 pixels), these will be too far along for my precombed parametric and baked canvas height. Although I doubt that will be a problem, if the cyan altitude isnt touching the purple function, shorten your window a tad.As I said before, our warped functin is a parametric curve, meaning I can frankenstein multiple points together to get the final product. Our first point is the point on the regurlarly graphed axis function, in this case
now we have to get the line from that (t,sin(t)) point to the point above it on the warped function. For that we need to calculate x', so that we can compute f(x'); it just so happens that there is a well-known solution to the problem of getting the length of a piece of function: the arc length function (usually denoted as L(x)); from an x value a to an x value b, the length of any given function g is , so if we are t units along the x-axis, that means we are L(t) units along the X function, AKA x'=L(t) where g=X, a=0, and b=t.
Now that we have the length of our connecting line, we need the direction so we can put it all together in the form where n is the normal vector of our line (basically what encodes the direction of said line). This is where the word "orthogonal" comes into play. To be orthogonal to a point on a function or curve, your line must be perpendicular to the tangent line of the function at that point. To begin with, lets look at our tangent line at (t,X(t))
This tangent line (in yellow) takes the form of X'(t)(x-t)+X(t), meaing its argument is arctan(X'(t)). Now we can go two ways from here: get the normal vector with this argument and then rotate that by 90 degrees counter-clockwise, or we can rotate this line first that get the argument of that orthogonal line for our normal vector. Since we already did the former in the gist section, I will go with the latter this time around. To get the line perpendicular to our tangent line, we must turn our X'(t) slope into a -X'(t)^-1 slope (although be careful, this is a clockwise rotation in disguise and the normal vector must be rotated 180 degrees to compensate, you'll see that with an added pi next to the arctan later).
Hence our new argument is arctan(-X'(t)^-1)+π (our sneeky 180 degree rotation), and our normal vector is (cos(arctan(-X'(t)^-1)+π),sin(arctan(-X'(t)^-1)+π)). Finally we will need to employ our trig-arctrig identities to properly graph in all four directions, but we'll do that in the next section for brevity:
final note: the magenta green normal vector look wierd when t is close to zero, dont mind that.The final step in this derivation is our trig-arctrig identities, and then some clean up to get where we were before:
Beyond derivation, I'm going to spotlight some intresting things that I have found warping functions:
You can encode the vertical shift f(x)+c (for any arbitrary constant c) by using the warp W(f(x),c), I don't know how you would do horizontal shift (I'm going to guess it's impossible but who knows).
By warping a function f to a linear equation ax, you are rotating f by arctan(a), now granted that means you can only rotate by between -π/2 and π/2 but it's still neat. Furthermore, you can combine both ax and c to rotate and shift a function by doing W(f(x),ax+c).
I noticed while looking at W(sin(x),cos(x)), it looks as if the period is 28π, yet there are perceptible phase changes. I assume that these phase changes will add up eventually to get so very close to the principle period, yet will fall just a smidge short due to sine and cosine being phase shifts of eachother. I haven't looked at periodic functions with intersecting zeroes, but I bet that's where the real periods are found.
If you try to morph a function onto ln or any other logarthm, you run into some problems. This is due to the fact that the lower bound of our arclength function is 0, simply changing this to will fix the problem. On another note, changing the lower bound of the arclength will slide the morphed function along the axis function. If you wanted to intersect the vertex of , you need to change the lower bound of L to .