Symbolic variables that display as a combination of Greek characters and normal letters in Live Scripts

14 views (last 30 days)
I want to define a symbolic variable that displays as Δp in the Live Script output. I can define a symbol variable as Delta and it will display as Δ each time it's used, and I can do Delta_p and it will display as , but I'd like to have it display as a normal Δp. Is this possible?
EDIT:
Somewhat related question, why are superscripts and accents not working? I coppied and pasted this directly from https://www.mathworks.com/help/symbolic/add-suffixes-to-symbolic-results.html :
syms F__a F__b
Ftot = F__a + F__b
but it displays as . Also, F_dot displays as instead of and everything else only displays as subscripts. I don't see any related settings that are deactivated and I'm using R2018b. Is this a feature exclusive to 2019+ or something?

Answers (1)

Walter Roberson
Walter Roberson on 26 Jan 2020
This was changed as of R2019a . F__a is F with superscript a and F_a is F with subscript a . F_dot and F_hat are recognized nicely. However, F_hat and F__hat both show up the same as each other, and F_dot and F__dot both show up the same as each other.
  3 Comments
Walter Roberson
Walter Roberson on 26 Jan 2020
dp = evalin(symengine, '`Δp`');
dp + 5
I cannot seem to get superscripts or accents to work in R2018a, except inside MuPAD notebooks. If you try something like
abc = evalin(symengine, 'Symbol::superScript(x, j)')
then you get the output
{x}^{j}
but
def = evalin(symengine, 'Symbol::delta')
does produce δ that is the same as
syms delta
Walter Roberson
Walter Roberson on 26 Jan 2020
Delta = evalin(symengine, 'Symbol::Delta')
dp = feval(symengine, '_concat', Delta, 'p')
For this to work, you need to go through the MuPAD Symbol:: construction step: without that, MuPAD will create a symbol Deltap instead of `Δp` that displays as

Sign in to comment.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!