Jump to content

Recommended Posts

Posted

Hello!

I am stuck with a relatively simple task. I am doing some coding and need a certain kind of motion to apply to an object.

The motion graph should look something like in the picture. It may look like sqrt(x) at first but this isn't the case, I am wondering if there is some function that actually reaches a slope of 0 relatively quickly (or a VERY tiny slope) ?

Thanks!

Screenshot_525.png

Posted (edited)
13 minutes ago, andero said:

Hello!

I am stuck with a relatively simple task. I am doing some coding and need a certain kind of motion to apply to an object.

The motion graph should look something like in the picture. It may look like sqrt(x) at first but this isn't the case, I am wondering if there is some function that actually reaches a slope of 0 relatively quickly (or a VERY tiny slope) ?

Thanks!

Screenshot_525.png

The ln function gets very close to a 0 slope rather quickly. What exactly are you trying to program?

You could try and analytically continue a function with another one, and when its slope reaches 0 just replace it with a fixed value

 

-k(x-t)^2+c for instance would give you a function that reaches a slope of 0 at it's summit, and you could then replace it by c when f'(x)==0

Edited by YaDinghus
Example
Posted
6 minutes ago, YaDinghus said:

The ln function gets very close to a 0 slope rather quickly. What exactly are you trying to program?

You could try and analytically continue a function with another one, and when its slope reaches 0 just replace it with a fixed value

I tried modifiying the ln(x) a bit and it's close enough to what I'd like.

Thank you very much!

Posted (edited)
5 minutes ago, andero said:

I tried modifiying the ln(x) a bit and it's close enough to what I'd like.

Thank you very much!

Anytime :)

2 minutes ago, Strange said:

You could try the tan function (or tan^2 to get an even faster change).

Doesn't tan go 'straight' up once it passes x = pi/4? After all it has definition gaps every pi/2...

Edited by YaDinghus
Posted

I get this graph in OpenOffice Calc using code "=IF(A1<1.5;SIN(A1)^0.5;1)" for cell B1. Fill it down to entire column.

graph.thumb.png.f42e09b1fa34b386f380d79e5c3d64da.png

Check also 0.333 instead of 0.5..

 

 

 

Example result for "=IF(A1<1.75;SIN(A1^0.8333)^0.33;1)"

5b167ae1329f1_graph2.thumb.png.e277c51c475b1f1e30999c2a0c451694.png

 

  • 2 weeks later...
Posted (edited)
On 6/5/2018 at 1:32 PM, YaDinghus said:

Doesn't tan go 'straight' up once it passes x = pi/4? After all it has definition gaps every pi/2...

He means arctan (times a suitable constant).

It is different from a logarithm in an important respect. Although both functions will keep increasing, the log is unbounded, whereas arctan will approach an upper limit. So it depends on which of those properties you are aiming for.

Edited by taeto

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.