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

numeric_result = -4
这个-4也许是个bug.
友链