# Introduction

Introduction to Computing for Scientists

# 1. Objectives

• To introduce Computational Science, the primary focus of this course.
• To introduce Data Science, which is related to Computational Science.

# 2. Motivation

• This course is designed to be a first course in computing for scientists.

# 3. Notes

## 3.1. Why Computing For Scientists?

• Using computation to solve science problems is as important as
• Using math to solve science problems
• Using a microscope or a telescope to solve science problems

Important: "Computers are used to generate insight, not just numbers"

(The quote appears in Section 1.1 of a book by Hamming)

## 3.2. What is Computing for Scientists?

 Computing allows us to Balance checkbooks Play chess with a computer Process orders at amazon.com Compute digits in pi quickly Scientific Computing allows us to Predict the effect of an earthquake Predict the spread of a disease Test hypotheses on the cause of global climate change Understand the cause of solar storms and aurora Understand how the universe was formed

## 3.3. Computational Science

Solving a Computational Science problem requires

1. A Scientific Model (A description of the system)
2. A Mathematical Model (A translation of the description to a set of mathematical equations)
3. Computation (Solving the mathematical equations with a computer)
4. Science Analysis and Interpretation

## 3.4. Relationship to Other Fields

Computational Science

## 3.5. Relationship to Other Fields

 Typical questions asked in each discipline: Applied Mathematics and Numerical Methods: How do I solve the quadratic formula efficiently? Computer Science: Can a given problem be solved numerically in a reasonable amount of time? For example, I can use a computer to verify that x = 1.61803399 is a solution to the quadratic formula x2-x+1? Can I write a computer program to compute that solution automatically? Science discipline: Can I use a computer to given me insight into how galaxies form? How diseases spread?

## 3.6. Relationship to Other Fields

Data Science (some coverage in this course, in particular visualization)

## 3.7. Relationship to Other Fields

 Typical questions asked in each discipline: Statistics and visualization: How can I reduce and summarize data in order to draw inferences? Machine learning and classification and databases: Can I create an algorithm that automatically detects tumors in x-ray images of patients? Science discipline: Given measurements of an Earthquake, can I determine the epicenter? Given measurements of Earth's magnetic field, can I infer the structure and shape of electric current systems in the upper atmosphere and what plasma processes were active?

## 3.8. Science Models

Recall that solving a Computational Science problem requires

1. A Scientific Model (A description of the system)
2. A Mathematical Model (A translation of the description to a set of mathematical equations)
3. Computation (Solving the mathematical equations with a computer)
4. Science Analysis and Interpretation

In the following slides, two models are described: the population model and the harmonic oscillator model.

## 3.9. Population Model

• We will use this model, or variations of it, many times in this course
• To predict the future population, we can make very complex measurements (survey everyone and ask about their plans for reproduction next year, to start) or just use the science model:
Change in population from this year to the next is proportional to number of people this year.
• The mathematical model of the above is
Change in population        = aP(this year)
P(next year) - P(this year) = aP(this year)


## 3.10. Population Model Question

A fundamental technique that we will use in this course is iteration. In this example, you will do iteration without a computer. Given the mathematical model,

Change in population        = aP(this year)
P(next year) - P(this year) = aP(this year)


what is the population two years from now if the population this year is 5 billion and a = 0.1/year, ? Either calculate the answer or state in words how you would do it.

## 3.11. Harmonic Oscillator Model

• Many problems in engineering can be solved with this model science model:
The force by which an object (such as a spring, certain molecules, stack of paper) pushes back when compressed is proportional to how far the object is compressed.

The mathematical model of this is (k is a number called the "spring constant")

Force pushing back = k·(how far spring is compressed)


## 3.12. Examples of Scientific Computing

Recall that doing Computational Science requires

1. A Scientific Model (A description of the system)
2. A Mathematical Model (A translation of the description to a set of mathematical equations)
3. Computation (Solving the mathematical equations with a computer)
4. Science Analysis and Interpretation

Two models have been discussed: The population model and the harmonic oscillator model. Both the science model and the mathematical model were discussed.

To "do science", we need to do computation and science analysis. Two examples of the four steps of scientific computing are given in the following slides.

1. The first example is a model of population for rabbits and wolves. It uses a mathematical model that has components that are similar to the population model.
2. The second example is related to galaxy collisions. In this example, the formation of galaxies is studied using Newton's law of gravity.

