Solved

How to represent ln^2(x) in Java

Posted on 2010-08-14
7
1,141 Views
Last Modified: 2012-05-10
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
Comment
Question by:Midwest
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 33439239
0
 

Author Comment

by:Midwest
ID: 33439251
It is not ln(subscript(2))x it is ln^2(x).  See image.  This is different right?
img.JPG
0
 
LVL 84

Accepted Solution

by:
ozo earned 450 total points
ID: 33439262
Math.log(x)*Math.log(x)
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 

Author Comment

by:Midwest
ID: 33439269
So, would this work?  Math.pow((Math.log(x), 2));
0
 
LVL 92

Expert Comment

by:objects
ID: 33439272
If what you need is natural log squared, then yes
0
 
LVL 84

Expert Comment

by:ozo
ID: 33439302
yes
0
 
LVL 4

Assisted Solution

by:QCD
QCD earned 50 total points
ID: 33439566
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Question has a verified solution.

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

Suggested Solutions

Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
This article provides a brief introduction to tissue engineering, the process by which organs can be grown artificially. It covers the problems with organ transplants, the tissue engineering process, and the current successes and problems of the tec…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

830 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