用Octave求偏导数
广告
{{v.name}}
设\(f(x,y)=x^2+y^2,求f'_{~y}(1,2)\).
程序代码如下
function [text_result, numeric_result] = func80(x_value, y_value)
pkg load symbolic;
x = sym('x');
y = sym('y');
result = diff(x^2 + y^2, y);
result = limit(result, x, x_value);
result = limit(result, y, y_value);
text_result = ["\n", disp(result)];
numeric_result = eval(result);
endfunction
结果如下
>> [text_result, numeric_result] = func80(1, 2)
text_result =
4
numeric_result = 4