Polynomial expansion from Python to Mathematica

However, in summary, the conversation was about the Python library "chaospy" and its useful command for generating polynomial expansions for random variables. The individual was wondering if there was a way to obtain the same results in Mathematica.
  • #1
confused_engineer
39
2
Hi everybody.

In Python there is a library called chaospy. One useful command is cp.orth_ttr which generates a polynomial expansion, e. g. a series of orthogonal polynomials or orders zero, one, two... for a random variable e.g normal, uniform...

For more information see https://pypi.python.org/pypi/chaospy/2.0

I use it as shown in the attached image.

Can someone tell me if there exists a way to obtain these same results in Mathematica?https://ibb.co/dEuFQx

Edit: since it seems that the image is not working properly, I also provide a link https://ibb.co/cm2Vsc
 
Technology news on Phys.org
  • #2
Not sure what your question is. The link to the image doesn't work (as you know) -- my browser says that page doesn't exist. In your other link, your python code has an error, possibly because the matplotlib module hasn't been installed.

If your question is about Mathematica, I'm not knowledgeable to answer that question.
 

Related to Polynomial expansion from Python to Mathematica

1. What is polynomial expansion and why is it important?

Polynomial expansion is the process of multiplying out a polynomial expression to reveal all of its individual terms. It is important because it allows us to simplify and solve complex polynomial equations, which are commonly used in many fields of science and mathematics.

2. How is polynomial expansion typically done in Python?

In Python, polynomial expansion is typically done using the "expand" function from the sympy library. This function takes in a polynomial expression and expands it into its individual terms, which can then be manipulated or solved as needed.

3. How can I perform polynomial expansion in Mathematica?

In Mathematica, polynomial expansion can be done using the "Expand" function. This function takes in a polynomial expression and expands it into its individual terms, similar to the "expand" function in Python's sympy library.

4. Can I specify the variables to be expanded in Mathematica?

Yes, the "Expand" function in Mathematica allows you to specify the variables that you want to expand in the polynomial expression. This can be done by adding a list of variables as the second argument in the function, for example: Expand[expression, {x, y}].

5. Is it possible to expand a polynomial expression with complex coefficients in Mathematica?

Yes, Mathematica can handle polynomial expansion with complex coefficients. Simply input the expression with complex numbers and use the "Expand" function as usual. Mathematica will automatically expand the expression and simplify it, if possible, to include terms with real and imaginary coefficients.

Similar threads

  • Programming and Computer Science
Replies
3
Views
358
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
15
Views
2K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
29
Views
3K
  • Advanced Physics Homework Help
Replies
11
Views
2K
  • Math Proof Training and Practice
2
Replies
46
Views
5K
  • Cosmology
Replies
4
Views
2K
Back
Top