Don't change equation in EXPLAINVAL
Brought to you by:
jrheinlaender
Is it possible to make to prevent equation changing by EXPLAINVAL
%%ii @a_1@ EQDEF a_1=1 %%ii TEXT newline %%ii @a_2@ EQDEF a_2=2 %%ii TEXT newline %%ii @a_3@ EQDEF a_3=3 %%ii TEXT newline %%ii @aa@ EQDEF aa=2(a_3+3 a_2+a_1) %%ii TEXT = %%ii EXPLAINVAL* aa
Actual:
Wanted:
Anonymous
I'm afraid that is not possible. Because the symbolic expressions are parsed into a GiNaC expression (GiNaC is a library for symbolic calculations). GiNaC automatically puts every expression into an internal, canonical representation that is optimized for fast symbolic computations. This is what you call "equation changing". It happens everywhere, not only in EXPLAINVAL.
It's very annoying, but there is not way to prevent it except to implement an own library for symbolic calculations...
Last edit: Sergey Chelnokov 2020-11-15
I think the difficulty is to decide what is a variable. e.g. if you want to replace the variable a, then you have to distinguish between the symbols a, "a", x_a, a_1, ab etc. and that is what makes things difficult.
It would mean implementing a second parser. I have been thinking about it sometimes, but it is a lot of work. Currently there is only a parser that turns a text string into a GiNaC expression.
Last edit: Sergey Chelnokov 2020-11-15
Last edit: Sergey Chelnokov 2020-11-15
Last edit: Sergey Chelnokov 2020-11-15
I'm not quite sure what you mean. Do you want to replace the syntax
_ii_ VAL(x) _ii_
by the shorter syntax<x>
so there is less work in writing?Last edit: Sergey Chelnokov 2020-11-15
Hi Sergey,
you can read an external file into a Math object with READFILE. Currently formulas read in like this are not displayed because it is intended as a kind of include-file syntax.
But it would be possible to add a parameter to READFILE which displays all the formulas in the file.
No, I need to run external editor for math object. External file - is just my view how can it be implemented (user must don't know anything about external file)
You mean a new option on the right-click context menu "Open in external editor"? And the editor to use could be defined in the global iMath settings.
Still not 100% sure what you mean...
The user writes
AUTOTEXT =a+b=_ii_VAL(a+b)_ii_
and iMath processes this in the same way
TEXT =_ii_VAL(a)_ii_+_ii_VAL(b)_ii_=_ii_VAL(a+b)_ii_
?
What happens if the user has defined three variables a=2, a_1=5, ab=7 and writes
AUTOTEXT =abs(a)+a_1+ab=_ii_VAL(a+a_1+ab)_ii_
?
Can the regex really distinguish between the different functions of the character 'a' in a, a_1, ab and abs() ?
I think it will be easier to simplify the
_ii_VAL(something)_ii_
syntax to<something>
.So the user can write
AUTOTEXT =<a>+<b>=<a+b>
Maybe <> character is not the best, we can look for other option, or pass the character as a parameter:
AUTOTEXT{"<>", "=<a>+<b>=<a+b>"}
Last edit: Sergey Chelnokov 2020-11-15
Last edit: Sergey Chelnokov 2020-11-15
Hi Sergey,
this feature request has become three different requests. I have separated them
Is it possible for you to delete the messages from this ticket which are not relevant to EXPLAINVAL?
Last edit: Jan Rheinlaender 2020-11-14