用Octave计算左、右极限
广告
{{v.name}}
\( f(x)= \frac{1-2^{ \frac{1}{x-1} } }{2+2^{ \frac{2}{x-1} } } \),讨论\( \displaystyle\lim_{x \to 1 } f(x) \)
程序代码如下
function [text_result, numeric_result] = func14(x_value)
pkg load symbolic;
x = sym('x');
unit_1 = 1 / (x - 1);
unit_2 = 2 / (x - 1);
question = (1 - power(2, unit_1)) / (2 + power(2, unit_2));
lim = limit(question, x, x_value);
text_result = ["\n", disp(lim)];
numeric_result = eval(lim);
endfunction
令\(x \to 1.01 \),计算结果如下
>> [text_result, numeric_result] = func14(1.01)
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
func14 at line 7 column 9
text_result =
-422550200076076467165567735125
────────────────────────────────────────────────────────────
535646014752996758513987364113720867507400997927597611767126
numeric_result = -7.8886e-31
令\(x \to 0.99 \),计算结果如下
>> [text_result, numeric_result] = func14(0.99)
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
func14 at line 7 column 9
text_result =
535646014752996758513987364113298317307324921460432044032000
─────────────────────────────────────────────────────────────
1071292029505993517027974728227441735014801995855195223534251
numeric_result = 0.5000
因为\( f(1-0) \ne f(1+0) \),所以\( \displaystyle\lim_{x \to 1 } f(x) \)不存在