How to display square root symbol instead of decimal.

52 views (last 30 days)
The number of display format does not include the square, I can only select decimal, rational..., but not square root. When I input sqrt(5) in a matrix and display it, it is transformed to decimal. Can I keep the square root form?
  3 Comments
Walter Roberson
Walter Roberson on 10 Feb 2026 at 17:35
Edited: Walter Roberson on 10 Feb 2026 at 19:20
To display at the command line, you would need to be using a matlab version from the last several years, and you would need to fprintf the unicode square root symbol, √ which is U+221A, followed by whatever text. This would prefix the text with the symbol rather than drawing the symbol extending over the text. There is no way to get the symbol extending over the text at the command line.
If you use the symbolic toolbox together with Livescript then it does become possible to display the square root extending over the text... but not at the command line.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 31 Jan 2023
sqrt(sym(5))
ans = 
This requires the Symbolic Toolbox.
Also, display of the square root symbol itself instead of 5^(1/2) requires that you are using Livescript

More Answers (0)

Categories

Find more on Symbolic Math Toolbox 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!