To find a basic introduction of GA, the first part can be found here. III. Examples using Genetics Algorithm In these examples, we will use Matlab and its function ga to apply GA for the optimization problem. For the manual of using this function, you can find it at https://www.mathworks.com/help/gads/ga.html or type in Matlab: help ga... Continue Reading →

# Introduction to Genetics Algorithm (GA) (Part 1)

I. Introduction In daily life as well as in doing research, we might come to problems that require a lowest/highest value of variables, e.g.: find the shortest way from home to work, buying household items with a fixed amount of money, etc. These problems could be called "optimization" and today we will introduce an algorithm to... Continue Reading →

# Best-fit quadratic surface from given points in 3D using Matlab

In Earth Science research, sometimes we need to construct 3D surfaces from given points, for example: creating the fault surface, locating a subducting slab from earthquake hypocenters, etc. in a region of interest in X-Y plane. In this example, we will show how to create a best-fit quadratic surface from given points in 3D using... Continue Reading →

# Simple 1D velocity model inversion from P arrival time

Refer to Chapter 5, Introduction to Seismology, Shearer 2009. Problem: From the P-wave travel time data below (note that the reduction velocity of 8km/s), inverse for the 1D velocity model using T(X) curve fitting (fit the T(X) curve with lines, then invert for the ray parameter p and delay time τ(p), then solve for the velocity... Continue Reading →

# Ray tracing through a 1-D velocity model

Refer to Chapter 4 of Shearer, Introduction to Seismology. For a ray piercing through Earth, the ray parameter (or horizontal slowness) p is defined by several expressions: where u = 1/v is the slowness, θ is the ray incidence angle, T is the travel time, X is the horizontal range and utp is the slowness at the... Continue Reading →

# Modeling a wave on a string using finite differences

Based on problem 3.7 chapter 3 of Introduction to Seismology (Shearer) (COMPUTER) In the case of plane-wave propagation in the x direction within a uniform medium, the homogeneous momentum equation (3.9) for shear waves can be expressed as ,where u is the displacement. Write a computer program that uses finite differences to solve this equation... Continue Reading →

# Introduction to Python Part II

I. Type of objects in Python: In Python, every object has its own class - or type of data. The in-depth tutorial can be found on the web, for example, https://jeffknupp.com/blog/2014/06/18/improve-your-python-python-classes-and-object-oriented-programming/. In this tutorial, I will introduce some basic type in Python. To check type of a variable, data, you can use function type(variable) +... Continue Reading →

# Introduction to Python (Part I)

Python is a high-level, general-purpose, interpreted programming language. It can be used to do some different purpose: from managing large data, simple to complex calculations to very specific objectives by using the pre-written packages. There are 2 most common used versions of Python: Python 2 (current version is 2.7) and Python 3 (current version is 3.5).... Continue Reading →

# Tool to download large HTML file

Sometimes when you need to download catalog data using a web browser (Chrome, Firefox, etc.), it will take some time and might cause crash or lag. Here is some ways to do it: I. Using wget + Install if you do not have in terminal: yum install wget or sudo apt-get install wget + Basic commands: wget --output-document=... Continue Reading →