Skip to content
Advertisement

Tag: sympy

Convert list of strings SymPy to symbols and use in solveset

The post “How can I convert a list of strings into sympy variables?” discusses how to generate SymPy symbols from a list of strings. My question is what steps are needed to use these symbols x, y and z in SymPy calculations? I tried something along the lines but I get the error “NameError: name ‘x’ is not defined”. Any

How to solve the ‘mul objective has no attribute ‘cos’ ‘

How to solve the multi object problem? If I input 2, the expected result should be 2*cos(2*x). Answer Your code contains a few misconceptions. One problem is an important general programming rule: try to use different variable names for variables with different meanings. So, x shouldn’t be assigned a float, as it was a symbolic variable before. And derivative_f being

Displaying sympy equations on matplot

Now I want to display the sympy equation “eq” on the plot. I have seen many methods to display the same equation using tex commands, but I specifically want to display the sympy eq. Thanks in advance Answer You could use sympy’s latex() function like this:

symbolic complex expression simplification

Although my question is related to a specific problem, I would like to approach it in more general terms. I would like to simplify a fractional complex expression obtained by multiplying symbolic matrices using the sympy package. What I get is a fraction with real parameters and many complex exponential terms (phase terms) like exp(-jd), exp(-2jd) and also exp(-4j*d). I

Is it possible to assign a symbol of partial derivative via symbols() in SymPy?

I would like to symbolically represent one of variables as a partial derivative like: dF_dx = symbols(‘dF/dx’) so that display(dF_dx) would show it as: Is there a way to do it? The official reference is not very clear to a newbie. Thank you. Answer _print_Derivative currently decides based on requires_partial if it’s going to use the rounded d symbol or

How to use sympy to algebraically solve a two sided equation

I’d like to use sympy to solve he following equation in terms of x, g, and w. Here’s what I thought I should code But this seems to be trying to solve for a numerical answer. Answer You can create a 2-sided equation with Eq: When you say that you want to solve “in terms of x, g and w”

Advertisement