how can i get a number as an answer?

11 ビュー (過去 30 日間)
sajjad barzigar
sajjad barzigar 2020 年 8 月 3 日
回答済み: John D'Errico 2020 年 8 月 3 日
i writed a code and matlab gave me the answer below
(23401992239682647381*pi*3^(1/2))/422212465065984000 + (1552897446512689152*pi*sin(5453738578345991/4503599627370496)^2)/27268692891729955 + (613*pi*eulergamma*3^(1/2))/200 - (613*3^(1/2)*pi*(cosint(5453738578345991/2251799813685248) - log(5453738578345991/2251799813685248)))/200
how can i get a number instead of this from matlab.how can i find the answer
  1 件のコメント
Spectro
Spectro 2020 年 8 月 3 日
編集済み: Spectro 2020 年 8 月 3 日
If you only want a numerical result from the result above you could use vpa() or double(). Just wrap the result mentioned above like this:
vpa(...yourResult)
% OR
double(...yourResult)
or wrap the variable that returns mentioned result.

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

回答 (1 件)

John D'Errico
John D'Errico 2020 年 8 月 3 日
You got a number. :) I know, its net a very useful looking number.
As s floating point sym, use vpa.
vpa((23401992239682647381*pi*3^(1/2))/422212465065984000 + (1552897446512689152*pi*sin(5453738578345991/4503599627370496)^2)/27268692891729955 + (613*pi*eulergamma*3^(1/2))/200 - (613*3^(1/2)*pi*(cosint(5453738578345991/2251799813685248) - log(5453738578345991/2251799813685248)))/200)
ans =
477.5278602687786718038388831070103122278
For a double, use double.
format long g
>> double((23401992239682647381*pi*3^(1/2))/422212465065984000 + (1552897446512689152*pi*sin(5453738578345991/4503599627370496)^2)/27268692891729955 + (613*pi*eulergamma*3^(1/2))/200 - (613*3^(1/2)*pi*(cosint(5453738578345991/2251799813685248) - log(5453738578345991/2251799813685248)))/200)
ans =
477.527860268779

カテゴリ

Help Center および File ExchangeNumbers and Precision についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by