用Octave求定积分(1)
广告
{{v.name}}
如果能积分,则返回积分结果
求\(\int_4^{20}{ x }{\rm d}x\).
程序代码如下
function [text_result, numeric_result] = func77(limit1, limit2)
    pkg load symbolic;
    x = sym('x');
    f = int(x, x, limit1, limit2);
    text_result = ["\n", disp(f)];
    numeric_result = eval(f);
endfunction
结果如下
>> [text_result, numeric_result] = func77(4, 20)
text_result =
    399/2

numeric_result = 199.50
友链