@claus mathematical answer: it is possible, but it will also change the slow of the upwards-facing part right of x=1.
@claus ah sorry, t, not x. You can solve this with a system of equations using the coordinates that you want, i.e. (0,1) and (1,0) for y and t:
0 = a*1^3 + b*1^2 + c*1 + d,
1 = a*0^3 + b*0^2 + c*0 + d.
Additionally you have the constraints of the first derivative (i.e. the slope) = 0 in those points. (sorry, I don't remember the formula right now :D) but setting t' to those points = 0 gives you four equations in total, and you can then use Gauss-Jordan elimination to solve for a, b, c and d.
@claus me: yeah this is easy it's basically high school math
me: how do you derive a third-grade polynomial again?
@daniel_bohrer Hahaha! Well that i know! 😆
f(x) = 2t^3 - 3t^2 + 1
f'(x) = 6t^2 - 6t
Integral: 0.5t^4 - t^3 + t
@claus you'd have to work with the coefficients. since you have the desired shape/points for the curve you'd get faster to what you want if you interpolate the points. I think with a decent amount of points and applying cubic spline you gonna get closer then just playing with the coefficients.
@cevado Hmm i am only interested in the domain (0, 1) so maybe i get to where i want to go with a single cubic spline? I'll have to play around with that. The original function btw is one of the Hermite spline functions..
@claus I had code on mathlab from my days at college that given a set of points and a desired precision would generate the desired curve with a single cubic spline. there might be something like that available with python or julia. 🤔
@cevado What i want to achieve: I use this as a function of decaying velocity over time, starting at an initial velocity v0, here y=1, and coming to a rest at t=1. The integral from 0 to 1 is the distance traveled (here: 0.5), and that antiderivative gives me a nice ease-out. I want to make that ease-out smoother. Does that make sense? I'm not even sure if i have the right approach. I started with an exponential function but that was a problem due to it approaching but never reaching 0 😅
@claus I'm not that good in math to say if it's a good approach or not 😂. I just think interpolation gonna be faster... the good thing is that if you want a smoother interpolation spline is the way to go, afaik
@claus (t-1)^2 * (t+0.25).
But it will still look very different from green. Cubic can't approximate that well.
@claus to be clear, if you actually just want the closest match, with a cubic, that for sure isn't it, for some reason i inferred you wanted to preserve the 'touch zero at t=1'. Otherwise replace (t-1) with (t-0.5) would at least narrower.
chaos.social – a Fediverse instance for & by the Chaos community