Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to do math functions in java?" Watch "How to do math functions in java?" New topic

How to do math functions in java?

Travis Gn

Joined: Sep 11, 2003
Posts: 19
I am trying to solve the following for 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?
Dirk Schreckmann

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]
I agree. Here's the link:
subject: How to do math functions in java?
It's not a secret anymore!