I'm working on a calculator that performs some calculations on symbolic expressions. for now I'm collecting input with a text field and using latex interpreter to render the expression on a uiaxes.
Show older comments
I'm working on a calculator that performs some calculations on symbolic expressions. for now I'm collecting input with a text field and using latex interpreter to render the expression on a uiaxes. But I want to be able to input d expression in natural display format . Probably if I can input d text directly on uiaxes or something
7 Comments
Walter Roberson
on 21 Mar 2020
How are you currently doing the displaying?
When you say that you want to input the expression in natural display format, do you mean that if the user were to type in X^2 then right as they were typing you would want it to display as X² ?
brolaja
on 21 Mar 2020
Walter Roberson
on 21 Mar 2020
That is a fair bit of work. For example if the user has so far typed in
((x+k^2
then you cannot just
S = '((x+k^2'
try
F = str2sym(S);
L = latex(F);
display_the_latex(L);
catch ME
%must be in the middle of an expression
end
because you would want that converted to
immediately as the user types. Therefore you would need to parse the expression yourself looking for sub-expressions that can be converted and do those.
immediately as the user types. Therefore you would need to parse the expression yourself looking for sub-expressions that can be converted and do those.You also cannot use latex() for the purpose of creating the latex to display, because you would have to convert the expression to sym to do that, but str2sym() evaluates the expression -- for example it would be likely to re-arrange
to
which is not an action suitable for user input.
See also https://www.mathworks.com/help/symbolic/sym.mathml.html mathml() to convert symbolic expressions to MathML . However even that requires syntactically valid symbolic expressions.
brolaja
on 21 Mar 2020
Walter Roberson
on 21 Mar 2020
Maplesoft's maple program has a 1D input mode that automatically does things like putting in raised subscripts as you go. It also has a 2D input mode that permits dragging in symbols like integral symbol and filling in bounds and formulas by clicking at the appropriate points on the symbols.
And after more than 25 years... maple still has bugs in the 1D and 2D input modes. It is surprisingly difficult to get thoroughly right.
brolaja
on 21 Mar 2020
Walter Roberson
on 21 Mar 2020
No, not as a plug-in. You just might be able to use ActiveX or .NET to talk to it, but it might be a bit tricky to move between internal representations perhaps.
Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!