- #1
haitrungdo82
- 23
- 0
Homework Statement
I don't know how to limit the array. I know that the program crashed because it exceeds the array end points at zero and maximum position and time. But how can I tell MathCAD not to do so? I'm stuck without any idea! Can anyone who can show me the code lines I should include. Thank you very much!
Homework Equations
The Attempt at a Solution
The following is what I have achieved so far. I would really appreciate any input from you! Thank you very much!
Δt := 1 min
Δx := 5 m
v := 16.09 km/h
D := 0.17*10^-4 m^2/min
t := 0 ... 1999
x := 1 ... 3999
f_t,x := 1
f_t+1,x := f_t,x - (v*Δt/2)*(f_t,x+1 - f_t,x-1) + [D*Δt/(Δx)^2]*(f_t,x-1 - 2*f_t,x
+ f_t,x+1)
Then it crashed! Can anyone help me, please?