Double asterisk
I am new to Python and am actually confused. I am reading a book and the code is working fine; I just do not understand!
T[i+1] = m*v[i+1]Ė**/L
What's with the double asterisk part of this code? It was even accompanied by a forward slash. The L variable is initialized to 1.0. However, it looks like someone fell on the keyboard, but the code works fine. Is it a mathematical expression or something else? I would be grateful for your understanding. Thank you!
full code:
from pylab import *
g = 9.8 # m/sĖ2
dt = 0.01 # s
time = 10.0 # s
v0 = 2.0 # s
D = 0.05 #
L = 1.0 # m
m = 0.5 # kg
# Numerical initialization
n = int(round(time/dt))
t = zeros(n,float)
s = zeros(n,float)
v = zeros(n,float)
T = zeros(n,float)
# Initial conditions
v[0] = v0
s[0] = 0.0
# Simulation loop
i = 0
while (i<n AND T[i]>=0.0):
t[i+1] = t[i] + dt
a = -D/m*v[i]*abs(v[i])-g*sin(s[i]/L)
v[i+1] = v[i] + a*dt
s[i+1] = s[i] + v[i+1]*dt
T[i+1] = m*v[i+1]Ė**/L + m*g*cos(s[i+1]/L)
i = i + 1
source to share
What about the double asterisk in this code?
The answer to your main questions (at least since it exists in this letter) is a double asterisk (star) - this is power - "to raise to power". Thus, there i**3
will be "cube i
".
My (cross control) source: fooobar.com/questions/109188 / ...
source to share