When I plot y as a function of t, the values for a do not change. When I print the appended list I see they are all 0.0. Please help! I'm confused because y as a function of x plots fine. I can't include the actual code, but here is a minimum working example.
import numpy as np
from math import *
from astropy.table import Table
import matplotlib.pyplot as plt
from random import random
x = 0
y = 0
t = 0
h = 0.0100
tf = 40
N=ceil(tf/h)
tnew = t
x_list = [x]
y_list = [y]
t_list = [t]
for i in range(N):
#while y >= 0:
tnew = t + h*i
t = tnew
print(t)
#First and second derivatives
# stuff happens (can't share the code)
x_new = random()
y_new = random()
x = x_new
y = y_new
""" appends selected data for ability to plot"""
x_list.append(x)
y_list.append(y)
t_list.append(t)
#break
""" Plot1"""
plt.plot(t_list,y_list)
plt.show()
""" Plot2"""
plt.plot(x_list,y_list)
plt.show()
First plot I just get a vertical line Second plot is the way it should be
First plot:
Second plot