Trying to do some really basic math here, but my lack of understanding of Java is causing some problems for me.

```
double[][] handProbability = new double[][] {{0,0,0},{0,0,0},{0,0,0}};
double[] handProbabilityTotal = new double[] {0,0,0};
double positivePot = 0;
double negativePot = 0;
int localAhead = 0;
int localTied = 1;
int localBehind = 2;
//do some stuff that adds values to handProbability and handProbabilityTotal
```positivePot = (handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0));

negativePot = (handProbability[localAhead][localBehind] + (handProbability[localAhead][localTied] / 2.0) + (handProbability[localTied][localBehind] / 2.0) ) / (handProbabilityTotal[localAhead] + (handProbabilityTotal[localTied] / 2.0));

The last two lines are giving me problems (sorry for their lengthiness). Compiler Errors:

```
src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double[],double
positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) );
^
src/MyPokerClient/MyPokerClient.java:180: operator + cannot be applied to double,
positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) );
^
src/MyPokerClient/MyPokerClient.java:180: operator / cannot be applied to double,
positivePot = ( handProbability[localBehind][localAhead] + (handProbability[localBehind][localTied] / 2.0) + (handProbability[localTied][localAhead] / 2.0) ) / (handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0) );
```

Not really sure what the problem is. You shouldn't need anything special for basic math, right?

In the last part of the first line `(handProbability[localTied] / 2.0)`

you are trying to divide an array (`hardProbability[localTied]`

) instead of a number (one of its values).

Since `handProbability`

is the multidimensional array, it's impossible to divide an array to number:

```
handProbability[localTied] / 2.0
```

Sure, it gives you the error. Fix this line. Have you probably meant `handProbabilityTotal`

?

The line before last line has the issue.

```
positivePot =
(handProbability[localBehind][localAhead] +
(handProbability[localBehind][localTied] / 2.0) +
(handProbability[localTied][localAhead] / 2.0) ) /
(handProbabilityTotal[localBehind] + (handProbability[localTied] / 2.0));
```

handProbability is a two dimensional double array. So handProbability[localTied] is an array of doubles. it is not a double value. Based on your last line, I think it should be handProbabilityTotal[localTied].

Similar Questions

I'm wondering which algorithms are used to implement math functions from the java.lang.Math class? For example, is sin(x)(or log(x)) implemented as sum of elements of Taylor series or any other algor

