我正在尝试获得以下泰勒级数展开式的系数矩阵
(%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) + . . . ]
现在我有了taylor扩展名,我希望它的格式为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);
最后一步给出了错误。我该如何实现自己的愿望?
经过一些修补后,正确的方法是:
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 );
这导致:
(%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) ]
全部功能list_matrix_entries
是关键。