# why use symbolic variables over others

4 ビュー (過去 30 日間)
Caolan Dix 2017 年 1 月 17 日

Hello I am new to matlab and am working through a book by Huei Huang Lee called Programming with Matlab 2016. In his examples he declares variables and uses them. Then proceeds to declare variables as syms and uses those with no clear explanation as to why I would choose one over the other, which is better, etc. ...
e.g.: syms v0
vs.
v0=5.0
I checked the documentation and there didn't seem to be much there either.
Can anyone shed some light on this please?
Thank you! -Caolan
##### 1 件のコメント表示非表示 なし
Stephen23 2017 年 1 月 17 日

サインインしてコメントする。

### 回答 (1 件)

Jyotish Robin 2017 年 1 月 20 日

Symbolic numbers are exact representations, unlike floating-point numbers.You can create symbolic numbers by using "sym". The symbolic number is represented in exact rational form, while the floating-point number is a decimal approximation. The symbolic result is not indented, while the standard MATLAB result is indented.
For example:
>>sym(1/3) %returns exact representation
1/3
>>1/3 %returns approximation
.3333
Here the symbolic number is represented in exact rational form, while the floating-point number is a decimal approximation. The symbolic result is not indented, while the standard MATLAB result is indented.
To get an overview of symbolic and numeric arithmetic, refer below link:
Hope it helps!!
##### 2 件のコメント表示非表示 1 件の古いコメント
Jyotish Robin 2017 年 1 月 20 日
Yea. That statement was specific to the example I mentioned. I will edit. Thank you for pointing out. :)

サインインしてコメントする。

### カテゴリ

Find more on Number Theory in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by