Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to do math functions in java?

 
Travis Gn
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's that opening bracket at the end of the line doing there?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic