Reputation: 1007
Let us suppose that we run the following set of commands in Octave:
pkg load symbolic %loads the symbolic math package
syms x y %declare x and y symbols
f = x^2 - 2*x + 3;
V = [-5:0.25:5]';
V_x = subs(f, x, V)
At this point V_x
is a symbolic expression in Octave. Now, if this were to be MATLAB, one would run eval(V_x)
and everything would be converted to numbers. However, eval
does not seem to run in Octave as in MATLAB.
What should be done to convert the symbolic array into numbers?
Upvotes: 3
Views: 4514
Reputation: 141
and how about getting variable precision (number of digits) in the evaluated symbolic output, ie, staying in the vpa symbolic space but solving all the sym internal functions to digits
eval still outputs in the default octave output_precision and format long limitations, so that is of no use.
this is one way (sym variable y holds the value):
sympref digits 1000
syms x
eqn = x==y
vpasolve(eqn)
Upvotes: 0