用Octave计算证明单调性(1)
广告
{{v.name}}
重要不等式(1) 当\(x \gt 0\)时,\({\rm ln}(1+x) \lt x\)
计算\(\displaystyle\lim_{n \to 0^+}{\rm ln}(1+x) - x\)
程序代码如下
function [text_result, numeric_result] = func2(x_value)
pkg load symbolic;
x = sym('x');
question = log(1 + 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] = func2(eps)
warning: passing floating-point values to sym is dangerous, see "help sym"
warning: called from
double_to_sym_heuristic at line 50 column 7
sym at line 384 column 13
limit at line 92 column 5
func2 at line 5 column 9
text_result =
1 ⎛4503599627370497⎞
- ──────────────── + log⎜────────────────⎟
4503599627370496 ⎝4503599627370496⎠
numeric_result = -2.4652e-32
令\(x \to -10\),计算结果如下
>> [text_result, numeric_result] = func2(-10)
text_result =
log(9) + 10 + ⅈ⋅π
numeric_result = 12.1972 + 3.1416i
可见,当\(x \lt 0\)时,\({\rm ln}(1+x)\)不小于\(x\)。