The Line of Best Fit helps us find the best fitting line for a set of points(x,y). In experiments, where x and y have a linear relationship, this can help us draw more accurate results. Let us how to create a line of best fit from the given data.
How to Interpolate a Function at a Point using Lagrange Polynomials
The Lagrange polynomials are used to find the value of a function at a point when we know its values at some other points. Let us see how to interpolate a function at a point this way.
How to Solve a System of Linear Equations using the Gauss-Seidal Method
The Gauss-Seidal Method is another iterative method used to solve a system of linear equations. It is also known as the method of successive displacement.It converges only if the matrix is strictly diagonally dominant or symmetric and positive definite. Let us see how to use this method to solve linear equations.
How to Solve a System of Linear Equations of n Variables using the Gauss Elimination Method
Gaussian Elimination is an algorithm to solve a system of linear equations of n variables. It uses elementary operations to find the solution to the system of linear equations. It is an efficient method to find the determinant and inverse of a matrix as well. In this program, we will learn how to solve a system of equations using this method. We will also learn how to calculate the determinant of the n x n matrix used in the process.
How to Find the Definite Integral of a Function Using the Trapezoidal Rule
The trapezoidal rule is one of the easiest ways to find a definite integral. It belongs to the class of formulas called Newton-Cotes formulas which evaluate the integrand at equally spaced points. The trapezoidal rule is extremely accurate for periodic functions when they are integrated over their periods. Let us see how to evaluate a definite integral using the trapezoidal rule.
How to Use the Arithmetic Assignment Statement
There are different types of assignment statements in Fortran. The arithmetic assignment statement gets confusing especially when you see statements such as i=i+1. Let us see how to use this statement correctly.
How to Find the Product of Two 3x3 Matrices
Fortran has an inbuilt function to calculate the matrix product of two matrices. This function is MATMUL( MatrixA,MatrixB). In this post, we will study the simple logic behind how this works. For simplicity, we choose two square matrices of order 3, so that we do not have to bother about whether the multiplication is feasible. Let us see how this works.
How to Convert Decimal Numbers to Binary
In the previous program, we learned how to convert a binary number to decimal. Now, let us learn how to convert decimal to binary. Here is how it works.
What exactly does IMPLICIT NONE mean?
We are taught to use IMPLICIT NONE in our programs. But, how does it help? Let's find out.
How to Calculate Binomial Coefficients, nCr
We used a simple function to calculate nCr in an earlier program to display Pascal's Triangle. It shows the values of binomial coefficients upto n=12. We then used a more efficient algorithm to display Pascal's Triangle. Let us now use a more efficient program to find single binomial coefficients. Here is how we can do this.
How to Generate Pascal's Triangle (upto n=33) using a Simple Pattern
Algorithm for Pascal's Triangle. (Explained below) |
How to Generate Pascal's Triangle (Basic Method)
There are easier and more efficient ways to create Pascal's Triangle based on the fabulous properties of the numbers in the triangle. But, today we are going to build a triangle from the basic definition. This may only work for a small number of rows, n (12?), but it helps understand some basic properties of the triangle. And you do not have to remember much else to create it. Let us see how this is done.
How to Calculate the Taylor Series Approximation for the Cosine Function
Taylor Expansion for the Cosine Function upto the first five terms. Notice that the terms have even powers as cos itself is odd. |
How to Calculate the Taylor Series Approximation for the Sine Function
Taylor Expansion for the Sine Function upto the first five terms. All powers are odd as the sine function is odd. |
The Taylor series approximation gives the value of the function based a finite number of terms from an infinite series. The infinite number of terms that add up to the function are obtained from the derivatives of the function at a single point. At x=0, these terms give the Maclaurin series for the function. Let us see how to calculate the value of the commonly used function sin(x) using Taylor Approximation.
How to Find a Root of a Polynomial using Newton Raphson Method
Newton-Raphson Method of finding roots of a polynomial is a Householder Method of order 1.Householder's Methods are used to find roots for functions of one real variable with continuous derivatives up to some order. Here is how this works for order 1.
How to Find the First n Prime Numbers
A simple method to find a prime number is to test the divisibility of the number by all numbers that come before it. However, this is a tedious process. To make it faster, we must eliminate numbers with which we do not need to check the divisibility. We also need to eliminate even numbers after 2, which are not prime for sure. Let us see how to find primes easily.
How to Find Roots of a Continuous Function using the Bisection Method
The bisection method is useful when you want to find a root of a continuous function in a specified range. It works on the Intermediate Value Theorem which says that if a continuous function changes sign over an interval, there is at least one root of the function in that interval. Here is how to find a root using this method.
How to find the GCD of A Set of Numbers
To find the GCD of numbers using Euclid's algorithm is very easy. Let us discuss this algorithm first.
Simply put, when we have two numbers x and y, the larger one(y1) is either divisible by the smaller one(x1) or it isn't (More often than not).
Simply put, when we have two numbers x and y, the larger one(y1) is either divisible by the smaller one(x1) or it isn't (More often than not).
If y|x,
then gcd (x, y) = x.
How to Arrange Numbers in a Descending Order
Arranging numbers in an ascending or descending order is a really simple task. You can use them to create a list of top and bottom scorers. All you have to do is remember a few small tricks. Take a look.
How to Build a Magic Square of Odd Order
Building a magic square of odd order is easier than building one of even order. This is because singly even (4n+2) order and doubly even(4n) order magic squares work differently. To build a magic square of odd order, follow the following steps.
How to Build a 4x4 Magic Square
A 4x4 Magic Square is the first magic square of even order as a 2x2 magic square is not possible. This magic square can be made simply by flipping both the diagonals.
- First off, we need to assign the order 4 to the magic square and set a number as the value of the smallest element of the magic square. Of course, we can always begin with 1, but it's not all that difficult to set another value.
Subscribe to:
Posts (Atom)