Menu

#66 Don't change equation in EXPLAINVAL

Future_release
pending
None
1
2021-08-20
2019-06-26
No

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:

Discussion

  • Jan Rheinlaender

    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...

     
  • Sergey Chelnokov

     

    Last edit: Sergey Chelnokov 2020-11-15
    • Jan Rheinlaender

      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.

       
  • Sergey Chelnokov

     

    Last edit: Sergey Chelnokov 2020-11-15
  • Sergey Chelnokov

     

    Last edit: Sergey Chelnokov 2020-11-15
  • Sergey Chelnokov

     

    Last edit: Sergey Chelnokov 2020-11-15
    • Jan Rheinlaender

      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?

       
  • Sergey Chelnokov

     

    Last edit: Sergey Chelnokov 2020-11-15
    • Jan Rheinlaender

      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.

       
  • Anonymous

    Anonymous - 2020-11-12

    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)

     
    • Jan Rheinlaender

      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.

       
  • Anonymous

    Anonymous - 2020-11-12

    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?
    No, it's all about AUTOTEXT =a+b=_ii_VAL(a+b)_ii_ replacing by =_ii_VAL(a)+_ii_VAL(b)=_ii_VAL(a+b)_ii_ with regex
    (may be with regex it's would be not so hard)</x>

     
    • Jan Rheinlaender

      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>"}

       
  • Sergey Chelnokov

     

    Last edit: Sergey Chelnokov 2020-11-15
  • Sergey Chelnokov

     

    Last edit: Sergey Chelnokov 2020-11-15
  • Jan Rheinlaender

    Hi Sergey,
    this feature request has become three different requests. I have separated them

    1. No. 66 Don't change equation in EXPLAINVAL (this ticket) - a lot of work to implement a second parser
    2. No. 74 Keyword autotext - Can be handled by existing parser
    3. No. 75 Allow editing iFormulas with an external editor - Can be added to GUI, a bit tricky because of Windows/Linux versions

    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
  • Jan Rheinlaender

    • status: open --> pending
    • assigned_to: Jan Rheinlaender
    • Group: Next_Release --> Future_release
     

Anonymous
Anonymous

Add attachments
Cancel