?
Solved

Math line for a program (Cube Root)

Posted on 1997-10-11
6
Medium Priority
?
680 Views
Last Modified: 2006-11-17
I'm creating a program in D2.  a math Equation is going to be used to figerout the Volum to Surfase Area of of an Object.  The book that I'm using has the following Math.
Surfase Area =[(cube root of volume) squared] x 6

Is there a command in D2 that calculates the cube root or do I have to find an nother way.

If there is no command, please supply code to add.   willing to give the points.

Thanks
PPaul
0
Comment
Question by:PPaul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 800 total points
ID: 1347285
procedure TForm1.Button1Click(Sender: TObject);
function Root(FSurface, FDegree: Real): Real;
begin
  Result:=Exp(1/FDegree*Ln(FSurface));
end;

begin
  ShowMessage(FloattoStr(Root(50,6)));
end;

0
 

Expert Comment

by:AllenC
ID: 1347286
function GetSurfaceArea(Volume: Real): Real;
begin
  Result := Sqr( 1/Exp(3 * Ln(Volume)) ) * 6;
end;
0
 

Author Comment

by:PPaul
ID: 1347287
OK.  I looked at the above code..  The one by ronit lost me.  I'm trying to fuger out what's with the two varables.  they just shoot me for a loop. :)

The code by AllenC, I tryed in the program and the results are nowere close to the the one from the Gaming book I'm making this program for :)

Is the above code using CUBE ROOT or did you make the same mastake I did ,  SQUARE ROOT.

The book I have, has a chart with Surface area rounded up/down to the close number.  Example:

Volume          Area
  (cf)                (sf)
Under 0.03     0.5
0.03 - 0.06       1
Etc...

I need to get the cube root of the voloum then sqruare it then times it by 6 : [(cube root of volume) squared]x6

I have only one number to plug in to the math line that is Volume.

When I did test the code by AllenC  the result to 0.05 was realy off.  It sould have been around 1.  It gave me 383999999.999512.

Thanks for the help but I still need more.

ronit if you can can you discribe the steps the code is doing and why I need two numbers?  Thanks.

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:AllenC
ID: 1347288
Sorry, my mistake here. Try this code instead, it works, I tried it.

function GetSurfaceArea(Volume: Real): Real;
begin
  GetSurfaceArea := Exp( (1/3) * Ln(Volume)) * 6;
end;

begin
  Writeln(Round( GetSurfaceArea(27) ));
  { You should get 18 }
end.

Exp( (1/3) * Ln(Volume)) <- Cube Root of Volume.

Sorry about the error..

http://tcp.home.ml.org/
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1347289
I will give you the most general function, so that it will answer any case, not just the 6'th case:

procedure TForm1.Button1Click(Sender: TObject);
function Root(FSurface, FDegree: Real): Extended;
begin
  Result:=Exp(FDegree*Ln(FSurface));
end;
begin
  ShowMessage(FloattoStr(Root(5,2)));//equel to 5²
  ShowMessage(FloattoStr(Root(16,1/4)));//equel to 16¼
end;

And In general:          
Root(X, a)=Xª
SQRT(25)=Root(25, 1/2)=25½

0
 

Author Comment

by:PPaul
ID: 1347290
Thanks.  Big Help!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month10 days, 15 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question