-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
any possibility of using "chaospy.poly.base.Poly" object as python symbolic expression #48
Comments
Interesting usecase. I have support for this unexposed in the API, and it isn't complicated to expose it to accommodate your need. I just pushed a commit to the
|
Also note, if the plan is to parse the coefficients or extract components, there are functions for that too:
|
Thanks Jonathan, It's exactly what I want and works great! Yeah, I agree
it's an API issue based on the following experiment:
>> a = cp.variable()
>> expr = 12*a+a**2
>> print expr
q0^2+12q0
>>cp.poly.base.POWER = "**"
>>cp.poly.base.SEP = "*"
>>print expr
q0**2+12*q0
Thank you again for the quick reply!
Chen
…On Wed, May 31, 2017 at 6:54 AM, Jonathan Feinberg ***@***.*** > wrote:
Also note, if the plan is to parse the coefficients or extract components,
there are functions for that too:
print(cp.decompose(orth))
# [0.986666666667, -2.0*q0, q0**2]
print(orth.coeffs())
# [ 0.98666667 -2. 1. ]
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#48 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AWCYACUJF4dy04uQdCPAzByUcBrN0Zc7ks5r_VUIgaJpZM4NrEwJ>
.
--
Chen CHEN
Graduate Student in ICES&EM
POB 3.402J
The University of Texas at Austin
Phone: +1 512-968-2126
Email : [email protected]
|
I consider this issue as solved. Feel free to reopen if you feel this is not the case. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Jonathan,
First, thank you for this nice package, it's light and helpful! I am currently exploring it with fun!
My question is about using "chaospy.poly.base.Poly" object as python symbolic expression. Is that possible? Since we can do the following:
I can change the result to a string by doing str(orthpol[3]), which is convenient for further symbolic integration. However, the expression presented above is not a valid python expression. So is there any possibility that I can make use of the orthogonalized polynomials freely generated by chaospy? and how?
Thank you in advance for your time and consideration!
Cheers,
Chen
The text was updated successfully, but these errors were encountered: