用Octave计算证明单调性(2)
广告
{{v.name}}
重要不等式(2) 当\(x \ge 0\)时,\({\rm sin}x \le x\)
计算\(\displaystyle\lim_{x \to 0}{\rm sin}x - x\)
程序代码如下
function [text_result, numeric_result] = func3(x_value)
    pkg load symbolic;
    x = sym('x');
    question = sin(x) - x;
    lim = limit(question, x, x_value);
    text_result = ["\n", disp(lim)];
    numeric_result = eval(lim);
endfunction
令\(x \to 0\),计算结果如下
>> [text_result, numeric_result] = func3(0)
text_result =
    0

numeric_result = 0
令\(x \to 10\),计算结果如下
>> [text_result, numeric_result] = func3(10)
text_result =
    -10 + sin(10)

numeric_result = -10.544
友链