If you find any nice and cool resume builder's or templates, feel free to add here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Getting started: | |
# Python3 installation: python -m pip install --upgrade --user ortools | |
# | |
# Optimisation with the OR tool can be done in 5 steps: | |
# Creating a solver | |
# Creating a variable (x, y, … etc.) | |
# Creating linear constraints | |
# Creating an objective function | |
# Run the solver | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bisection method which is also known as bolzano method is based on the repeated application of intermediate value property. | |
# Let the function f(x) be continous between a and b. For definiteness, let f(a) be (-)ve and f(b) be (+)ve. Then the first approximation to the root is x1 = (a+b)/2. | |
# If f(x1)=0, then x1 is a root of f(x) = 0, otherwise, the root lies between a | |
# and x1 or x1 and baccording to f(x1) is (+)ve or (-)ve. Then we bisect the | |
# interval as before and continue the process until the root is found to the desird accuracy. | |
#!/usr/bin/python3.6 | |
def f(x): | |
fx = 3*x**2-15*x+7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********* Bisection method which is also known as bolzano method is based on the repeated application of intermediate value property. | |
Let the function f(x) be continous between a and b. For definiteness, let f(a) be (-)ve and f(b) be (+)ve. Then the first approximation to the root is x1 = (a+b)/2. | |
If f(x1)=0, then x1 is a root of f(x) = 0, otherwise, the root lies between a | |
and x1 or x1 and baccording to f(x1) is (+)ve or (-)ve. Then we bisect the inte | |
rval as before and continue the process until the root is found to the desird ac | |
curacy. *********/ | |
/*************** PROGRAM STARTS HERE ***************/ | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.6 | |
# Chebysav method is like approimating the given Transcedental Equation into a quadratic equation f(x) = 0, f(x) ~ a0 + a1x + a2x^2 | |
# | |
# Let xk be an approximate root | |
# f'(x) = a1 + a2x | |
# f''(x) = 2a2 by subsituting the value xk in all the equations we get the values of f(xk), f'(xk), f''(xk) | |
# we get, | |
# f(x) ~ fk + (x-xk)f'_k + (x-xk)^2*f''_k/2 ==> 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******* Chebysav method is like approimating the given Transcedental Equation into a quadratic equation f(x) = 0, f(x) ~ a0 + a1x + a2x^2 | |
Let xk be an approximate root | |
f'(x) = a1 + a2x | |
f''(x) = 2a2 by subsituting the value xk in all the equations we get the values of f(xk), f'(xk), f''(xk) | |
we get, | |
f(x) ~ fk + (x-xk)f'_k + (x-xk)^2*f''_k/2 ==> 0 | |
x_(k+1) = xk - fk/f'k - (fk^2 f''_k)/2((f'_k)^3) *********/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The bisection method guarantees that the iterative process will converge. It is, | |
however, slow. Thus, attempts have been made to speed up** the bisection | |
method retaining its guaranteed convergence. A method of doing this is called | |
the method of false position. | |
It is sometimes known as the method of linear interpolation. | |
This is the oldest method for finding the real roots of a numerical equation | |
and closely resembles the bisection method. | |
In this method, we choose two points x0 and x1 such that f(x0) and f(x1) are | |
of opposite signs. Since the graph of y = f(x) crosses the X-axis between these | |
two points, a root must lie in between these points. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* In Muller, f(x) is approximated by a second degree curve in the vicinity of | |
a root. The roots of the quadratic are then assumed to be the approximations to | |
the roots of the equation f(x) = 0. | |
The method is iterative, converges almost quadratically, and can be used | |
to obtain complex roots. */ | |
/*************** PROGRAM STARTS HERE ***************/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This method is generally used to improve the result obtained by one of the | |
previous methods. Let x0 be an approximate root of f(x) = 0 and let x1 = x0 + h be | |
the correct root so that f(x1) = 0. | |
Expanding f(x0 + h) by Taylor’s series, we get | |
f(x0) + hf′(x0) + h2/2! f′′(x0) + ...... = 0 | |
Since h is small, neglecting h2 and higher powers of h, we get | |
f(x0) + hf′(x0) = 0 or h = – f(x0)/f'(x0) | |
A better approximation than x0 is therefore given by x1, where | |
x1 = x0 - f(x0)/f'(x0) | |
Successive approximations are given by x2, x3, ....... , xn + 1, where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.6 | |
# This method is generally used to improve the result obtained by one of the | |
# previous methods. Let x0 be an approximate root of f(x) = 0 and let x1 = x0 + h be | |
# the correct root so that f(x1) = 0. | |
# Expanding f(x0 + h) by Taylor’s series, we get | |
# f(x0) + hf′(x0) + h2/2! f′′(x0) + ...... = 0 | |
# Since h is small, neglecting h2 and higher powers of h, we get | |
# f(x0) + hf′(x0) = 0 or h = – f(x0)/f'(x0) | |
# A better approximation than x0 is therefore given by x1, where |
OlderNewer