I am trying to run a simple switch-case statement in Beanshell This is the code I am trying to run-- temp = assignee.toString(); switch( temp.toString() ) { case 'missing' : check = missing; break;

I have a simple if/elseif condition which I'm trying to convert it into a return statement with Ternay Operator for code redundancy but I have not been able to. Any help would be appreciated, Thanks.

I'd like something that converts a simple calculator like ascii math syntax to mathML. I found this: http://www1.chapman.edu/~jipsen/mathml/asciimath.html But I don't understand how to use it.. I'd li

I am trying to use java3d on my mac osx and i cant find installation instructions anywhere! if anyone knows how to do this or if there are any alternatives to java3d (i know jmonkeyengine is one) plea

Just playing around with java trying to learn it etc. Here is my code so far, using HtmlUnit. package hsspider; import com.gargoylesoftware.htmlunit.WebClient; /** * @author */ public class Main { /**

I am writing my first routing rule in rails and I am getting some errors. No route matches /index.html In my routes.rb file I do have this: Blog::Application.routes.draw do get home#index and fu

I have three UITextFields. Two of them represent a certain number value. The third represents the percentage of the two. How do I setup the 3rd UITextField to do this simple math?

Is it possible to perform simple math on the output from Python regular expressions? I have a large file where I need to divide numbers following a ) by 100. For instance, I would convert the follow

I have a little problem to make a simple math calculation in the controller. what I try to do is add +1 to a number of a variable. Here is an example for you to understand better what I try to do: va

import java.lang.*; import java.math.*; class Factor { public void Factor(double NumToFactor) { for (double i=0; i <= Math.sqrt(NumToFactor); i++) { if (NumToFactor%i == 0) { Factor(NumToFactor/i);

How do i get arctan MATH function in iphone SDK ??

This question already has an answer here: Raw Strings in Java - for regex in particular 10 answers Does java have an equivalent operator or language construct as the verbatim operator(@) in C#?

I get a Overflow error when i try this calculation, but i cant figure out why. 1-math.exp(-4*1000000*-0.0641515994108)

Below is my code. i am successfully adding values in Map but when try to get value of particular key and update it then no value getting getting error : bad operand type for binary operator + Map

i'm learning some Java and decided to do something simple but it keeps returning the wrong value... i don't know why i'm sure there something that my untrained eye isn't picking up on Please if you ha

so i have just this Math.log function in Java at this link http://www.tutorialspoint.com/java/lang/math_log.htm On its example : Math.log(60984.1) = 11.018368453441132 I tried it on a calculator (i

I am trying to implement a simple math parser in java. This is for my small school project working with matrices that enables to input some simple equations, such as A^-1(B+C) and then the program ask

I'm trying to do some simple math like $example = (12 - 4); but I need single digit answers to have a 0 in front of them so $example should be 08 not 8 I know I could do something like if ($exampl

I'm getting this error when compiling my JRXML file in iReport 3.1.2: com.jaspersoft.ireport.designer.errorhandler.ProblemItem@f1cdfb The operator > is undefined for the argument type(s) java.lang

I am trying to make program that uses operator overloading to do basic math operations on rational numbers. I keep getting an errors in the functions where it says i must have an arithmetic of enum ty

I have the following java code. I am trying to optimize the function while(pStart < audio.length) { int pEnd = Math.round(pStart + winSize*Fs); int windowEnd = Math.min(pEnd, audio.length); double

I'm working on an assignment for my Java class and I keep getting compiler errors. The errors I'm getting are not a statement subtotal ++ total; and error: ';' expected subtotal ++ total;. Any adv

I have a problem with solving a simple integration through MATLAB. I want to solve this symbolic and don't have any problems doing this through other programs. Well I have this equation: syms k x fX(x

I'm trying to print my name using Java OOP Classes, Objects and Method. Below are the two scripts I'm using. Nothing is showing on the screen. I'm using Netbeans IDE. package name; public class Begin

So I was testing out operators, because im helping my friend with java and i stumbled across a weird order of programming. What is happening when I run the following code public static void main(Strin

I have a simple function to do simple math operations. If I call this from another script using import, I get no output. If I remove def function, everything is working fine. What's the problem with d

I am trying to create a simple script that gives me the next recycling date based on a biweekly schedule starting on Wed Jul 6, 2011. So I've created this simple function... function getNextDate(star

How I remove all non-math symbols or numbers from a string. So I want a string to be able to contain + or - or numbers 0-9 But any other symbols or alphabetical characters to be removed. How do I do

Im a newbie to Java and wrote this class to try few array options..can you please what is the error in the method printarray..Eclipse points me a error but im unable to debug public class arrarytest {

this is a simple Java code which reverses a String without using any String API function, but in the last line, when it prints the reversed string, there is some problem in output statement (System.ou

In Mongodb Aggregation Framework, you have arithmetic operators like $multiply or $add and so on, I know you can do something similar to { $multiply : [ myField, 0 ] } easily in MongoDb, but how can y

Few hours ago I have started to learn java socket comunication. Now I'm trying to make server application whitch should return me data to webbrowser. My code: try{ ServerSocket socket = new ServerSock

I'm a total newbie when it comes to programming and I'm writing in Java for the first time. It's for an assignment in college. I'm using NetBeans. You see I'm completely lost and have no idea what I c

Following on from one of my previous questions to do with method design I was advised to implemented my SQL queries as a parameterized query as opposed to a simple string. I've never used parameterize

I'm new to java and trying to write a simple program using JDBC. It must be something obvious but I just don't see it. I've been defining the class path manually because the only two classes (at least

monPay = (amtFin * amtI)/((1-(1+amtI)*Math.pow(-n,-n))); I am using this code but it is not calculating Math.pow(-n,-n) correctly. It seems like it is Math.pow(-n,-n) is calculating to 0.0. It is dec

I am creating a simplechat app with RMI, But I am not able recognize that where the exact problem is? This is my code: ChatServer.java import java.awt.Point; import java.net.MalformedURLException; imp

I have a minor problem with my css in that I have a drop down menu which works fine, however the problem comes when scrolling on items in the drop down the text is not centered in the highlight, it is

I keep getting the error message the operator type is undefined for the args when I use any boolean operators in java. Do I have to import a boolean class or something? import java.util.Scanner; //imp

Possible Duplicate: Why do we usually use || not |, what is the difference? Can any one explain the difference between and usage of OR operator ( || and | ) in java. thanks e.g: if(a || b) { // Do

I found that a rounding error with my Java application. The method used to round was: public static double round(double value,double precision) { return Math.round(value * precision) / precision; }

Anyone knows if multiply operator is faster than using the Math.Pow method? Like: n * n * n vs Math.Pow ( n, 3 )

Running Java application on IBM WebSphere caused such exception: Caused by: java.lang.NullPointerException at java.math.BigDecimal.add2DFP(BigDecimal.java:1946) at java.math.BigDecimal.add(BigDecimal.

I have a Java program that does many calls to the Math.tanh() function. Out of curiosity I wanted to do a comparison with C++. Therefore I wrote two small programs, one in Java and one in C++, to test

Possible Duplicate: Floating point inaccuracy examples When using the modulo operator in java I'm not getting the number I expect to get. Heres what I'm doing: double input = 5.59; System.out.print

I have written a simple java program mentioned in below. Unfortunately a compile error occurs. class String { public static void main(String[] args) { System.out.println(stre); } } The following co

Wondering if anyone can see why I cant call .modulo. I feel like its something like I have to call Math in the class but I Im not sure thats the case. git: https://github.com/jbasalone/ja/tree/master/

This question already has an answer here: how can I force division to be floating point in Python? 7 answers I am learning Python and am having an issue doing simple math... def main(): coneHei

Writing SPARC asm code to evaluate a hardcoded statement, but I'm getting an error I don't understand. I've searched all over, and while it seems to come up a lot in some bug reports out there, there'