wood burning stoves
The moose likes Beginning Java and the fly likes Calculating Ln and exponent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calculating Ln and exponent" Watch "Calculating Ln and exponent" New topic

Calculating Ln and exponent

Ian Cockcroft

Joined: Feb 17, 2002
Posts: 29
Guys, I have two functions that need to return the ln of a parameter and the exponent of a parameter. How would I do this?

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Ranchers don't generally do homework for you, unless maybe for a fee that would let me retire tomorrow. Are you stuck on the math algorithms? I'd just Google for those. Give it a shot and see if you can get something going!
[ August 02, 2007: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

The keyword to Google on is the "Math" class.

David McCombs
Ranch Hand

Joined: Oct 17, 2006
Posts: 212
Originally posted by Kaydell Leavitt:
The keyword to Google on is the "Math" class.


Only if he is allowed to use the Math class, which it doesn't sound like it is permissible.. Besides Google isn't necessary, just go here.

"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
If this is for a class, perhaps using a Taylor series would be appropriate for each. There may well be better ways to do this, depending on the desired domain of the functions, and how much effort it's worth to optimize speed. But that's where I'd probably start, assuming a Google search numeric approximations for eponentials and logarithms doesn't give you better ideas.

Of course if it's not for a class, then yes there's a much simpler solution suggested in earlier answers...

"I'm not back." - Bill Harding, Twister
I agree. Here's the link: http://aspose.com/file-tools
subject: Calculating Ln and exponent
It's not a secret anymore!