2

I am trying to get the coeficient matrix of the following taylor series expansion

(%i47) SS: taylor( matrix( [sin(h)], [cos(t)] )  , [h,t], [h_0, t_0], 1 );
                                                                                           [ sin(h_0) + cos(h_0) (h - h_0) + . . . ]
(%o47)/T/                                                                                  [                                       ]
                                                                                           [ cos(t_0) - sin(t_0) (t - t_0) + . . . ]

Now that I have the taylor expansion I have, I want this to of the form A[h;t] + b.

coefmatrix( SS, [h,t,1] );
                               [ sin(h_0) + cos(h_0) (h - h_0) + . . . ]
coefmatrix: improper argument: [                                       ]
                               [ cos(t_0) - sin(t_0) (t - t_0) + . . . ]
 -- an error. To debug this try: debugmode(true);

This last step gives an error. How can I accomplish what I desire?

mkuse
  • 2,250
  • 4
  • 32
  • 61

1 Answers1

1

After some tinkering, the correct way to do this is:

SS(h,t):= taylor( matrix( [sin(h)], [cos(t)] )  , [h,t], [h_0, t_0], 1 );
q: list_matrix_entries( SS( h,t ) );
A: coefmatrix( q, [h, t] );
b: expand( A . [h,t] - q );

this results in:

(%i6) A: coefmatrix( q, [h,t] );
                                        [ cos(h_0)      0      ]
(%o6)                                   [                      ]
                                        [    0      - sin(t_0) ]
(%i7) b: expand( A . [h,t] - q );

                                    [   h_0 cos(h_0) - sin(h_0)   ]
(%o7)                               [                             ]
                                    [ (- t_0 sin(t_0)) - cos(t_0) ]

All in all the function list_matrix_entries was the key.

mkuse
  • 2,250
  • 4
  • 32
  • 61