## 3.13. Example I of Scientific Computing

The predator-prey problem

From www.globalchange.umich.edu on June 23 2017 00:10:37.

## 3.14. Example I: Science Model

 From www.globalchange.umich.edu on June 23 2017 00:10:37. Assume a closed system (Rabbits and Foxes on an island, for example). Assume the change in number of rabbits per year increases in proportion to the number of rabbits (breeding like rabbits!), decreases in proportion to (the number of rabbits) x (number of foxes), and Does not depend on rabbits dying of natural death Assume that the change in number of foxes per year decreases in proportion to the number of foxes (more competition for food), and increases in proportion to (the number of rabbits) x (the number of foxes).

## 3.15. Example I: Mathematical Model

The science model can be written in terms of equations that can be solved using a computer. The mathematical model of the science description stated previously is [6]

ΔR = a·R - b·R·F

ΔF = e·b·R·F - c·F

Where

• R = Number of Rabbits
• F = Number of Foxes
• ΔR = Change in population of rabbits from this year to the next year
• ΔF = Change in population of foxes from this year to the next year

and a, c, b, and e are numbers such as (1.2, 0.5, etc.) and have meaning of

• a is the natural growth rate of rabbits in the absence of predation,
• c is the natural death rate of foxes in the absence of food (rabbits),
• b is the death rate per encounter of rabbits due to predation,
• e is the efficiency of turning predated rabbits into foxes.

## 3.16. Example I: Computation

The very first computation is for

• ΔR = Change in population of rabbits from this year to the next year
• ΔF = Change in population of foxes from this year to the next year

If initially the population was R = 100, F = 10 and you assumed a = 0.1, b = 0.1, c = 0.1, e = 0.1, you would then compute the change in population from year one to year two by plugging in values into the mathematical model equations

ΔR = aR - bRF = 0.1·100 - 0.1·10·100 = -90

ΔF = ebRF - cF = 0.1·0.1·100·10 - 0.1·10 = 9

## 3.17. Example I: Science Analysis and Interpretation

Given the results of the simulation, the next steps include answering the following questions:

• What parts of the model are most important? If you leave out parts of the equations, do you get the same answer?
• If one parameter is changed slightly, does the solution change drastically?
• What features of actual measurement do the model explain? What features cannot be explained?
From www.globalchange.umich.edu on June 23 2017 00:10:37.

## 3.18. Example II of Scientific Computing

Galaxy Collisions

From science.nationalgeographic.com on July 02 2018 19:36:19.

## 3.19. Example II: Science Model

• An initial configuration of galaxy particles (initial positions and velocities)
• Newton's law of gravity

## 3.20. Example II: Mathematical Model

$F_{m_1 \mbox{ on } m_2} = \frac{Gm_1m_2}{(\mbox{distance between } m_1 \mbox{ and } m_2)^2}$

$\frac{}{}F_{m_1 \mbox{ on } m_2} = -F_{m_2 \mbox{ on } m_1}$

$\frac{}{}F_{\mbox{Total on } m_1} = m_1a_1$

## 3.21. Example II: Computation

Need to do this calculation for every combination of mass 1 and mass 2!

## 3.22. Example II: Science Analysis and Interpretation

 Given the results of the simulation, the next steps include (see also [8]) answering the following questions: Do simulations explain telescope observations? How important is the initial configuration of galaxies on the final configuration? Does the solution depend on how many objects are used (simulations use far fewer than the actual number so that computations finish before the end of the universe). From science.nationalgeographic.com on July 02 2018 19:36:19.

# 4. Questions

## 4.1. Computational Science

Give an example of computational science applied to an scientific discipline. What is the science model that was applied? What was the mathematical model?

## 4.2. Data Science

Give an example of data science applied to an scientific discipline. What data were used? What analysis was performed?

## 4.3. Relationship between Data and Computational Sciences

What is the primary relationship between Data Sciences and Computational Sciences?

## 4.4. Data Science and Computational Science

Give an example of a science problem that is addressed using aspects of both Data Science and Computational Science.

# 5. References

• Simulations related to the predator-prey model using NetLogo [9].
• Galaxy collision simulation using a web browser [10].
• Chapter 1 titled "What is Computational Science" from online resource "Computational Science: Tools for a Changing World" [11].