用Octave求定积分(3)
广告
{{v.name}}
如果不能积分,则可能不会返回数值解
求\(\int_4^{20}{ \frac{1}{ {\rm ln}(x^2-3) } }{\rm d}x\).
程序代码如下
function [text_result, numeric_result] = func79(limit1, limit2)
pkg load symbolic;
x = sym('x');
f = int(1 / log(x^2 - 3), x, limit1, limit2);
text_result = ["\n", disp(f)];
numeric_result = eval(f);
endfunction
结果如下
>> [text_result, numeric_result] = func79(4, 20)
text_result =
20
⌠
⎮ 1
⎮ ─────────── dx
⎮ ⎛ 2 ⎞
⎮ log⎝x - 3⎠
⌡
4
numeric_result = (sym)
20
⌠
⎮ 1
⎮ ─────────── dx
⎮ ⎛ 2 ⎞
⎮ log⎝x - 3⎠
⌡
4