Commit 12bdbd00 authored by samuel.boulton's avatar samuel.boulton

probability and sum function left

parent a585857a
......@@ -63,6 +63,29 @@ public class Program {
};
public static void main(String[] args) {
int[] input = {3,6,77};
double output = 0.0;
double bracketsResult = 0.0;
double powerResult = 0.0;
double total = 0.0;
for(int i = 0; i < input.length; i++)
{
bracketsResult = (double)input[i] / 2;
System.out.println(bracketsResult + " bracket result");
powerResult = Math.pow(bracketsResult,i / 2);
System.out.println(i + " this is i");
System.out.println(powerResult + " this is powerResult");
total = total + powerResult;
System.out.println(total + " this is total");
}
output = total / input.length + 3;
System.out.println(output + " output");
// TODO Auto-generated method stub
}
......@@ -212,7 +235,7 @@ public class Program {
}
public static int[] Difference(int[] intArrayA, int[] intArrayB) {
// DONE AND PASSED TEST
ArrayList<Integer> differenceList = new ArrayList<Integer>();
......@@ -503,27 +526,24 @@ public static int Range (int[] input) {
public static double ComplexSumFunctionA (int[] input) {
// ASK MATT
// ASK MATT // email david.
double output = 0.0;
double sum = 0.0;
double sum2 = 0.0;
double sum3 = 0.0;
double bracketsResult = 0.0;
double powerResult = 0.0;
double total = 0.0;
for(int i = 0; i < input.length; i++)
{
sum += input[i] / 2;
sum2 += Math.pow(sum, i / 2);
bracketsResult = input[i] / 2;
powerResult = Math.pow(bracketsResult, i / 2);
total = total + powerResult;
}
sum3 = input.length + 3;
output = sum2 / sum3;
output = total / input.length + 3;
return output;
}
public static int[][] MatrixScalarMultiplication (int[][] matrix, int scalar){
int[][] resultMatrix = new int[matrix.length][matrix[0].length];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment