用Octave求弧微分(1)
广告
{{v.name}}
弧微分公式(1)
设\(L:y=f(x)(x \in [a, b])\),则\(ds=\sqrt{1+f'^{2} (x)}dx\)
求\( y=sin(x)(x \in [1,2]) \)的弧长.
程序代码如下
function [text_result, numeric_result] = func48(limit1, limit2)
    pkg load symbolic;
    x = sym('x');
    question = sin(x);
    d = sqrt((1 + power(diff(question, x), 2)));
    result = int(d, x, [limit1, limit2]);
    text_result = ["\n", disp(result)];
    numeric_result = eval(result);
endfunction
结果如下
>> [text_result, numeric_result] = func48(1,2)
text_result =
     2
     ⌠
    ⎮    _____________
    ⎮   ╱    2
    ⎮ ╲╱  cos (x) + 1  dx
    ⌡
    1

numeric_result = 1.0402
友链