Skip to content

Instantly share code, notes, and snippets.

@hannahwhy
Created March 17, 2014 19:32
Show Gist options
  • Save hannahwhy/9606585 to your computer and use it in GitHub Desktop.
Save hannahwhy/9606585 to your computer and use it in GitHub Desktop.
(%i1) t: matrix([%t^3],[%t^2],[%t],[1])
;
[ 3 ]
[ %t ]
[ ]
[ 2 ]
(%o1) [ %t ]
[ ]
[ %t ]
[ ]
[ 1 ]
(%i2) m: matrix([-1, 3, -3, 1], [3, -6, 3, 0], [-3, 3, 0, 0], [1, 0, 0, 0]);
[ - 1 3 - 3 1 ]
[ ]
[ 3 - 6 3 0 ]
(%o2) [ ]
[ - 3 3 0 0 ]
[ ]
[ 1 0 0 0 ]
(%i3) c: matrix([a, c2, c3, b]);
(%o3) [ a c2 c3 b ]
(%i4) transpose(t) . m . c;
2 3
(%o4) %t (3 c3 - 6 c2 + 3 a) + %t (- 3 c3 + 3 c2 + b - a) + %t (3 c2 - 3 a) + a
(%i5) solve(transpose(t) . m . c, c2);
3 2 3 3 2
(3 %t - 3 %t ) c3 - %t b + (%t - 3 %t + 3 %t - 1) a
(%o5) [c2 = -------------------------------------------------------]
3 2
3 %t - 6 %t + 3 %t
(%i6) solve(transpose(t) . m . c, c3);
3 2 3 3 2
(3 %t - 6 %t + 3 %t) c2 + %t b + (- %t + 3 %t - 3 %t + 1) a
(%o6) [c3 = ----------------------------------------------------------------]
3 2
3 %t - 3 %t
(%i7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment