Scientific Computing is
Scientific Computing is not
Where is Scientific Computing Used
Scientific Computing is generally used to solve problems in Mathematics and various Science fields. There are a number of important things that you need to know to solve problems effectively.
Find/develop code that runs quickly. This all depends on the problems that you are solving. If a simple program runs that solves your problem and only takes 5 seconds, it’s probably fine. If instead, it takes a few hours to run, you probably want to investigate your solution algorithm.
Find/develop code that uses an appropriate amount of memory. Another important aspect is that of memory consumption. It’s not hard to find datasets these days that are 1TB or more in size, however few desktop/laptop machines have more than 16 or 32Gb of RAM, so you can’t load the entire file into memory. Such a dataset would need to be processed in chunks.
Make sure you have known solutions/unit tests How do you know that your solution is correct? It is important to have relatively simple cases that you can test your code on before solving more complex things.
Consider a list of 5 cities that you need to visit and return to where you started. If you know the distances between each pair of cities, what is the most efficient path (in terms of distance or time) that gets you to each city and return.
Poker is a card game in which certain sets of cards (hands) beat other hands. Determine the probability (or chance) of getting any particular hand in Poker.
Given a dataset of Major League Baseball scores from 2000-2017, find the game with the largest score, most innings played, biggest winning margin, etc.
We will look at these an other problems in this course.
Look back at the list of requirements for Scientific Computing projects. A general rule of thumb is to use a computing language that you know will work well for those tasks. Typically, most students have learned one or two languages and aren’t quite sure which to use. In most cases it doesn’t matter what to use, but for complex problems it will matter.
One of the best languages for scientific computing has been Matlab over the past 3 or 4 decades. It is used extensively in engineering firms throughout the world (and the headquarters is in nearby ). We won’t be using Matlab here though. One of the nice things about taking a class is exploring new languages. Here we will use Julia, which is a very new language that a lot of people in scientific computing are excited about. We will give examples using Julia, but the ideas here should be applicable to other languages.
This is a general getting started chapter with some specifics that can be run in Julia. To get started with being able to run julia on your own computer, see getting started in julia.
To get started, we first need to discuss specifics of writing Julia code. Julia has all standard language constructs except for objects, which will be discussed later. The language features include loops, conditional statements, functions. It also has important aspects that make it helpful for scientific computing include robust array functions, complex numbers and rational and higher precision floating points numbers.
The syntax of julia is similar to that of python, although there are fundmental differences in the way julia interprets. In this an later chapters, you may notice that the syntax looks familiar, but it not a assumed any knowledge of python.
Anything can be stored as a variable using the single equal sign like x=6
. This is an assignment operator, which creates the number 6 and stores it under the name x
.
Here’s a list of the standard mathematical operations that Julia knows: +,-, * , /,^ (power) as well a large number of functions including: exp (natural exponential); log (natural log); the trig functions sin, cos, tan, csc, sec, cot; the inverse trig functions asin, acos, atan, acsc, asec, acot, and there is a listing of all mathematical functions in Julia
Entering the following