I answered on StackOverflow. You can pass in custom functions as the
second argument to sympify().
Aaron Meurer
On Thu, Apr 4, 2019 at 10:47 AM Xuemei Gu wrote:
>
> Thank you very much, I tried this, but it doesn't work. It only give the
> output but the the functions (LI, OAMHolo) are not
Thank you very much, I tried this, but it doesn't work. It only give the
output but the the functions (LI, OAMHolo) are not executed.
For simple example
stringA='3+4'
S(stringA)
It will give you the results 7. It's correct but in my case these
functions don't work.
I made a question in
You can do it like this:
In [7]: setupstr='LI(OAMHolo(OAMHolo(XX,e,6),f,2),a,f)'
In [8]: from sympy import S
In [9]: S(setupstr)
Out[9]: LI(OAMHolo(OAMHolo(XX, e, 6), f, 2), a, f)
On Thu, 4 Apr 2019 at 15:41, Xuemei Gu wrote:
>
> Thank you very much!
>
> I have another question:
>
> I get a
Thank you very much!
I have another question:
I get a string list such as setupstr='LI(OAMHolo(OAMHolo(XX,e,6),f,2),a,f)'
however in the string, LI OAMHolo are own defined functions, I don't know
how to replace them as functions.
I want to know how to do in sympy like I use ToExpression in
I was hoping something like collect(x*y + x, [x, y], evaluate=False)
would do what you want, but it doesn't quite.
You could create a Poly with the coefficients as variables and use
Poly.as_coefficients_dict.
Aaron Meurer
On Mon, Apr 1, 2019 at 1:02 PM Xuemei Gu wrote:
>
>
> hey,
>
> I wander
hey,
I wander whether one has occurred such problem:
I define a initial state:
state=a[1]*b[0]*c[0]*d[0]*1j+a[1]*b[0]*c[0]*d[0] + a[2]*b[1]*c[1]*d[1]
# for some reason I have to do such decomposition
datalist=state.as_coefficients_dict()
I can get:
{