Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2546 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hi,

I have been trying to copy a formula from the web into a calculation field ... however my results do not match the results of the web calculator ??  The web calculator is only asking for two pieces of data ... and I am assuming it is width and length ?? 

Here is my calculation I have written based off of the web's formula ...

 ( Pi * Sqrt ( 2 ) ) * ( ( ( FinishSizeW / 2 ) * ( FinishSizeW / 2 ) ) + ( ( FinishSizeW / 2 ) * ( FinishSizeW / 2 ) ) )


Web instructions if you don't use the calculator ... The formula for an "Oval" is PI * SquareRoot of 2 * ((1/2 long axis)squared + (1/2 short axis)squared)

I have assumed that the 1/2 long axis and the 1/2 short axis are my "FinishSizeW and FinishSizeL".

Website's ...

http://www.csgnetwork.com/circumellipse.html

https://www.miniwebtool.com/ellipse-circumference-calculator/?a=.5&b=1

Any assistance here I would be grateful.

Thank you.

Edited by Mr. Ignoramus
Posted (edited)

Try 

Pi * Sqrt ( 2 )  * (  ( FinishSizeW / 2 )^2 +( FinishSizeL / 2 )^2)

Your formula assumes A^2 + B^2 = (A+B)^2 which isn't true.

EDIT: Interesting! The above formula (which is given in your first reference) does not give the same answer as the website either! This formula is altogether different from the ones given in https://www.mathsisfun.com/geometry/ellipse-perimeter.html . The first formula there gives essentially the same answer as the web calculator. The FM representation of that formula is 

2 * Pi * Sqrt(((long/2) ^2 + (short/2)^2)/2)

EDIT 2: My first formula came from incorrect reading of the formula on the webpage "PI * SquareRoot of 2 * ((1/2 long axis)squared + (1/2 short axis)squared). ".  Changing my first formula to 

Pi * Sqrt (( 2 )  * (  ( FinishSizeW / 2 )^2 +( FinishSizeL / 2 )^2))

Gives us 3 matching answers (2 formulas and webpage calculator)

Edited by doughemi
Posted

Doughemi ...

I put in the calc and checked the web site and I got the same answer :-) so thank you.

Jbante .... Well, I read many web pages saying the same thing but this one website I reference seemed to have a calculation I could at least attempt to understand

This calc is for the printing industry ... and if they have to laser cut 500,000 oval then the cut time will be inaccurate ... but looking at the calculations on different websites for an oval is too complicated for me at the moment.

Can you give me a idea how "OFF" the circumference would be then maybe I could figure in a factor instead of a super complicated calculation.  

Anyway, than you for you help.  I am grateful.

:-)

Posted

It looks like the calculation you found is approximating the circumference of an ellipse as the circumference of a circle with radius half-way between the circles that inscribe and circumscribe the ellipse. You could calculate upper and lower bounds as the circumferences of those 2 circles. The Wikipedia page includes some more bounds. Combining them in FileMaker might look like:

lowerBound = Max ( Pi * ( width + height ) ; 4 * Sqrt ( width^2 + height^2 ) )

upperBound = Min ( 2 * Pi * Max ( width ; height ) ; 4 * ( width + height ) ; Pi * Sqrt ( 2 * ( width^2 + height^2 ) ) )

If those numbers are close enough for your comfort, then there you go. I imagine they might still be too loose with 500,000 pieces to cut. I thought the exact calculation looks a little fun to me, so I might take a crack at that later.

Posted

Hi jbante,

I would rather you teach me the function ... is that possible ? Soliant Consultants posted where "Is It Better" to write a script or a custom function ?

Anyway ...

What would you charge for a session time 1-2 hrs ?

Thanks.

Posted

I believe the moderators of this forum prefer that transactional conversations happen in private messages.

Aside from that, I'm not sure exactly what you mean by "teach me the function". Do you want to understand how the math works? I think that's much more than a 1-2 hour conversation, and there's plenty of other information linked to from the Wikipedia page for ellipses that can steer you in the right direction. Do you want a script version of the same thing? That could be done pretty easily, but this is a use where I think a custom function is a less clumsy solution to use. (I'll grant you that my implementation might look more complicated than absolutely necessary, but that's my pattern when I don't want any helper functions to depend on or extra parameters that are only there to pass information between recursions.)

Posted

Hi jbante,

13 minutes ago, jbante said:

