2d Function Transformations

2d Function Transformations

Postby Guest » Sat Sep 05, 2020 8:45 am

Hi,

I'm working on a audio program for fun before Uni starts again. It makes use of a few simple functions. You can see them plotted in the bellow image.

Image

I need to be able to morph a y = x straight line into each function. I would like this to be done by a single scalar value if posible. So as the value of the scalar changes, a straight line slowly curves out into the function. Preferably the scalar value should be in the range 0 and 1. So that it has a value of 0 when it's a straight line and a value of 1 once it has curved into the function. This though is not that important. It just makes the code cleaner.

I don't know if there is a simple way to do this.

As an exsample I already worked out a way to do it for one of the functions.

[tex]f(x) = x^3[/tex]

becomes...

[tex]f(x) = \frac{x^3} {x^2 + c(1 - x^2)}[/tex]

So as the scalar [tex]c[/tex] changes from 0 to 1 the line curves out into the function.

I could really use some help working out how to do that for the other 3 functions. The must be some logical way to approach this.

I only a first year Computer Science student so if this gets into any higher mathematics please go slow.

Here are the functions:

[tex]f(x) = x^3[/tex]
[tex]f(x) = tan^{-1}(x)[/tex]
[tex]f(x) = tanh(3x)[/tex]
[tex]f(x) = \frac{1}{1 + e^{-x}} * 0.5[/tex]

thanks...
Guest
 

Re: 2d Function Transformations

Postby Baltuilhe » Sat Sep 05, 2020 2:39 pm


Baltuilhe
 
Posts: 106
Joined: Fri Dec 14, 2018 3:55 pm
Reputation: 69

Re: 2d Function Transformations

Postby Blink » Sun Sep 06, 2020 4:49 am

Wow thank-you that's amazing. I didn't know you could cancel out trigonometric functions like that.

Blink
 
Posts: 2
Joined: Sat Sep 05, 2020 7:45 am
Reputation: 2

Re: 2d Function Transformations

Postby Baltuilhe » Sun Sep 06, 2020 2:35 pm

Blink wrote:Wow thank-you that's amazing. I didn't know you could cancel out trigonometric functions like that.

Neither did I!

You have given the clue. You wanted to 'turn' to y=x, right?
So, [tex]x^3[/tex] to x... just [tex]\frac{x^3}{f(x)}=x[/tex]... [tex]f(x)=\frac{x^3}{x}=x^2[/tex], right? :)

Then to the other, I followed the same thought!

Glad to have helped!

Good Sunday!

Baltuilhe
 
Posts: 106
Joined: Fri Dec 14, 2018 3:55 pm
Reputation: 69

Re: 2d Function Transformations

Postby Blink » Sun Sep 06, 2020 3:00 pm

Yeah I see how you got there. That's cool it's like the beginning of a tiny proof for the transformation. If we showed now that those functions equal [tex]f(x) = x[/tex] it would be a proof I think.

Blink
 
Posts: 2
Joined: Sat Sep 05, 2020 7:45 am
Reputation: 2

Re: 2d Function Transformations

Postby HallsofIvy » Fri Sep 18, 2020 6:01 pm

You can always "morph" y(x)= f(x) to y(x)= g(x) with the function y(x, t)= (1- t)f(x)+ tg(x), t going from 0 to 1.
HallsofIvy
 
Posts: 340
Joined: Sat Mar 02, 2019 9:45 am
Reputation: 128


Return to Functions, Graphs, Derivatives



Who is online

Users browsing this forum: No registered users and 1 guest