Smol Improvements

This commit is contained in:
Matti 2024-05-19 22:05:50 +02:00
parent 7fd326360f
commit b0b248ca9d
4 changed files with 9 additions and 10 deletions

View File

@ -6,7 +6,7 @@ public class Anwendung {
public static void main(String[] args){ public static void main(String[] args){
matrix nr1 = new matrix(2,3); matrix nr1 = new matrix(2,3);
matrix nr2 = new matrix(3,3); matrix nr2 = new matrix(2,3);
nr1.setValue(1,1,1); nr1.setValue(1,1,1);
nr2.setValue(0,0,4); nr2.setValue(0,0,4);
@ -25,13 +25,13 @@ public class Anwendung {
nr3.setRow(new int[]{4,5,6},1); nr3.setRow(new int[]{4,5,6},1);
//matrix nr4 = new matrix(3,2); // works fine matrix nr4 = new matrix(3,2); // works fine
matrix nr4 = new matrix(3,3); // causes Runtime Exception //matrix nr4 = new matrix(3,3); // causes Runtime Exception
nr4.setCol(new int[]{7,9,11},0); nr4.setCol(new int[]{7,9,11},0);
nr4.setCol(new int[]{8,10,12},1); nr4.setCol(new int[]{8,10,12},1);
nr4.multiplyMatrix(nr3);
System.out.println(nr3.multiplyMatrix(nr4)); nr3.multiplyMatrix(nr4);
} }
} }

View File

@ -124,8 +124,7 @@ public class matrix {
} }
} }
else { else {
// Vectors not compatible Exception throw new RuntimeException("Vectors are not the sime size");
// TODO
} }
return result; return result;
} }

View File

@ -37,8 +37,8 @@ public class aufg1 {
public static void main(String[] agrs){ public static void main(String[] agrs){
// Fib(47) causes an Integer Overflow // Fib(47) causes an Integer Overflow
for (int i=0; i<46; i++) { for (int i=0; i<46; i++) {
System.out.println(fibonacciIter(i)); System.out.println("i " + i + ": " + fibonacciIter(i));
System.out.println(fibonacciRec(i)); System.out.println("i " + i + ": " + fibonacciRec(i));
System.out.println("=========="); System.out.println("==========");
} }
} }

View File

@ -10,7 +10,7 @@ public class aufg3 {
public static void recursive2(int depth){ public static void recursive2(int depth){
int[] array = new int[100]; int[] array = new int[100];
System.out.println(depth); System.out.println(depth);
recursive(depth+1); recursive2(depth+1);
} }
public static void recursive3(int depth){ public static void recursive3(int depth){