用Octave求曲率圆的半径
广告
{{v.name}}
曲率圆的半径\(R=\frac{1}{K}\)
求\( y=sin(x)\)在\( x=1\)处的曲率圆的半径.
程序代码如下
function [text_result, numeric_result] = func51(x_value)
    pkg load symbolic;
    x = sym('x');
    question = sin(x);
    r = 1 / (abs(diff(diff(question, x), x)) / power(1 + power(1 + diff(question, x), 2), 3/2));
    result = limit(r, x, x_value);
    text_result = ["\n", disp(result)];
    numeric_result = eval(result);
endfunction
结果如下
>> [text_result, numeric_result] = func51(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
    func51 at line 5 column 7

text_result =
                        3/2
    ⎛                2⎞
    ⎝1 + (cos(1) + 1) ⎠
    ──────────────────────
            sin(1)

numeric_result = 7.3603
友链