I believe the moderators of this forum prefer that transactional conversations happen in private messages

Correct. we don't need to see the ugly negotiations. :) You can probably do some of this by Private Message.

Posted

jbante,

Basically what I was asking for help with is the "User" only has two fields ... width and length that they will enter.  Then they will click on the "oval" radial ... so based on your link above ... I will replace all the:

"axis1Length" and "axis2Length"

with my "Width" and "Length" field reference ...

Clicking through your link, even here as with other web pages, the further the ratio between a and b you are the higher you will error.  So ... "Try this calc for a reasonably exact calculation" am I to understand that your calc is pretty close even as the ratios of "a" and "b" get further away ?

Thank you for your assistance.

Screen Shot 2017-12-14 at 9.21.39 PM.png

Posted

jbante,

Basically I'm going to just use the case statement you provided from inside your function when the user click on the "oval" radial to trigger the calculated results to a different field and see the difference between the two suggested calculations.

Since I don't know how to write function yet, can I just copy the cash statement and replace the max width and length with my field names ?

I am trying to find where to learn how to write functions in "FileMaker" ... meaning I have not found a very good reference source to learn from yet. 

doughemi, 

If you could be so kind, what error factor does your calc produce ... I liked it since I was able to implement it.  Is you calculation off by a lot ?  Again, I am just trying to understand this "Error".

Thank you.

Posted (edited)

So you're asking about how to copy my calculation into your file as a custom function? FileMaker's help documents how to make custom functions in general.

  1. Copy the calculation code for the EllipseCircumference custom function from GitHub.
  2. Open your file in FileMaker Pro Advanced.
  3. Open File > Manage > Custom Functions...
  4. In the "Manage Custom Functions" dialog, click the "New..." button in the bottom-left corner.
  5. In the "Edit Custom Function" dialog, paste the function code into the function calculation box.
  6. Set the "Function Name" and "Function Parameters" to match the header comment in the function calculation.
  7. Click "OK" in the "Edit Custom Function" dialog, and click "OK" in the "Manage Custom Functions" dialog to save the function.
  8. You can then use the EllipseCircumference custom function in any calculation (field, script, data viewer) in that file.

The approximate calculations mentioned earlier in this thread are all wrong, by about a factor of two. The first reference link in the thread gave an incorrect formula. The correct form of the approximation is:

2 * Pi * Sqrt ( ( radius1 ^ 2 + radius2 ^ 2 ) / 2 )

(Or diameter/2 in place of the radiuses.) This approximation is exact when the axes are equal (i.e. for a circle). The relative error of this grows up to about 11% as the ellipse gets extremely stretched out.

This is a much better approximation (now also available in custom function form), if you really want a simple formula instead of the more exact custom function:

4 * ( radius1 + radius2 )
* ( Pi / 4 ) ^ ( 4 * radius1 * radius2 / ( radius1 + radius2 ) ^ 2 )

This approximation is always within about 0.1% or better. Still, I'd only use this if the exact calculation is too slow for a particular application.

Step 1.png

Step 2.png

Step 3.png

Step 4.png

Step 5.png

 

 

Step 6.png

Edited by jbante
  • Like 1
Posted

jbante,

I want to use your original calc / function if it produces the best results.  And thank you for the "error" spread.  Yours is the best, but I am just a little confused ... do I replace your "axis1Length" / "axis2Length" ( parameters ) with my two fields "width" and "length" respectively ... ?

I've imported function into my solution before, and made minor edits.  Building one from the beginning, I'm just confused a bit with how I am suppose to reference so I am going to assume that your "axis1length" and your "axis2length" are my width and length fields.

Thank you.

 

Posted
1 hour ago, Mr. Ignoramus said:

I want to use your original calc / function if it produces the best results.  And thank you for the "error" spread.  Yours is the best, but I am just a little confused ... do I replace your "axis1Length" / "axis2Length" ( parameters ) with my two fields "width" and "length" respectively ... ?

I've imported function into my solution before, and made minor edits.  Building one from the beginning, I'm just confused a bit with how I am suppose to reference so I am going to assume that your "axis1length" and your "axis2length" are my width and length fields.

I realized the potential confusion with that this morning and re-named the parameters to "radius1" and "radius2". You should be passing ( width / 2 ) and ( length / 2 ) as the parameters (the order doesn't matter):

EllipseCircumference ( width / 2 ; length / 2 )

 

This topic is 2546 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.