用Octave求偏导数
广告
{{v.name}}
微积分知识点

偏导数是多元函数微分学的基础概念。微积分知识点是微积分学习中的重要内容,理解其数学原理是掌握后续知识的基础。

数学上,这一概念通过严格的极限语言来定义,符号计算工具可以帮助我们快速验证和计算相关问题。

用Octave计算

在Octave中,diff(f, x) 对 x 求偏导,diff(f, y) 对 y 求偏导。

通过下面的代码示例,你可以学习如何用Octave来计算。Octave的Symbolic包提供了强大的符号计算能力,让我们能够专注于理解数学概念,而不是繁琐的手工计算。

设\(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
友链