I am trying to do mathematical limits in python.
I have defined a function for smoke
import turtle
t = turtle.Pen()
def drawsmoke(y):
i = 0
while i < ((2 * y) - 1):
t.seth(i * 5)
t.circle((10 + i), 160)
i = i + 2
this draws one side of the smoke, the other side yet to be done.
now the problem arises when i try to draw about 4 smoke circles(y=4) that the smoke starts turning the wrong way. to fix this, i considered doing a mathematical limit. I would make a variable
smkang=(i*5)
and then do a limit on this variable:
lim
smkang->20
how may i do this? or is there another way not involving limits? btw this is in turtle (python language but turtle imported) thanks
use sympy. SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python and does not require any external libraries. Ex:
>>> from sympy import limit, Symbol, sin, oo
>>> x = Symbol("x")
>>> limit(sin(x)/x, x, 0)
1