New program available on my page

Home Model Engine Machinist Forum

Help Support Home Model Engine Machinist Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

mklotz

Well-Known Member
Joined
Aug 29, 2007
Messages
3,046
Reaction score
27
Location
LA, CA, USA
There's a program on my page (CIRC3) which will, given the distances between three points, compute the radius of the circle passing through them.

One of those clever Brits approached me with a problem. He has a microscope affair on his DRO equipped mill. What he wanted to do was capture three points via the DRO from an existing piece and use the program to find, given these Cartesian coordinates, the radius of the circle and the coordinates of the circle center so he could plug these data into a CNC program and generate duplicates of the piece.

I wrote the program (named CIRC3C - 'C' for Cartesian) and added it to the CIRC3 archive on my page. If any of you have use for such a tool, you're welcome to download it and use it - all programs on my page are free for the taking.
 
You can also do this for finding the center of a hole or round part using your edge finder in the mill, right? This is what we do at work on our CNC mills. It has a function where you enter after touching the three edges and it tells you the center. Very handy :bow:
Tim
 
zeusrekning said:
You can also do this for finding the center of a hole or round part using your edge finder in the mill, right? This is what we do at work on our CNC mills. It has a function where you enter after touching the three edges and it tells you the center. Very handy :bow:
Tim

I hadn't thought about it but yes, that could be another use for it.
 
For a long time I've been intending to write a program to calculate the perimeter of an ellipse but put it off because I felt that few would have use for it. A recent thread on this forum and a query from a friend who teaches math finally got me motivated and the deed is now done. The archive ELLIPSE.JPG on my page contains the program which, as usual, is free to anyone who may have use for it.

The text file which accompanies the program is reproduced below. It gives a complete description of what the program contains.

Below is a sample output from the program


Semi-major axis [10] ?
Semi-minor axis [3] ? 1

eccentricity = 0.9950
flattening = 0.9000
area = 31.4159

Perimeter =

elliptic integral: 40.6397
rms approximation: 44.6504 (error = -9.8689 %)
Ramanujuan1 approximation: 40.6055 (error = 0.0842 %)
Ramanujuan2 approximation: 40.6393 (error = 0.0012 %)

Admittedly, it's not something you'll need very often but, if you do, it's good to know that you'll be able to find it easily.


=====================================================================================

Most regular geometric figures have simple rational expressions for their perimeters, e.g. 2*(l+w) for a rectangle or 2*pi*r for a circle. Unfortunately, this is not true for an ellipse. The perimeter of an ellipse is found using a complete elliptical integral of the second kind. Typically this involves looking up values in tables of this integral and then laboriously interpolating to get accurate values.

In this program, a high accuracy (2E-8) approximation to this integral is implemented to find the perimeter. This value is then used as a reference to test the accuracy of several algebraic approximations to the perimeter.

The rms approximation to the perimeter, P, is found in many math handbooks and is given by:

P = 2*PI*sqrt(0.5*(a*a+b*b))

Not particularly accurate, it's error (relative to the elliptic integral reference value) can be as high as 5%.

Ramanujuan, the genius Indian mathematician, derived a much better algebraic approximation given by:

P = PI*(3*(a+b)-sqrt((3*a+b)*(a+3*b)))

which is listed as the "Ramanujuan1" approximation in the program output.

Ultimately, he derived an even better, though slightly more complicated, rational approximation given by:

P = PI*(a+b)*(1+3*x*x/(10+sqrt(4-3*x*x)))

where x is given by:

x=(a-b)/(a+b)

and a and b are the semi-major and semi-minor axes of the ellipse, respectively.

 
Marv,

If you like combining recreational math with programming, you might enjoy Project Euler (http://projecteuler.net/

Currently over 200 problems, most of which requite computer programming to solve. So far I've gotten 134 of 213.
 

Latest posts

Back
Top