Skip to content
Advertisement

Tag: sympy

Python SymPy’s plotting legend when using multiple ranges

I am using SymPy’s plotting module, but legends stop working when I start having multiple lines with different ranges (to plot a function f(x) whose definition depend on x like in the following example). I actually haven’t seen any example of this anywhere : Here the legend is ignored. I also tried instead of specifying plt[0] but Python says The

Decimal logs in Sympy

I want to solve an expression in SymPy But then I try to code it like this The result isn’t correct. Answer You’ve got the result with ten digits, and not the decimal logarithm. Documentation says, In SymPy, as in Python and most programming languages, log is the natural logarithm, also known as ln. SymPy automatically provides an alias ln

ModuleNotFoundError: No module named ‘sympy’

I’m on MacOSX Mojave 10.14.6 on a MacBook Pro 2015. So I pip installed sympy, right? I head over to my shell, run python3, and do: Just to be sure, I pip installed again just to make sure. My pip list also includes sympy as sympy 1.4. What’s wrong here? Is there another setup step I’ve missed? Answer Apparently all

Expand index notation equation using sympy

Below I have an equation written using index notation. This equation can be expressed with the six equations on the figure. The first equation is expanded using index notation (einstein notation: https://en.wikipedia.org/wiki/Einstein_notation). In U_k,k the comma is a convention for derivative. Since we have repeated indices (k,k) we apply the summation convention and get (du_1/dx_1 + du_2/dx_2 + du_3/dx_3). On

How to make Polygon in SymPy from a list of vertices

I want to use SymPy to create a Polygon with n faces and calculate all parameters. The easy form is but I want to use n points from a list, for example But this form and similar is not validated. Any suggestions? Answer You could do this by putting an asterisk in front of the list of parameters to expand

Advertisement