The order, n (or i in your code) is also limited to a scalar. In other words, the function doesn't support symbolic variables to specify the order of integration. Why does diff(f,x,i) evaluate to zero even though i is symbolic? From the documentation for sym/diff:ĭiff(S,n), for a positive integer n, differentiates S n times.ĭiff(S,'v',n) and diff(S,n,'v') are also acceptable. % Convert yi back to symfun so output is symfun % Calculate next derivative from previous Yi = % To index into array, yi cannot be symfun N = 0:2 % Increasing orders of differentiation Just use a for loop ( sym/diff is not vectorized in the third argument – see below): syms x y Īlternatively, you could try this form (in this case, for just three indexes, the above will probably be more efficient): syms x y When using symsum, you need to be aware that, like with any Matlab function, the input arguments will be evaluated before being passed in. This occurs because diff(f,x,i) evaluates to zero.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |