aspose file tools*
The moose likes Beginning Java and the fly likes How to do math functions in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to do math functions in java?" Watch "How to do math functions in java?" New topic
Author

How to do math functions in java?

Travis Gn
Greenhorn

Joined: Sep 11, 2003
Posts: 19
I am trying to solve the following for n:
somenumber=(1/3*(-1))^n+(2/3*2)^n
I tried the following code; I guess it's pretty clear I dont know what I am doing.
somenumber = (Math.pow(((1/3)*(-1)),n) + Math.pow(((2/3)*(2)),n))){
any pointers?


I need more help!
Angel Dobbs-Sciortino
Ranch Hand

Joined: Sep 10, 2003
Posts: 101
You have one too many end parentheses at the end of your statement. What kind of error are you getting, and does removing that fix it?
Angel
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
What's that opening bracket at the end of the line doing there?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
 
subject: How to do math functions in java?