You are correct, ** is a whole different thing, I forgot to point out that
the parses was doing the python thing, but it should have not. So, all in
all

** is mis-interpreted
*^ is mis-interpreted
^^ is mis-interpreted

I think the parser should first look for  "forms" and notation, i.e. start
with ** and deal with it, then substitute  *^ -> "e", then ^^ -> dunno what
makes that in sympy , then finally ^ -> **.
No idea if regexp is a good way to do that without surprises

On Fri, Oct 16, 2020 at 7:22 AM S.Y. Lee <[email protected]> wrote:

> **, *^ are not valid Mathematica syntax for powers.
> ** is noncommutative multiplication
> https://reference.wolfram.com/language/ref/NonCommutativeMultiply.html
> and *^ is scientific notation
> https://reference.wolfram.com/language/guide/Syntax.html
> Also ^^ is the  nnnn expressed in b-base
>
> So the reason that ** had possibly worked before was that although it is
> not parsed correctly in Mathematica parser,
> it somewhat got parsed in sympify as a valid python syntax and I think
> that it is completely wrong to parse it as power.
>
> Actually, they are rarely used syntax for Mathematica that I didn't know
> that they existed,
> and especially *^ and ^^ are much more limited that it only works with
> restricted classes of digits, with no symbolic capability,
> and you can achieve the same thing with other Mathematica functions like
> FromDigits.
> For example, the bases for ^^ is restricted only for 2~36 because after it
> exceeds 37, you will exhaust every digits 0~9 and English alphabets A~Z,
> so if we are going to build parser for that, it must be considered.
>
>
> On Tuesday, October 13, 2020 at 12:23:31 AM UTC+9 [email protected] wrote:
>
>> It's probably not supported, but it could be added. The Mathematica
>> parser is still relatively rudimentary, so a lot of syntax features of
>> Mathematica aren't supported.
>>
>> Aaron Meurer
>>
>> On Mon, Oct 12, 2020 at 9:04 AM Roberto <[email protected]> wrote:
>> >
>> > from sympy.parsing.mathematica import mathematica
>> >
>> > Power with ** works
>> > _mma = mathematica('3**2', {})
>> > also the ^ works
>> > _mma = mathematica('3^2', {})
>> > but there seems to be a problem with *^ notation
>> > _mma = mathematica('3*^2', {})
>> > as ^ is parsed as **, without checking ahead if there is any "*^"
>> > SympifyError: Sympify of expression 'could not parse '3***2'' failed,
>> because of exception being raised: SyntaxError: invalid syntax (<string>,
>> line 1)
>> >
>> > Am I misusing the parser?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "sympy" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to [email protected].
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/d21ef284-37bb-4f4f-93c1-16efbcc24aadn%40googlegroups.com.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/6f0a5492-3e2b-4e24-8a38-737e17944953n%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/6f0a5492-3e2b-4e24-8a38-737e17944953n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAJxM9JqAiY0we%3Dy7BQxoQ4eFwDVNsuVE_22u-H55iAK%3DHryZsg%40mail.gmail.com.

Reply via email to