用Octave求曲率
广告
{{v.name}}
曲线\(L\)在一点处的曲率为\(K=\frac{\lvert{y''}\rvert }{(1+y'^{2})^\frac{3}{2} }\)
求\( y=sin(x)\)在\( x=1\)处的曲率.
程序代码如下
function [text_result, numeric_result] = func50(x_value)
pkg load symbolic;
x = sym('x');
question = sin(x);
d = abs(diff(diff(question, x), x)) / power(1 + power(1 + diff(question, x), 2), 3/2);
result = limit(d, x, x_value);
text_result = ["\n", disp(result)];
numeric_result = eval(result);
endfunction
结果如下
>> [text_result, numeric_result] = func50(1)
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
power at line 75 column 5
func50 at line 5 column 7
text_result =
sin(1)
──────────────────────
3/2
⎛ 2⎞
⎝1 + (cos(1) + 1) ⎠
numeric_result = 0.1359