Skip to content

Tag: sympy

How to Plot Implicit Equation in Python

I want to Plot V(y axis) vs t(x axis) graph using the below equation at 5 different values of L(shown below) L= [5,10,15,20,25] b=0.0032 Equation, (b*V*0.277*t) – (b*L) = log(1+b*V*0.277*t) code output will be as shown in figure Expected Outcome Answer While sympy exposes the plot_implicit function, the…

How to Make Coordinates on Sympy Cartesian Graph

I’ve browsed everywhere but there is no answer that can be used as a reference for making coordinates on a sympy python Cartesian graph. Here and here I’ve studied but still can’t solve the problem I found in my code. I want a = 1 and b = 3 to be connected to the x and y axes. Any help

Summation of a product of a function and a vector in Sympy

I want to use the following expression in sympy. For example I tried this sympy code, but an error has occurred. How can I manage this? (How to use Symbol’s value as an index of Matrix?) Answer You can use symbolic indices with a matrix but you need to use double indices:

Solving for an unknown variable in python

I’m currently trying to create a body mass index calculator that gives you your BMI and then calculates the difference in weight needed to be at a healthy weight. The equation I’m using to find the BMI is: Using sympy, I’m trying to find how many pounds need to be gained or lost to be within…

How to pass args to sympy.lambdify

This is a more precise version of this question where the comments said my minimal reproducible code was too minimal, so with more information: I want to evaluate an Expression without having to pass the symbols along separately. My current workaround is this: This works. My problem is that expr.free_symbols …

solving single variable two sided equation in sympy

Can anyone advise on why the below code using Sympy would error with ‘Add’ object is not callable? I am trying to solve a simple single variable linear expression. It can be solved by hand and Wolfram Alpha gives a solution for ‘y’. Not sure how else to input it into Sympy. I might be …

Substitute the variables of a polynomial with caracas (Sympy)

I have a long polynomial in four variables x, y, z, w: I’m working with R. I want to use the caracas package (a wrapper of Sympy) to get this expression as a polynomial after doing a change of variables. Namely, I want to substitue x, y, z and w by respectively. I tried subs with no luck. Here is