I'd say this is a bug.

Aaron Meurer

On Thu, Oct 10, 2013 at 2:58 PM, Duane Nykamp <[email protected]> wrote:
> I'm using parse_expr to parse student input to online quizzes.  Since I want
> them to be able to type in an answer as "xe^x" for x*exp(x) I have tried to
> do the following transformations.
>
> transformations=standard_transformations+(convert_xor, split_symbols,
> implicit_multiplication)
>
> The result is:
>
> In [57]: parse_expr("xe^x", local_dict={'e': E},
> transformations=transformations)
> Out[57]: e**x*x
>
> which means, the e was not mapped to E, as it should.  If one makes the
> multiplication explicit, and does not rely on split_symbols, then it works
> correctly.
>
> In [58]: parse_expr("x*e^x", local_dict={'e': E},
> transformations=transformations)
> Out[58]: x*exp(x)
>
> The function
> def _split_symbols(tokens, local_dict, global_dict)
> completely ignores local_dict and global_dict.  Should somehow
> _split_symbols call auto_symbol on the new tokens it created?
>
> Is there any way to get "xe^x" parsed as x*exp(x)?  I suppose I could just
> add a replace(Symbol('e'),E) after processing.
>
> Duane
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to