MATLAB Answers

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

23 views (last 30 days)
Philip M
Philip M on 26 Jan 2020 at 0:28
Commented: Walter Roberson on 26 Jan 2020 at 7:48
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?

  0 Comments

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 26 Jan 2020 at 1:42
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

Philip M
Philip M on 26 Jan 2020 at 1:46
Thanks, so is there any way for me to have variables display in Live Script with superscripts or accents with 2018b? Also, is it possible for me to have a variable display as Δp?
Walter Roberson
Walter Roberson on 26 Jan 2020 at 3:45
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 at 7:48
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.

Sign in to answer this question.

Products


Release

R2018b

Translated by