Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1257
  • Last Modified:

How to represent ln^2(x) in Java

How to represent ln^2(x) in Java?  

Math.log(x) would work for just ln(x) but how do I do ln^2(x)?
0
Midwest
Asked:
Midwest
  • 2
  • 2
  • 2
  • +1
2 Solutions
 
MidwestAuthor Commented:
It is not ln(subscript(2))x it is ln^2(x).  See image.  This is different right?
img.JPG
0
 
ozoCommented:
Math.log(x)*Math.log(x)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
MidwestAuthor Commented:
So, would this work?  Math.pow((Math.log(x), 2));
0
 
objectsCommented:
If what you need is natural log squared, then yes
0
 
ozoCommented:
yes
0
 
QCDCommented:
If by ln^2(x), you actually mean ln(ln(x)), this would be Math.log(Math.log(x))

If you mean (ln(x))^2 = ln(x) * ln(x), this would be Math.pow(Math.log(x),2), as a number of people have indicated.

The notation itself can be ambiguous.  It would help if we knew the context.

Additionally, in some contexts, log(x) is understood to be the natural log, ln(x).  In others, it is understood to be base 2, or even base 10.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now