Skip to content

Instantly share code, notes, and snippets.

@kylemcdonald
Last active December 19, 2019 23:22
Show Gist options
  • Save kylemcdonald/77f916240756a8cfebef to your computer and use it in GitHub Desktop.
Save kylemcdonald/77f916240756a8cfebef to your computer and use it in GitHub Desktop.
Derivation of 7th-order smoothstep function with zeros in third derivative.
7th-order spline and first three derivatives
f(t) = a_7 t^7+a_6 t^6+a_5 t^5+a_4 t^4+a_3 t^3+a_2 t^2+a_1 t+a_0
f'(t) = 7 a_7 t^6+6 a_6 t^5+5 a_5 t^4+4 a_4 t^3+3 a_3 t^2+2 a_2 t+a_1
f''(t) = 42 a_7 t^5+30 a_6 t^4+20 a_5 t^3+12 a_4 t^2+6 a_3 t+2 a_2
f'''(t) = 210 a_7 t^4+120 a_6 t^3+60 a_5 t^2+24 a_4 t+6 a_3
Constraints
f(0) = 0 = a_0
f(1) = 1 = a_7 + a_6 + a_5 + a_4 + a_3 + a_2 + a_1 + a_0
f'(0) = 0 = a_1
f'(1) = 0 = 7 a_7 + 6 a_6 + 5 a_5 + 4 a_4 + 3 a_3 + 2 a_2 + a_1
f''(0) = 0 = a_2
f''(1) = 0 = 42 a_7 + 30 a_6 + 20 a_5 + 12 a_4 + 6 a_3 + 2 a_2
f'''(0) = 0 = 6 a_3
f'''(1) = 0 = 210 a_7 + 120 a_6 + 60 a_5 + 24 a_4 + 6 a_3
Solutions
a_0 = 0
a_1 = 0
a_2 = 0
a_3 = 0
a_4 = 35
a_5 = -84
a_6 = 70
a_7 = -20
Result
f(t) = -20 t^7+70 t^6+-84 t^5+35 t^4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment