Now we compiles and we set our parameter dt, which is the time state length.

And lambda and

gamma which are the epidemic parameters which specify some sort of input argument.

And recall that this is a way of using one assignment to set three different values.

So we can set S, I, and R.

S becomes 1000, I ten, R becomes 20.

Notice that only 1000 is a float, the other two are integers.

In fact, what will happen is that Julia will convert ten and 20 to integers.

It's not the best form of programming, but Julia forgives us that, and

that's part of why it's easy and quick to write you the app code.

If we want to optimize the running of the Julia code then,

we might find in the end that, this is one of the reasons why our code is running

slower than we might wanted, right.

So, what does it do?

It gives us an output of 975,

this is susceptible as minor lambda times infected.

So, the number ten that become 10,000

then gam is one tenth that means 1000.

Okay so the function works and so we can go back to the top and

now we discuss how we look through all the times.

We want that function to run from start time to the end time and

that can't be infinite so we define an end time t final.

We will use 610 day to fit data from Wikipedia.

So what that means is that there are n steps.

Tf divided by dt, but now you've gotta watch out.

Computer arithmetic is not infinitely precise.

So if we compute n times dt, so we've defined n this way.

And now we calculate Tf as n times dt,

this should be exactly true mathematically, algebraically.

But, in a computer we cannot be sure that this is the case.

So if we wanted to, we tested this is an equality might not work exactly.

So what I would like to do instead is to use time as a variable,

and to keep explicit track of this number I.

Then I know exactly how many steps I want to take, at the end of it,

the time I reach might not be exact the Tf that I started with.

But it will be extremely close to it.

Actually, the take home message is that you should not rely on exact equality,

even if you can reasonably expect it.

Computer code that relies on exact equality is much more prone to error,

and it really requires professional programmers to use.

We know exactly how many values we are going to need,

then we can create an array to hold all of them.

If we take n steps, we need n plus one, that is of course we need a value for

T equals zero and then the values n steps on from there.

So total number of n plus one values.

So here's the concept code, now this code doesn't actually do anything.

The reason it doesn't do anything is that I only have comment lines inside the loop.

This is just to say, okay final 610 days, so

the n steps is an integer, that's why I call the round function.

And round with type integer means that it's going to round it to integer types.

So that gives me an integer number of steps.

And in the results I will hold in a variable, three columns n plus one rows.

And also a vector of times, which will just be n plus one float values.

We need to specify our initial values and our initial result values.

Right.

Now, we are ready to run the model.

So I just cut and paste this code here, initializing everything.

Set all the values we need.

We need to set lambda, we need to set gam, we need to set dt, we need to set tfinal,

we need to set S not, we need to set I not, we need to set R not.

None of these can be taken for granted.

And then we initialize.

We calculate the number of steps.

We initialize a vect.

We initialize on the right, or results and for the time vector,

we initialize this array.

So we've created the array here and then we initialize its first row.

We're not going to compute this row.

We're also not going to compute this time.

Having done that, we can now just take n steps,

now if we want to take a step so we have one.

The next value is going to go to two.

And then if the step is two the next value goes to three and

in the end we end up with the n plus one steps that we put in our array.