What are symbolic variables?

162 views (last 30 days)
Real Name
Real Name on 17 Jan 2017
Commented: Walter Roberson on 17 Jan 2017
I don't really understand what they are and why they're needed. I also couldn't find anything about this in the documentary.

Answers (1)

Walter Roberson
Walter Roberson on 17 Jan 2017
A symbolic variable can hold an expression instead of just a numeric value. For example it can hold the expression sin(x^2+1) . The symbolic toolbox can reason about the expressions, such as finding the solution to equations, or such as doing calculus. For example,
syms x
diff(sin(x^2+1),x)
comes out as 2*x*cos(x^2 + 1)
This can be used to create and manipulate formula instead of having to work with specific numeric values.
Symbolic variables are not restricted to integers or floating point numbers, so the toolbox can reason about irrational values with full theoretic precision. For example,
>> symsum(1/x^2,x,1,inf)
ans =
pi^2/6
  1 Comment
Walter Roberson
Walter Roberson on 17 Jan 2017
Also symbolic numbers can have a higher precision than hardware numbers so you can compute to more decimal places. The trade off is that symbolic computations need more memory and are slower than hardware computation

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!