This is a very simple method to find prime numbers. I use a mathematical function to find non prime numbers. Thus I have compared its efficiency with a code found on Matlab Central, Written by John D'Errico.
This function will compute the great circle distance between two points on a sphere of uniform radius using the Vincenty formula. At minimum, four inputs are required: lat1, long1, lat2, long2. Optionally, a fifth parameter (r) can be specified....
Computes the shortest distance between two line segments given start and end points for each. Adapts the algorithm found on Dan Sunday's website (http://softsurfer.com/Archive/algorithm_01...ment_to_Segment ).
Usage: Input the...
This function computes the minimum euclidean distance between two polygons P1 & P2.
- for vertex-vertex case
This routine will shade the area of a 2-D plot between two user defined vectors. Simply pass the two vectors, and their corresponding horizontal coordinates, select your fill color and transparency level and viola! You have a figure that is...
Basic examples of using trapz and quad to evaluate the integral of two simple known functions between defined limits.
A for loop is used to loop over the upper limits of integration. The results are compared to show the greater...
Vincenty published an algorithm for calculating the distance between two latitudes and longitudes and another to find the destination latitude and longitude, given the start coordinate, bearing and distance
Whiz is a database diff utility which will be useful to find difference between two MS-SQL Server databases. It also able to generate SQL script to update the changes from one database to another database.
This script calculates distance between two US zip codes. Included sub-routines can be used to calculate any distance between latitude and longitude coordinates. The calculation accounts for the fact that the earth is not a perfect sphere.
Amicable numbers are two different numbers so related that the sum of the proper divisors of the one is equal to the other, one being considered as a proper divisor but not the number itself. Such a pair is (220, 284); for the proper divisors of...
This calculates the midpoint between two GPS coordinates along the Earth's surface. Based on formula from http://www.movable-type.co.uk/scripts/latlong.html
This function takes a range in form of "a-b" and generate a list of numbers between a and b inclusive. Also accepts comma separated ranges like "a-b,c-d,f" will build a list which will include numbers from a to b, a to d...
A simple little task, how to find the intersection of two hashes. There's probably many ways to do this but there is one way to avoid...
[FDOUT, FREQ_AXIS] = FDCORR(A,B,FRANGE) FDCORR Joint frequency and delay correlation Performs an efficient circular cross correlation between two vectors over all possible frequency offsets (Dopplers) between -pi and pi where 2pi is the...
RADIATION HEAT TRANSFER- SHAPE FACTOR CALCULATION (MECHANICAL ENGINEERING)
The file, sfactor.m ; (example) xxx = sfactor(a). calculates shape factor between two flat surfaces with arbitrary orientation and location.
This program implements the tSL between two probability density functions following the references: Baba C. Vemuri, Meizhu Liu, Shun-Ichi Amari and Frank Nielsen, Total Bregman Divergence and its Applications to DTI Analysis,
tKL between two multivariate normal probability density functions. This program implements the tKL between two multivariate normal probability density functions following the references: Baba C. Vemuri, Meizhu Liu, Shun-Ichi...
This program will generate the coordinates of a 3D Bresenham's raster line between two given points.
A very useful application of this algorithm can be found in the implementation of Fischer's Bresenham interpolation method in my...
Learn how to calculate the difference between two dates in JavaScript, and in the process, derive some useful applications such as counting down to a particular event, counting up, displaying what's new on your page etc.
This is a game between two players, each taking turns to place one Uranium 235 atom in a grid. Any atom that has three (3) or more atoms adjacent to it immediately goes critical and explodes, thereby destroying itself and its immediate neighbours,... |