用Octave判断函数可导性
广告
{{v.name}}
判断函数可导性
函数在某点可导的充要条件是左导数和右导数都存在且相等。判断函数可导性是微积分学习中的重要内容,理解其数学原理是掌握后续知识的基础。
数学上,这一概念通过严格的极限语言来定义,符号计算工具可以帮助我们快速验证和计算相关问题。
用Octave判断可导性
在Octave中,先用 diff() 尝试求导,再用 limit() 检查导数在可疑点处的左右极限是否相等。
通过下面的代码示例,你可以学习如何用Octave来判断可导性。Octave的Symbolic包提供了强大的符号计算能力,让我们能够专注于理解数学概念,而不是繁琐的手工计算。
设\( f(x) = \cases{
\frac{ 2^{\frac{1}{x-1} } }{1+2^{\frac{1}{x-1} } }{\rm ln}x , & x > 0且 x≠ 1, \\
0 , & x = 1 ,
} \)讨论\( f(x) \)在\( x=1 \)处的可导性。
程序代码如下
function [text_result, numeric_result] = func37(x_value)
pkg load symbolic;
x = sym('x');
equation_1 = (2 ^ (1 / (x - 1))) / (1 + 2 ^ (1 / (x - 1))) * log(x);
equation_2 = 0;
if ((x_value > 0) && (x_value != 1))
question = equation_1;
elseif (x_value == 1)
question = equation_2;
else
error('Invalid input value.')
endif
d = diff(question, x);
x = x_value;
text_result = ["\n", disp(d)];
numeric_result = eval(d);
endfunction
计算\( f^{'}_{-}(1) \)(\( f^{'}(0.99) \)),结果如下
>> [text_result, numeric_result] = func37(0.99)
text_result =
2 1 1
───── ───── ─────
x - 1 x - 1 x - 1
2 ⋅log(2)⋅log(x) 2 ⋅log(2)⋅log(x) 2
────────────────────── - ───────────────────── + ──────────────
2 ⎛ 1 ⎞ ⎛ 1 ⎞
⎛ 1 ⎞ ⎜ ───── ⎟ ⎜ ───── ⎟
⎜ ───── ⎟ ⎜ x - 1 ⎟ 2 ⎜ x - 1 ⎟
⎜ x - 1 ⎟ 2 ⎝2 + 1⎠⋅(x - 1) x⋅⎝2 + 1⎠
⎝2 + 1⎠ ⋅(x - 1)
numeric_result = 5.5752e-29
计算\( f^{'}_{+}(1) \)(\( f^{'}(1.01) \)),结果如下
>> [text_result, numeric_result] = func37(1.01)
text_result =
2 1 1
───── ───── ─────
x - 1 x - 1 x - 1
2 ⋅log(2)⋅log(x) 2 ⋅log(2)⋅log(x) 2
────────────────────── - ───────────────────── + ──────────────
2 ⎛ 1 ⎞ ⎛ 1 ⎞
⎛ 1 ⎞ ⎜ ───── ⎟ ⎜ ───── ⎟
⎜ ───── ⎟ ⎜ x - 1 ⎟ 2 ⎜ x - 1 ⎟
⎜ x - 1 ⎟ 2 ⎝2 + 1⎠⋅(x - 1) x⋅⎝2 + 1⎠
⎝2 + 1⎠ ⋅(x - 1)
numeric_result = 0.9901
\( f^{'}_{-}(1)=0 \),\( f^{'}_{+}(1)=1 \).因为\( f^{'}_{-}(1) ≠ f^{'}_{+}(1) \),所以\( f(x) \)在\( x=1 \)处不可导.