How to use Octave with real numbers and syms at one time

762 Views Asked by At

I want to use GNU Octave to solve my equations. Equations contain syms variables and vectors with decimal numbers in them. How properly solve these equations without getting warnings that im doing dangerous operation and wierd approximations for precious decimal numbers.

here is the code:

B = [0.5, -0.289, 0];
C = [0, 0.577, 0];

syms R2 R3;

N23 = -B.*B + C.*C;
D23 = C-B;
P23 = (N23 + R2^2 - R3^2)./D23;
disp("\n---P23-----------------")
disp(P23(1))
disp(P23(2))
disp(P23(3))

here is the output:

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 379 column 13
    numeric_array_to_sym at line 36 column 16
    sym at line 359 column 7
    plus at line 61 column 5
    C:/Users/tomas/AppData/Local/Temp/octave/octave_njEZyF.m at line 3 column 5

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 379 column 13
    numeric_array_to_sym at line 36 column 16
    sym at line 359 column 7
    plus at line 61 column 5
    C:/Users/tomas/AppData/Local/Temp/octave/octave_njEZyF.m at line 3 column 5

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 379 column 13
    numeric_array_to_sym at line 36 column 16
    sym at line 359 column 7
    rdivide at line 104 column 5
    C:/Users/tomas/AppData/Local/Temp/octave/octave_njEZyF.m at line 3 column 5

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 379 column 13
    numeric_array_to_sym at line 36 column 16
    sym at line 359 column 7
    rdivide at line 104 column 5
    C:/Users/tomas/AppData/Local/Temp/octave/octave_njEZyF.m at line 3 column 5


---P23-----------------
        2       2   1
  - 2*R2  + 2*R3  + -
                    2
        2         2
  500*R2    500*R3    210500*pi
  ------- - ------- + ---------
    433       433      2296199
      /  2     2\
  zoo*\R2  - R3 /
  1. How to solve my problem properly?
  2. Why is using float number dungerous?
  3. Why is it making these approximations with fractions and pi?
  4. Also what does the "zoo" in the last line mean?