#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt plt.axes().set_aspect('equal') plt.xlabel("X values") plt.ylabel("Y values") plt.title("Differential Equation Example") plt.grid() # critical time step value Δt = 0.25 ox = x = 0 y = 1 total = 0 xvals = [] yvals = [] while ox <= 0 or x > 0: ox = x x -= y * Δt y += x * Δt total += Δt xvals += [x] yvals += [y] print(f"𝜏 = {total:.7f}") print(f"𝜋 = {total/2:.7f}") plt.plot(xvals,yvals) plt.savefig("diffeq_example1.png")