Effacer les filtres
Effacer les filtres

Why is Symbolic Math Toolbox Giving Decimal Answers?

3 vues (au cours des 30 derniers jours)
Jason
Jason le 4 Oct 2023
Réponse apportée : Paul le 4 Oct 2023
When I ask symbolic math toolbox for symbolic outputs, it gives them in a decimal, but symbolic. I would like sym(pi) to give π and sym(sqrt(3)) to give . I've set my path to default and typed the command "reset(symengine)" and the commands "restoredefaultpath; rehash toolboxcache;" I've deleted and redownloaded both Matlab and the Symbolic toolbox. Any help is appreciated.

Réponse acceptée

Paul
Paul le 4 Oct 2023
Check your sympref
The defaults are
sympref
ans = struct with fields:
FourierParameters: [1 -1] HeavisideAtOrigin: 1/2 AbbreviateOutput: 1 TypesetOutput: 1 FloatingPointOutput: 0 PolynomialDisplayStyle: 'default' MatrixWithSquareBrackets: 0
Resulting in
[sym(pi) sym(sqrt(3))]
ans = 
But, if you change this pref
sympref('FloatingPointOutput',true);
sympref
ans = struct with fields:
FourierParameters: [1 -1] HeavisideAtOrigin: 0.5000 AbbreviateOutput: 1 TypesetOutput: 1 FloatingPointOutput: 1 PolynomialDisplayStyle: 'default' MatrixWithSquareBrackets: 0
then
[sym(pi) sym(sqrt(3))]
ans = 

Plus de réponses (1)

Walter Roberson
Walter Roberson le 4 Oct 2023
sympref('FloatingPointOutput', 0)
ans = logical
0

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by