Results 1 to 2 of 2
- 03-10-2014, 03:28 AM #1
Member
- Join Date
- Feb 2014
- Posts
- 6
- Rep Power
- 0
Printing a variable using loops - algorithm
I have 3 for loops here that do what I need them to do an individual basis. But, I can't seem to get them to work together. I need to calculate y=LN(E-k), compute the error and error squared value for y and print the variable when the value for y gives the lowest error squared value. Hope this makes sense.
Java Code://Calculating y=LN(E-k) and Initializing the Array for(int x=0; x<LNValues.length; x++) { //for(int y=0; y<9; y++) //{ double i = Math.log(eValues[x][0] - kValue); if(i > 0) { LNValues[x][0] = roundThreeDecimals(i); } else { LNValues[x][0] = 0; } //} } //Calculating Error Figures and Error Square for(int x=0; x<errorValues.length; x++){ //for(int y=0; y<9; y++){ double j = LNValues[x][0] - eventSpecies[x][0]; if(j != 0.0){ errorValues[x][0] = roundThreeDecimals(j); errorSquared[x][0] = roundThreeDecimals(Math.pow(j, 2)); }else{ errorValues[x][0] = 0; errorSquared[x][0] = 0; } //} } //Print Error Squared Values double errorSquareTotal = 0; for(int x=0; x<errorSquared.length; x++){ //for(int y=0; y<9; y++){ errorSquareTotal += errorSquared[x][0]; //} }
- 03-10-2014, 03:16 PM #2
Similar Threads
-
Variable Number of Nested For Loops
By atomant in forum New To JavaReplies: 5Last Post: 03-04-2012, 08:20 AM -
Implement Custom Printing Logic & Enhanced Word Documents Printing
By sherazam in forum Java SoftwareReplies: 0Last Post: 12-26-2011, 04:52 PM -
[Semi-Beginner] (nested loops) What's wrong with my code? (nested loops)
By Solarsonic in forum New To JavaReplies: 20Last Post: 03-22-2011, 05:02 AM -
Printing Two Dimensional Arrays with for loops
By mcnam4119 in forum JCreatorReplies: 3Last Post: 10-06-2010, 06:27 AM -
Variable Management in Loops
By rp181 in forum New To JavaReplies: 2Last Post: 03-24-2010, 12:20 AM
Bookmarks