# Demo entry 6351071

**blabla**

Submitted by **anonymous**
on Mar 16, 2017 at 14:36

Language: Python 3. Code size: 561 Bytes.

import numpy from matplotlib import pyplot import time, sys nx = 41 # try changing this number from 41 to 81 and Run All ... what happens? dx = 2 / (nx-1) nt = 25 #nt is the number of timesteps we want to calculate dt = .025 #dt is the amount of time each timestep covers (delta t) c = 1 #assume wavespeed of c = 1 u = numpy.ones(nx) #numpy function ones() u[int(.5 / dx):int(1 / dx + 1)] = 2 #setting u = 2 between 0.5 and 1 as per our I.C.s print(u) pyplot.plot(numpy.linspace(0, 2, nx), u);

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.