This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calculating Ln and exponent" Watch "Calculating Ln and exponent" New topic
Author

Calculating Ln and exponent

Ian Cockcroft
Greenhorn

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?


Thanks
Ian
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.

Kaydell
David McCombs
Ranch Hand

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

Kaydell


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
Wanderer
Sheriff

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
 
 
subject: Calculating Ln and exponent