Skip to content

Instantly share code, notes, and snippets.

@sunsided
Last active July 17, 2022 10:08
Show Gist options
  • Save sunsided/59e3b6750d7aa03e848ab73c603a1014 to your computer and use it in GitHub Desktop.
Save sunsided/59e3b6750d7aa03e848ab73c603a1014 to your computer and use it in GitHub Desktop.
Quadratic interpolant for fixed f(x_0), f(x_1) and f'(x_0)
syms a b c x_0 x_1 f(x_0) f(x_1) df(x_0)
[a, b, c] = solve(...
f(x_0) == a*x_0^2 + b*x_0 + c, ...
f(x_1) == a*x_1^2 + b*x_1 + c, ...
df(x_0) == 2*a*x_0 + b, ...
a, b, c);
syms q(x)
q(x) = simplify(a*x^2 + b*x + c);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment