mirror of
https://gitlab.gwdg.de/j.hahn02/university.git
synced 2026-01-01 06:44:25 -05:00
cleanup
This commit is contained in:
Binary file not shown.
25
S1/GdCP/18.in
Normal file
25
S1/GdCP/18.in
Normal file
@@ -0,0 +1,25 @@
|
||||
5,4
|
||||
4,2
|
||||
4,5
|
||||
3,0
|
||||
2,1
|
||||
6,3
|
||||
2,4
|
||||
1,5
|
||||
0,6
|
||||
3,3
|
||||
2,6
|
||||
5,1
|
||||
1,2
|
||||
5,5
|
||||
2,5
|
||||
6,5
|
||||
1,4
|
||||
0,4
|
||||
6,4
|
||||
1,1
|
||||
6,1
|
||||
1,0
|
||||
0,5
|
||||
1,6
|
||||
2,0
|
||||
1586
S1/GdCP/22.in
Normal file
1586
S1/GdCP/22.in
Normal file
File diff suppressed because it is too large
Load Diff
BIN
S1/GdCP/a.out
Executable file
BIN
S1/GdCP/a.out
Executable file
Binary file not shown.
28
S1/GdCP/a01-testing.c
Normal file
28
S1/GdCP/a01-testing.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int strclean(char *t);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
if (argc != 2) {
|
||||
printf("USAGE: %s <string>\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *s = argv[1];
|
||||
|
||||
if (s == NULL || strlen(s) >= 32) {
|
||||
printf("ERROR: illegal argument, e.g. string length >= 32\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char t[32];
|
||||
strncpy(t, s, 32);
|
||||
int c = strclean(t);
|
||||
|
||||
printf("input: \"%s\", result: \"%s\", removed: %d\n", s, t, c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
22
S1/GdCP/a01.c
Normal file
22
S1/GdCP/a01.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include<stdlib.h>
|
||||
#include<ctype.h>
|
||||
#include<string.h>
|
||||
|
||||
void pop(char *s, char *p) {
|
||||
int l = strlen(s) - 1;
|
||||
for (int i = p - s; i < l; i++) s[i] = s[i+1];
|
||||
s[l] = '\0';
|
||||
}
|
||||
|
||||
int strclean(char *t) {
|
||||
if (!t) return -1;
|
||||
int count = 0, ind = 0;
|
||||
while (t[ind] != '\0') {
|
||||
if (!isgraph(t[ind])) {
|
||||
pop(t, t + ind); count++;
|
||||
} else ind++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
14
S1/GdCP/a02-testing.c
Normal file
14
S1/GdCP/a02-testing.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int sequence(int x, int n);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
int x = 3;
|
||||
int min = -2, max = 8;
|
||||
|
||||
for (int n = min; n <= max; n++)
|
||||
printf("sequence(%d, %d) == %d\n", x, n, sequence(x,n));
|
||||
|
||||
return 0;
|
||||
}
|
||||
9
S1/GdCP/a02.c
Normal file
9
S1/GdCP/a02.c
Normal file
@@ -0,0 +1,9 @@
|
||||
int sequence(int x, int n){
|
||||
if (n < 0) return 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (x % 2 == 0) x = x/2;
|
||||
else x = 3 * x + 1;
|
||||
if (x < 0) return -1;
|
||||
}
|
||||
return x;
|
||||
};
|
||||
71
S1/GdCP/a03-testing.c
Normal file
71
S1/GdCP/a03-testing.c
Normal file
@@ -0,0 +1,71 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
struct interval_s {
|
||||
long low; // lower bound
|
||||
long up; // upper bound
|
||||
};
|
||||
|
||||
int is_empty_intersection(const struct interval_s *a, const struct interval_s *b);
|
||||
|
||||
char *prog = NULL;
|
||||
|
||||
void usage() {
|
||||
printf("USAGE: %s <integer> <integer> <integer> <integer>\n", prog);
|
||||
printf("EXAMPLES:\n");
|
||||
printf("%s 1 2 3 4\n", prog);
|
||||
printf("%s 1 2\n", prog);
|
||||
printf("%s \n", prog);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
prog = argv[0];
|
||||
|
||||
if (argc != 1 && argc != 3 && argc != 5) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct interval_s x;
|
||||
struct interval_s y;
|
||||
int b;
|
||||
|
||||
if (argc == 1) {
|
||||
printf("is_empty_intersection(NULL, NULL)\n");
|
||||
b = is_empty_intersection(NULL, NULL);
|
||||
printf("== %d\n", b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc == 3) {
|
||||
if (sscanf(argv[1], "%ld", &x.low) != 1 || sscanf(argv[2], "%ld", &x.up) != 1) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
printf("is_empty_intersection(NULL, [%ld, %ld])\n", x.low, x.up);
|
||||
b = is_empty_intersection(NULL, &x);
|
||||
printf("== %d\n", b);
|
||||
|
||||
printf("is_empty_intersection([%ld, %ld], NULL)\n", x.low, x.up);
|
||||
b = is_empty_intersection(&x, NULL);
|
||||
printf("== %d\n", b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sscanf(argv[1], "%ld", &x.low) != 1 || sscanf(argv[2], "%ld", &x.up) != 1 || sscanf(argv[3], "%ld", &y.low) != 1 || sscanf(argv[4], "%ld", &y.up) != 1) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("is_empty_intersection([%ld, %ld], [%ld, %ld])\n", x.low, x.up, y.low, y.up);
|
||||
|
||||
b = is_empty_intersection(&x, &y);
|
||||
|
||||
printf("== %d\n", b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
28
S1/GdCP/a03.c
Normal file
28
S1/GdCP/a03.c
Normal file
@@ -0,0 +1,28 @@
|
||||
typedef struct interval_s {
|
||||
long low; // lower bound
|
||||
long up; // upper bound
|
||||
} interval_t;
|
||||
|
||||
long max(long a, long b) {
|
||||
if (a > b) return a;
|
||||
return b;
|
||||
}
|
||||
|
||||
long min(long a, long b) {
|
||||
if (a > b) return b;
|
||||
return a;
|
||||
}
|
||||
|
||||
int is_empty(const interval_t *a) {
|
||||
return a->low > a-> up;
|
||||
}
|
||||
|
||||
int is_empty_intersection(const struct interval_s *a, const struct interval_s *b) {
|
||||
if (!a || !b) return 1;
|
||||
const interval_t *l[] = {a, b};
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (is_empty(l[i])) return 1;
|
||||
}
|
||||
interval_t s = {max(a->low, b->low), min(a->up, b->up)};
|
||||
return is_empty(&s);
|
||||
};
|
||||
20
S1/GdCP/a04-1.c
Normal file
20
S1/GdCP/a04-1.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "a04-testing.h"
|
||||
#include<stdio.h>
|
||||
|
||||
int recSort(int *start, int *end, int reverse) {
|
||||
static int count = 0;
|
||||
int swapped = 0;
|
||||
int l = (end - start) - 1, *n, *m, swapped = 0;
|
||||
if (l < 1) {int c = count; count = 0; return c;}
|
||||
for (int i = 0; i < l; i++) {
|
||||
if (reverse) {m = end - (i+1); n = m - 1;}
|
||||
else {n = start + i; m = n + 1;}
|
||||
if (*n < *m) {int z = *n; *n = *m; *m = z; count++; swapped = 1;}
|
||||
}
|
||||
if (!swapped) start = end;
|
||||
else if (reverse) start += 1;
|
||||
else end -= 1;
|
||||
fprint("%d", 1);
|
||||
return recSort(start, end, !reverse);
|
||||
};
|
||||
|
||||
24
S1/GdCP/a04-2.c
Normal file
24
S1/GdCP/a04-2.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "a04-testing.h"
|
||||
|
||||
int print(int *a, int len) {
|
||||
for (int i = 0; i < len-1; i++) {
|
||||
printf("%d ", a[i]);
|
||||
}
|
||||
printf("%d", a[len-1]);
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int len = argc - 1; if (argc < 1) return recSort(0, 0, 0);
|
||||
int *a = malloc(sizeof(int) * (len + 1));
|
||||
for (int i = 0; i < len; i++) {
|
||||
a[i] = atoi(argv[i+1]);
|
||||
}
|
||||
print(a, len);
|
||||
printf("%d\n", recSort(a, a+len, 0));
|
||||
print(a, len);
|
||||
free(a);
|
||||
return 1;
|
||||
}
|
||||
2
S1/GdCP/a04-testing.h
Normal file
2
S1/GdCP/a04-testing.h
Normal file
@@ -0,0 +1,2 @@
|
||||
int recSort(int *start, int *end, int reverse);
|
||||
|
||||
31
S1/GdCP/aoc18.c
Normal file
31
S1/GdCP/aoc18.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void mix(long *n, long r) { *n = *n ^ r; }
|
||||
void prune(long *n) { *n = *n % 16777216; }
|
||||
|
||||
int main() {
|
||||
FILE *file = fopen("18.in", "r");
|
||||
if (!file) {
|
||||
perror("Unable to open file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int size = 71;
|
||||
int **a = malloc(size * sizeof(int *));
|
||||
for (int i = 0; i < size; i++) {
|
||||
a[i] = malloc(size * sizeof(int));
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
perror("Memory allocation failed");
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
free(a);
|
||||
return 0;
|
||||
}
|
||||
60
S1/GdCP/aoc22.c
Normal file
60
S1/GdCP/aoc22.c
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void mix(long *n, long r) { *n = *n ^ r; }
|
||||
void prune(long *n) { *n = *n % 16777216; }
|
||||
|
||||
int main() {
|
||||
FILE *file = fopen("22.in", "r");
|
||||
if (!file) {
|
||||
perror("Unable to open file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int *array = malloc(10 * sizeof(int));
|
||||
if (!array) {
|
||||
perror("Memory allocation failed");
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int num, size = 0, capacity = 10;
|
||||
while (fscanf(file, "%d", &num) == 1) {
|
||||
if (size == capacity) {
|
||||
capacity *= 2;
|
||||
array = realloc(array, capacity * sizeof(int));
|
||||
if (!array) {
|
||||
perror("Memory allocation failed");
|
||||
fclose(file);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
array[size++] = num;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
long r, r1, r2, r3 = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
long n = array[i];
|
||||
for (int s = 0; s < 2000; s++) {
|
||||
r1 = n * 64;
|
||||
mix(&n, r1);
|
||||
prune(&n);
|
||||
|
||||
r2 = floor(n / 32.0);
|
||||
mix(&n, r2);
|
||||
prune(&n);
|
||||
|
||||
r3 = n * 2048;
|
||||
mix(&n, r3);
|
||||
prune(&n);
|
||||
}
|
||||
r += n;
|
||||
}
|
||||
printf("%li\n", r);
|
||||
|
||||
free(array);
|
||||
return 0;
|
||||
}
|
||||
2
S1/GdCP/bus.c
Normal file
2
S1/GdCP/bus.c
Normal file
@@ -0,0 +1,2 @@
|
||||
int rec_contains(int **pos, int *start, int *end, int x);
|
||||
|
||||
12
S1/GdCP/chars.c
Normal file
12
S1/GdCP/chars.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include "float.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("%f", DBL_MIN);
|
||||
int a = 1;
|
||||
printf("%d", a);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
7
S1/GdCP/cklausur.txt
Normal file
7
S1/GdCP/cklausur.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
1. Funktion bekommt string und pattern string sowie eine flag fuer strict
|
||||
|
||||
Gibt zurueck ob die Buchstaben vom pattern alle in der richtigen reihenfolge im String vorkommen.
|
||||
|
||||
2. Rekursive bestimmung von der Wurzel einer Zahl. Die Vorschrift ist gegeben durck p0 = 1, pn = pn-1
|
||||
|
||||
Die Bearbeiteten Aufgaben sind im Workspace Ordner.
|
||||
24
S1/GdCP/clean.c
Normal file
24
S1/GdCP/clean.c
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#include<stdio.h>
|
||||
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#define N 998
|
||||
|
||||
int main() {
|
||||
int b = 0, r = 0, i = 0;
|
||||
while ((b = getchar()) != '\n') {
|
||||
if (i % 2 == 0) r -= b - '0';
|
||||
else r += b - '0';
|
||||
i++;
|
||||
}
|
||||
if(r == -4) r = 4;
|
||||
if(r == -10) r = 10;
|
||||
if(r == -1) r = 1;
|
||||
printf("%d\n", r);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
22
S1/GdCP/code.c
Normal file
22
S1/GdCP/code.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
|
||||
char* convert_message(const char *message, char receiver) {
|
||||
char *out = strdup(message);
|
||||
if (receiver != 'M' && receiver != 'L') return "Mit dir schreib ich nicht!";
|
||||
int c = 0;
|
||||
for (int i = 0; message[i] != '\0'; i++) {
|
||||
if (isalpha(message[i])) {
|
||||
if (receiver == 'M') {
|
||||
if (c % 2 == 1) out[i] = toupper(message[i]);
|
||||
else out[i] = tolower(message[i]);
|
||||
}
|
||||
else {
|
||||
if (c % 2 == 0) out[i] = toupper(message[i]);
|
||||
else out[i] = tolower(message[i]);
|
||||
}
|
||||
c++;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
38
S1/GdCP/day.c
Normal file
38
S1/GdCP/day.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include<stdio.h>
|
||||
|
||||
// Lists to define the calendar
|
||||
char *day[7] = {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"};
|
||||
int months[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
int leap = 29;
|
||||
|
||||
// Check for leap year
|
||||
int isleap(int y) {
|
||||
return ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Stating date for the 1.1.1600 is a Saturday
|
||||
int n = 5;
|
||||
|
||||
// Read in the date
|
||||
int d, m, y;
|
||||
scanf("%d.%d.%d", &d, &m, &y);
|
||||
// Check for errors
|
||||
if (d < 1 || m < 1 || m > 12 || d > months[m-1] || y < 1600 || y > 4000) return 1;
|
||||
|
||||
// Get the number of days passed
|
||||
for (int i = 1600; i < y; i++) {
|
||||
if (isleap(i)) n+= 366;
|
||||
else n += 365;
|
||||
}
|
||||
for (int i = 0; i < m - 1; i++) {
|
||||
if (isleap(y)) {
|
||||
if (i == 1) n += leap;
|
||||
else n += months[i];
|
||||
} else n += months[i];
|
||||
}
|
||||
n += d - 1;
|
||||
|
||||
// Print the day
|
||||
printf("%s\n", day[n % 7]);
|
||||
}
|
||||
12
S1/GdCP/days.c
Normal file
12
S1/GdCP/days.c
Normal file
@@ -0,0 +1,12 @@
|
||||
int months[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
|
||||
int datum2int(int tag, int monat) {
|
||||
for (int i = 0; i < monat - 1; tag += months[i++]);
|
||||
return tag;
|
||||
}
|
||||
|
||||
void int2datum(int tage, int *ergebnis) {
|
||||
int m = 0;
|
||||
for (; tage > months[m]; tage -= months[m++]);
|
||||
ergebnis[0] = tage; ergebnis[1] = m+1;
|
||||
}
|
||||
4
S1/GdCP/func.c
Normal file
4
S1/GdCP/func.c
Normal file
@@ -0,0 +1,4 @@
|
||||
void prints(char *s) {
|
||||
puts(s);
|
||||
puts("hello from the other side!");
|
||||
}
|
||||
4
S1/GdCP/ggt.c
Normal file
4
S1/GdCP/ggt.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int strclean(char *t) {
|
||||
|
||||
|
||||
}
|
||||
BIN
S1/GdCP/klausur_c_1/a.out
Executable file
BIN
S1/GdCP/klausur_c_1/a.out
Executable file
Binary file not shown.
107
S1/GdCP/klausur_c_1/binary_find.c
Normal file
107
S1/GdCP/klausur_c_1/binary_find.c
Normal file
@@ -0,0 +1,107 @@
|
||||
#include<stdlib.h>
|
||||
#include<stdio.h>
|
||||
#include<time.h>
|
||||
|
||||
int suche(int **pos, int *s, int *e, int x) {
|
||||
// Binary search wobei e IMMER hinter das letzte element zeigen muss!
|
||||
|
||||
if (s == NULL || e == NULL || s > e) {
|
||||
*pos = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (s < e) {
|
||||
int l = e - s;
|
||||
int m = l / 2;
|
||||
|
||||
if (s[m] == x) {
|
||||
*pos = s + m;
|
||||
return 1;
|
||||
}
|
||||
else if (s[m] > x) {
|
||||
e = s + m;
|
||||
}
|
||||
else {
|
||||
s = s + m + 1;
|
||||
}
|
||||
}
|
||||
|
||||
*pos = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Main loop for the problem
|
||||
int main(int argc, char *argv[]) {
|
||||
srand(time(NULL));
|
||||
// Check for the right amount of args
|
||||
if (argc != 3) {
|
||||
printf("wrong amount of arguments!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get the parameters
|
||||
int n = atoi(argv[1]);
|
||||
int k = atoi(argv[2]);
|
||||
|
||||
// Checken ob das n Arguemnt richtig gegeben wurde
|
||||
if (n < 1) {
|
||||
printf("n ist zu klein gewaehlt oder konnte nicht gelesen werden!\n");
|
||||
|
||||
// Hier wird die suche mit Null pointern gestartet
|
||||
int buf = suche(0, 0, 0, 0);
|
||||
printf("Ergebnis der Suche: %d.\n", buf);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Generate random ascending field of length n
|
||||
int *m = malloc(sizeof(int) * n);
|
||||
if (!m) {
|
||||
printf("it was not possible to allocate memory!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Erzeugen eins aufsteigenden Feldes
|
||||
m[0] = rand()%n+1;
|
||||
for(int i = 1; i < n; i++) {
|
||||
m[i] = m[i-1] + rand()%(n*2)+1;
|
||||
|
||||
// Es soll nach moeglichen Ueberlaufen geprueft werden
|
||||
// Wie kann man das anders machen als zu pruefen ob die zahl kleiner ist?
|
||||
if (m[i] < m[i-1]) {
|
||||
printf("es gab ein Problem!\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Print the field
|
||||
for(int i = 0; i < n - 1; i++) {
|
||||
printf("%d ", m[i]);
|
||||
}
|
||||
printf("%d\n", m[n-1]);
|
||||
|
||||
|
||||
int *pos;
|
||||
int buf;
|
||||
if (k >= 0 && k < n) {
|
||||
// k ist ein valider Index vom Feld
|
||||
printf("%d", m[k]);
|
||||
buf = suche(&pos, m, m+n, m[k]);
|
||||
} else {
|
||||
buf = suche(&pos, m, m+n, k);
|
||||
}
|
||||
|
||||
printf("Das Ergebnis der Suche ist %d.\n"
|
||||
"Der Zeiger hat die relative position (Nur relevant wenn suche 1) %d.\n"
|
||||
"Der Zeiger hat die absolute Postion (Nur relevant wenn suche 0) %d.\n", buf, pos - m, pos);
|
||||
|
||||
|
||||
// Noch zu tun ist das aufrufen von der find methode in den verschiedenen aesten.
|
||||
// und das jeweilige zurueckgeben ob der Wert gefunden wurde und der pointer.
|
||||
|
||||
free(m);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIN
S1/GdCP/klausur_c_1/binary_find.o
Normal file
BIN
S1/GdCP/klausur_c_1/binary_find.o
Normal file
Binary file not shown.
85
S1/GdCP/klausur_c_1/brueche.c
Normal file
85
S1/GdCP/klausur_c_1/brueche.c
Normal file
@@ -0,0 +1,85 @@
|
||||
#include<stdlib.h>
|
||||
#include<stdio.h>
|
||||
#include<time.h>
|
||||
|
||||
// This is the definition for a fraction from the task
|
||||
typedef struct {
|
||||
int n;
|
||||
int d;
|
||||
} fraction_t;
|
||||
|
||||
fraction_t sub_frac(fraction_t *a, fraction_t *b) {
|
||||
// this function should substract fractions from anonther
|
||||
// with the condition that a/b - c/d = (ad + bc)/(bd)
|
||||
// also check that the negative sign always is on the nominator
|
||||
|
||||
fraction_t r = {0};
|
||||
|
||||
// Check for edge cases
|
||||
if (!a || !b || a->d == 0 || b->d == 0) return r;
|
||||
|
||||
|
||||
// Calculate the result
|
||||
r.n = a->n * b->d - a->d * b->n;
|
||||
r.d = a->d * b->d;
|
||||
|
||||
// flip the signs
|
||||
if (r.d < 0) {
|
||||
r.d *= -1; r.n *= -1;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
fraction_t *max_frac(fraction_t a[], int l) {
|
||||
// This function should return a pointer to the biggest fraction in the array
|
||||
// Do this with the condition that if a - b < 0 it follows that a < b.
|
||||
|
||||
// Init the max
|
||||
fraction_t *m = a;
|
||||
|
||||
// Find the max
|
||||
for (int i = 1; i < l; i++) {
|
||||
if (sub_frac(m, a + i).n < 0) {
|
||||
m = a + i;
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
#define N 10
|
||||
|
||||
void print_frac(fraction_t *f) {
|
||||
printf("%d/%d ", f->n, f->d);
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Seed the randomness
|
||||
srand(time(NULL));
|
||||
|
||||
// Generate a list of random fractions
|
||||
fraction_t l[N];
|
||||
for (int i = 0; i < N; i++) {
|
||||
fraction_t r = {rand()%5+1, rand()%5+1};
|
||||
|
||||
// Also give a random sign
|
||||
if (rand()%2 == 0) {
|
||||
r.n *= -1;
|
||||
}
|
||||
l[i] = r;
|
||||
}
|
||||
|
||||
// print the fracions
|
||||
for (int i = 0; i < N; i++) {
|
||||
print_frac(l +i);
|
||||
}
|
||||
putchar('\n');
|
||||
|
||||
// Print the max Fraction
|
||||
fraction_t *max = max_frac(l, N);
|
||||
printf("The max fraction is: ");
|
||||
print_frac(max);
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
BIN
S1/GdCP/klausur_c_1/brueche.o
Normal file
BIN
S1/GdCP/klausur_c_1/brueche.o
Normal file
Binary file not shown.
31
S1/GdCP/klausur_c_1/sqrtrec.c
Normal file
31
S1/GdCP/klausur_c_1/sqrtrec.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include<float.h>
|
||||
#include<stdio.h>
|
||||
#include<math.h>
|
||||
|
||||
//#include "testing-0xx.h"
|
||||
|
||||
double sqrt_rec(double x, double p) {
|
||||
// Check for edge cases
|
||||
if (x == 0 || x < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the next element like the formula provided
|
||||
double next = 0.5 * (p + x/p);
|
||||
|
||||
// Decide whether to go further
|
||||
if (fabs(next - p) < DBL_EPSILON) {
|
||||
return next;
|
||||
}
|
||||
|
||||
// Recusrevely try the next element in the series
|
||||
return sqrt_rec(x, next);
|
||||
}
|
||||
|
||||
int main() {
|
||||
printf("%f\n", sqrt_rec(2, 1));
|
||||
printf("%f\n", sqrt_rec(4, 1));
|
||||
printf("%f\n", sqrt_rec(8, 1));
|
||||
printf("%f\n", sqrt_rec(9, 1));
|
||||
}
|
||||
|
||||
BIN
S1/GdCP/klausur_c_1/sqrtrec.o
Normal file
BIN
S1/GdCP/klausur_c_1/sqrtrec.o
Normal file
Binary file not shown.
46
S1/GdCP/klausur_c_1/strmatch.c
Normal file
46
S1/GdCP/klausur_c_1/strmatch.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
|
||||
int str_match(const char s[], const char p[], int strict) {
|
||||
// takes string and pattern and strict flag
|
||||
// should return if the characters in the pattern appear in the string in the same order
|
||||
// strict should also check for difference in capital letters
|
||||
// it does not matter whether there are characters in between (other)
|
||||
|
||||
int ls = strlen(s);
|
||||
int lp = strlen(p);
|
||||
int o = -1;
|
||||
|
||||
// Loop the patterns and the string for each pattern
|
||||
for (const char *cp = p; *p != '\0'; p++) {
|
||||
for (int j = 0; j < ls; j++) {
|
||||
char chp = *p;
|
||||
char cha = s[j];
|
||||
|
||||
if (!strict) {
|
||||
chp = (char) tolower(chp); cha = (char) tolower(cha);
|
||||
}
|
||||
if (cha == chp) {
|
||||
// Break condition
|
||||
if (j < o) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set the new occurence
|
||||
o = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include<stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("%d\n", str_match("Hallo Welt", "alo", 1));
|
||||
printf("%d\n", str_match("Hallo Welt", "alo", 0));
|
||||
printf("%d\n", str_match("Hallo Welt", "alho", 1));
|
||||
printf("%d\n", str_match("Hallo Welt", "alho", 0));
|
||||
}
|
||||
|
||||
BIN
S1/GdCP/klausur_c_1/strmatch.o
Normal file
BIN
S1/GdCP/klausur_c_1/strmatch.o
Normal file
Binary file not shown.
6
S1/GdCP/link.h
Normal file
6
S1/GdCP/link.h
Normal file
@@ -0,0 +1,6 @@
|
||||
void prints(char *s);
|
||||
|
||||
int main() {
|
||||
prints("HELLO");
|
||||
|
||||
}
|
||||
50
S1/GdCP/matrix.c
Normal file
50
S1/GdCP/matrix.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include<stdio.h>
|
||||
#define N 20
|
||||
void print(int m[N][N], int a, int b) {
|
||||
for (int i = 0; i < a; i++) {
|
||||
for (int j = 0; j < b - 1; j++) {
|
||||
printf("%d ", m[i][j]);
|
||||
}
|
||||
printf("%d\n", m[i][b-1]);
|
||||
}
|
||||
|
||||
}
|
||||
int main() {
|
||||
int m1[N][N], m = 0, n = 0;
|
||||
int m2[N][N], o = 0, p = 0;
|
||||
int m3[N][N];
|
||||
|
||||
scanf("%d %d", &n, &m);
|
||||
if (m > 20 || n > 20) return 1;
|
||||
for (int i = 0; i < m; i++) {
|
||||
for (int j = 0; j < n; j++) {
|
||||
scanf("%d", &m1[i][j]);
|
||||
}
|
||||
}
|
||||
scanf("%d %d", &p, &o);
|
||||
if (o > 20 || p > 20 || n != o) return 1;
|
||||
for (int i = 0; i < o; i++) {
|
||||
for (int j = 0; j < p; j++) {
|
||||
scanf("%d", &m2[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < m; i++) {
|
||||
for (int j = 0; j < p; j++) {
|
||||
int res = 0;
|
||||
for (int k = 0; k < n; k++) {
|
||||
res += m1[i][k] * m2[k][j];
|
||||
}
|
||||
m3[i][j] = res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print(m3, m, p);
|
||||
|
||||
|
||||
|
||||
}
|
||||
258
S1/GdCP/pixel.c
Normal file
258
S1/GdCP/pixel.c
Normal file
@@ -0,0 +1,258 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define SCREEN_WIDTH 800
|
||||
#define SCREEN_HEIGHT 600
|
||||
#define NUM_PARTICLES 200
|
||||
#define NUM_TYPES 2
|
||||
#define FORCE_SCALE 100.0
|
||||
#define PARTICLE_RADIUS 5
|
||||
#define GRID_SIZE 50 // Spatial grid size
|
||||
|
||||
typedef struct Particle {
|
||||
float x, y; // Position
|
||||
float vx, vy; // Velocity
|
||||
int type; // Particle type (0, 1, 2... NUM_TYPES-1)
|
||||
struct Particle *next; // Linked list pointer for spatial grid
|
||||
} Particle;
|
||||
|
||||
typedef struct {
|
||||
int x, y; // Top-left corner of slider
|
||||
int width, height;
|
||||
float *value; // Pointer to the value it modifies
|
||||
} Slider;
|
||||
|
||||
Particle particles[NUM_PARTICLES];
|
||||
float force_matrix[NUM_TYPES][NUM_TYPES];
|
||||
Slider sliders[NUM_TYPES * NUM_TYPES];
|
||||
int grid_cols, grid_rows;
|
||||
Particle **grid = NULL; // Dynamic grid allocation
|
||||
|
||||
void init_particles() {
|
||||
srand((unsigned int)time(NULL));
|
||||
for (int i = 0; i < NUM_PARTICLES; i++) {
|
||||
particles[i].x = rand() % SCREEN_WIDTH;
|
||||
particles[i].y = rand() % SCREEN_HEIGHT;
|
||||
particles[i].vx = (rand() % 200 - 100) / 100.0f;
|
||||
particles[i].vy = (rand() % 200 - 100) / 100.0f;
|
||||
particles[i].type = rand() % NUM_TYPES;
|
||||
particles[i].next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void init_force_matrix() {
|
||||
for (int i = 0; i < NUM_TYPES; i++) {
|
||||
for (int j = 0; j < NUM_TYPES; j++) {
|
||||
force_matrix[i][j] = (rand() % 200 - 100) * FORCE_SCALE / 100.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_sliders() {
|
||||
int slider_width = 100;
|
||||
int slider_height = 10;
|
||||
int spacing = 20;
|
||||
int start_x = 10, start_y = SCREEN_HEIGHT - NUM_TYPES * spacing - 30;
|
||||
|
||||
for (int i = 0; i < NUM_TYPES; i++) {
|
||||
for (int j = 0; j < NUM_TYPES; j++) {
|
||||
Slider *slider = &sliders[i * NUM_TYPES + j];
|
||||
slider->x = start_x + j * (slider_width + 5);
|
||||
slider->y = start_y + i * spacing;
|
||||
slider->width = slider_width;
|
||||
slider->height = slider_height;
|
||||
slider->value = &force_matrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handle_sliders(SDL_Event *event) {
|
||||
if (event->type == SDL_MOUSEBUTTONDOWN || event->type == SDL_MOUSEMOTION) {
|
||||
int mx, my;
|
||||
Uint32 buttons = SDL_GetMouseState(&mx, &my);
|
||||
if (buttons & SDL_BUTTON(SDL_BUTTON_LEFT)) {
|
||||
for (int i = 0; i < NUM_TYPES * NUM_TYPES; i++) {
|
||||
Slider *slider = &sliders[i];
|
||||
if (mx >= slider->x && mx <= slider->x + slider->width &&
|
||||
my >= slider->y && my <= slider->y + slider->height) {
|
||||
float new_value = (float)(mx - slider->x) / slider->width * 2 - 1;
|
||||
*slider->value = new_value * FORCE_SCALE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void update_particles(float dt) {
|
||||
// Clear the grid
|
||||
for (int i = 0; i < grid_cols * grid_rows; i++) {
|
||||
grid[i] = NULL;
|
||||
}
|
||||
|
||||
// Assign particles to the grid
|
||||
for (int i = 0; i < NUM_PARTICLES; i++) {
|
||||
int gx = particles[i].x / GRID_SIZE;
|
||||
int gy = particles[i].y / GRID_SIZE;
|
||||
if (gx >= 0 && gx < grid_cols && gy >= 0 && gy < grid_rows) {
|
||||
int cell_index = gy * grid_cols + gx;
|
||||
particles[i].next = grid[cell_index];
|
||||
grid[cell_index] = &particles[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Update particles
|
||||
for (int i = 0; i < NUM_PARTICLES; i++) {
|
||||
Particle *p = &particles[i];
|
||||
int gx = p->x / GRID_SIZE;
|
||||
int gy = p->y / GRID_SIZE;
|
||||
|
||||
float fx = 0, fy = 0;
|
||||
|
||||
// Check surrounding grid cells
|
||||
for (int dx = -1; dx <= 1; dx++) {
|
||||
for (int dy = -1; dy <= 1; dy++) {
|
||||
int ngx = gx + dx;
|
||||
int ngy = gy + dy;
|
||||
if (ngx >= 0 && ngx < grid_cols && ngy >= 0 && ngy < grid_rows) {
|
||||
int cell_index = ngy * grid_cols + ngx;
|
||||
Particle *neighbor = grid[cell_index];
|
||||
while (neighbor) {
|
||||
if (neighbor != p) {
|
||||
float dx = neighbor->x - p->x;
|
||||
float dy = neighbor->y - p->y;
|
||||
float dist2 = dx * dx + dy * dy;
|
||||
if (dist2 > 0 && dist2 < 2500) { // Squared distance
|
||||
float force =
|
||||
force_matrix[p->type][neighbor->type] / sqrtf(dist2);
|
||||
fx += force * dx;
|
||||
fy += force * dy;
|
||||
}
|
||||
}
|
||||
neighbor = neighbor->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply forces and update positions
|
||||
p->vx += fx * dt;
|
||||
p->vy += fy * dt;
|
||||
p->x += p->vx * dt;
|
||||
p->y += p->vy * dt;
|
||||
|
||||
// Handle boundaries
|
||||
if (p->x < 0 || p->x > SCREEN_WIDTH)
|
||||
p->vx *= -1;
|
||||
if (p->y < 0 || p->y > SCREEN_HEIGHT)
|
||||
p->vy *= -1;
|
||||
p->x = fmaxf(0, fminf(SCREEN_WIDTH, p->x));
|
||||
p->y = fmaxf(0, fminf(SCREEN_HEIGHT, p->y));
|
||||
}
|
||||
}
|
||||
|
||||
void render_particles(SDL_Renderer *renderer) {
|
||||
for (int i = 0; i < NUM_PARTICLES; i++) {
|
||||
Particle *p = &particles[i];
|
||||
switch (p->type) {
|
||||
case 0:
|
||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
|
||||
break;
|
||||
case 1:
|
||||
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
|
||||
break;
|
||||
case 2:
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
|
||||
break;
|
||||
default:
|
||||
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||
break;
|
||||
}
|
||||
SDL_Rect rect = {(int)p->x - PARTICLE_RADIUS, (int)p->y - PARTICLE_RADIUS,
|
||||
PARTICLE_RADIUS * 2, PARTICLE_RADIUS * 2};
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
void render_sliders(SDL_Renderer *renderer) {
|
||||
for (int i = 0; i < NUM_TYPES * NUM_TYPES; i++) {
|
||||
Slider *slider = &sliders[i];
|
||||
SDL_SetRenderDrawColor(renderer, 200, 200, 200, 255);
|
||||
SDL_Rect rect = {slider->x, slider->y, slider->width, slider->height};
|
||||
SDL_RenderFillRect(renderer, &rect);
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
|
||||
int handle_x =
|
||||
slider->x + ((*slider->value / FORCE_SCALE + 1) / 2) * slider->width;
|
||||
SDL_Rect handle = {handle_x - 5, slider->y, 10, slider->height};
|
||||
SDL_RenderFillRect(renderer, &handle);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Window *window = SDL_CreateWindow(
|
||||
"Particle Simulator", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
|
||||
if (!window) {
|
||||
fprintf(stderr, "Could not create window: %s\n", SDL_GetError());
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Renderer *renderer =
|
||||
SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||
if (!renderer) {
|
||||
fprintf(stderr, "Could not create renderer: %s\n", SDL_GetError());
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Initialize components
|
||||
init_particles();
|
||||
init_force_matrix();
|
||||
init_sliders();
|
||||
|
||||
grid_cols = SCREEN_WIDTH / GRID_SIZE;
|
||||
grid_rows = SCREEN_HEIGHT / GRID_SIZE;
|
||||
grid = (Particle **)calloc(grid_cols * grid_rows, sizeof(Particle *));
|
||||
|
||||
int running = 1;
|
||||
SDL_Event event;
|
||||
Uint32 last_time = SDL_GetTicks();
|
||||
|
||||
while (running) {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
running = 0;
|
||||
} else {
|
||||
handle_sliders(&event);
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 current_time = SDL_GetTicks();
|
||||
float dt = (current_time - last_time) / 1000.0f;
|
||||
last_time = current_time;
|
||||
|
||||
update_particles(dt);
|
||||
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
render_particles(renderer);
|
||||
render_sliders(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
// Clean up
|
||||
free(grid);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
22
S1/GdCP/sms.c
Normal file
22
S1/GdCP/sms.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include<stdio.h>
|
||||
#include<ctype.h>
|
||||
#include<string.h>
|
||||
|
||||
int main() {
|
||||
char s[161], m1[161], m2[161];
|
||||
int c1 = 0, c2 = 0;
|
||||
|
||||
fgets(s, sizeof(s), stdin);
|
||||
|
||||
for (int i = 0; i < strlen(s); i++) {
|
||||
if (isalpha(s[i])) {
|
||||
if (isupper(s[i])) {
|
||||
m1[c1++] = s[i];
|
||||
} else m2[c2++] = s[i];
|
||||
}
|
||||
|
||||
}
|
||||
printf("Nachricht an Toni: %s\n", m1);
|
||||
printf("Nachricht an Tomke: %s\n", m2);
|
||||
|
||||
}
|
||||
14
S1/GdCP/square.c
Normal file
14
S1/GdCP/square.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int num, sum = 0;
|
||||
scanf("%d", &num);
|
||||
|
||||
while (num > 0) {
|
||||
sum += num % 10;
|
||||
num /= 10;
|
||||
}
|
||||
|
||||
printf("%d\n", sum);
|
||||
return 0;
|
||||
}
|
||||
7
S1/GdCP/test.c
Normal file
7
S1/GdCP/test.c
Normal file
@@ -0,0 +1,7 @@
|
||||
d
|
||||
th
|
||||
|
||||
|
||||
sadfljsafl
|
||||
sadfljsafl
|
||||
|
||||
41
S1/GdCP/testcprogram.c
Normal file
41
S1/GdCP/testcprogram.c
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
#include<stdio.h>
|
||||
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#define N 998
|
||||
|
||||
int *find_next(int *a) {
|
||||
for (int i = 0; i < N; i++) if (a[i] != 0) return a + i;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void kill_mults(int *a, int m) {
|
||||
for (int i = 0; i < N; i++) if (a[i] % m == 0) a[i] = 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Setup all numbers
|
||||
int n[N], *c;
|
||||
int p[N], r = 0;
|
||||
for (int i = 0; i < N; i++) {
|
||||
n[i] = i + 2;
|
||||
}
|
||||
|
||||
while (1){
|
||||
int *c = find_next(n);
|
||||
if ((c = find_next()) == NULL) break;
|
||||
p[r++] = *c;
|
||||
kill_mults(n, *c);
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < r; i++) {
|
||||
printf("%d ", p[i]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
S2/AnaMech/.unicourse
Normal file
2
S2/AnaMech/.unicourse
Normal file
@@ -0,0 +1,2 @@
|
||||
name: Analytische Mechanik
|
||||
short: AnMe
|
||||
@@ -1,6 +1,6 @@
|
||||
#import "./preamble.typ": *
|
||||
|
||||
#show: conf.with(num: 4)
|
||||
#show: conf.with(num: 1)
|
||||
= Einleitung
|
||||
|
||||
Newton < Lagrange < Hamilton
|
||||
@@ -1,85 +0,0 @@
|
||||
#import "./preamble.typ": *
|
||||
#show: conf.with(num: 4)
|
||||
|
||||
= Studienleistungen
|
||||
|
||||
- mind. 2x vorrechnen
|
||||
|
||||
= Integration
|
||||
|
||||
#flashcard(0)[onw][
|
||||
sf
|
||||
]
|
||||
|
||||
Idee:
|
||||
|
||||
- Differenzieren:
|
||||
$
|
||||
F: I -> RR \
|
||||
F'(x) = lim_(x -> oo)
|
||||
$<okay>
|
||||
|
||||
Die Idee ist nach einer Funktion zu fragen, welche die Vorschrift $F' = f$ erfuellt.
|
||||
|
||||
Dazu kann in 2 Dimensionen der Flaecheninhalt unter dem Graphen der Funktion ermittelt werden.
|
||||
|
||||
== Unbestimmte Integration
|
||||
|
||||
Frage:
|
||||
|
||||
Gegeben sei ein Intervall $I$ in RR und eine Funktion $f: I -> RR$
|
||||
|
||||
Finden wir $F: I -> RR$ mit $F' = f$?
|
||||
|
||||
#definition[
|
||||
Gegeben: $I <= RR$ Intervall
|
||||
|
||||
$F, f: I -> RR$
|
||||
|
||||
- $F$ eine Stammfunktion zu f auf I oder unbestimmtes
|
||||
]
|
||||
|
||||
Beachte:
|
||||
|
||||
Gegeben seien Stammfunktionen $F_1, F_2$ zu $f$
|
||||
|
||||
$
|
||||
==> (F_1 - F_2)'(x) = f(x) - f(x) = 0\
|
||||
==> F_1 - F_2 "konstant auf" I
|
||||
$
|
||||
|
||||
Man ueberprueft ob eine Funktion eine Stammfunktion ist anhand der Definition.
|
||||
|
||||
Nicht jede Funktion hat eine Stammfunktion.
|
||||
|
||||
|
||||
#theorem[
|
||||
Zwischenwertsatz fuer Ableitungen
|
||||
|
||||
Sei $F: [a,b] -> RR$ diffb.
|
||||
|
||||
$
|
||||
==> F' "nimmt auf" (a,b) "jeden Wert zwischen" F'(a) "und" F'(b) "an".
|
||||
$ <zws>
|
||||
]
|
||||
|
||||
#proof[
|
||||
// TODO: write this proof
|
||||
|
||||
]
|
||||
|
||||
Die Funktion, welche eine Stufenfunktion ist hat keine Stammfunktion, da sie im Widerspruch zu Satz @zws steht.
|
||||
|
||||
#theorem[
|
||||
Summenregen fuer Integration
|
||||
|
||||
Seien $I, I_0 "Intervalle in" RR$ uns $alpha_1, ... alpha_n in RR$
|
||||
|
||||
- Gegeben:
|
||||
|
||||
$f_1, ...,f_n I -> RR $
|
||||
// TODO: zuende schreiben
|
||||
|
||||
]
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
6
S2/AnaMech/template.typ
Normal file
6
S2/AnaMech/template.typ
Normal file
@@ -0,0 +1,6 @@
|
||||
#import "./preamble.typ": *
|
||||
|
||||
#show: conf.with(num: 1)
|
||||
|
||||
= Uebersicht
|
||||
|
||||
2
S2/CWR/.unicourse
Normal file
2
S2/CWR/.unicourse
Normal file
@@ -0,0 +1,2 @@
|
||||
name: Computerwissenschaftliches Rechnen
|
||||
short: Cwr
|
||||
Binary file not shown.
BIN
S2/CWR/pdfs/template.pdf
Normal file
BIN
S2/CWR/pdfs/template.pdf
Normal file
Binary file not shown.
3
S2/CWR/template.typ
Normal file
3
S2/CWR/template.typ
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
= Uebersicht
|
||||
|
||||
2
S2/DiffII/.unicourse
Normal file
2
S2/DiffII/.unicourse
Normal file
@@ -0,0 +1,2 @@
|
||||
name: Diff II
|
||||
short: DiII
|
||||
3
S2/DiffII/VL/DiIIVL2.typ
Normal file
3
S2/DiffII/VL/DiIIVL2.typ
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
= Uebersicht bla
|
||||
|
||||
6
S2/DiffII/VL/DiIIVL3.typ
Normal file
6
S2/DiffII/VL/DiIIVL3.typ
Normal file
@@ -0,0 +1,6 @@
|
||||
#import "./preamble.typ": *
|
||||
|
||||
#show: conf.with(num: 1)
|
||||
|
||||
= Uebersicht
|
||||
|
||||
5
S2/DiffII/VL/DiIIVL4.typ
Normal file
5
S2/DiffII/VL/DiIIVL4.typ
Normal file
@@ -0,0 +1,5 @@
|
||||
// Diff template
|
||||
|
||||
|
||||
= Uebersicht
|
||||
|
||||
Binary file not shown.
BIN
S2/DiffII/pdfs/DiIIVL2.pdf
Normal file
BIN
S2/DiffII/pdfs/DiIIVL2.pdf
Normal file
Binary file not shown.
BIN
S2/DiffII/pdfs/DiIIVL4.pdf
Normal file
BIN
S2/DiffII/pdfs/DiIIVL4.pdf
Normal file
Binary file not shown.
7
S2/DiffII/template.typ
Normal file
7
S2/DiffII/template.typ
Normal file
@@ -0,0 +1,7 @@
|
||||
// Diff template
|
||||
#import "./preamble.typ": *
|
||||
|
||||
#show: conf.with(num: 1)
|
||||
|
||||
= Uebersicht
|
||||
|
||||
2
S2/ExPhyII/.unicourse
Normal file
2
S2/ExPhyII/.unicourse
Normal file
@@ -0,0 +1,2 @@
|
||||
name: Experimentalphysik II
|
||||
short: ExII
|
||||
Binary file not shown.
6
S2/ExPhyII/template.typ
Normal file
6
S2/ExPhyII/template.typ
Normal file
@@ -0,0 +1,6 @@
|
||||
#import "./preamble.typ": *
|
||||
|
||||
#show: conf.with(num: 1)
|
||||
|
||||
= Uebersicht
|
||||
|
||||
2
S2/Neuro/.unicourse
Normal file
2
S2/Neuro/.unicourse
Normal file
@@ -0,0 +1,2 @@
|
||||
name: Computational Neuroscience
|
||||
short: Neuro
|
||||
0
S2/Neuro/NeuroVL1.typ
Normal file
0
S2/Neuro/NeuroVL1.typ
Normal file
6
S2/Neuro/VL/NeuroVL1.typ
Normal file
6
S2/Neuro/VL/NeuroVL1.typ
Normal file
@@ -0,0 +1,6 @@
|
||||
#import "./preamble.typ": *
|
||||
|
||||
#show: conf.with(num: 1)
|
||||
|
||||
= Uebersicht
|
||||
|
||||
6
S2/Neuro/template.typ
Normal file
6
S2/Neuro/template.typ
Normal file
@@ -0,0 +1,6 @@
|
||||
#import "./preamble.typ": *
|
||||
|
||||
#show: conf.with(num: 1)
|
||||
|
||||
= Uebersicht
|
||||
|
||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
||||
= Einleitung
|
||||
|
||||
Folien sind auf StudIP verfuegbar.
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 82 KiB |
@@ -1,8 +0,0 @@
|
||||
# Links
|
||||
ExPhy Uebung Di 16-18 NR 7:
|
||||
https://ecampus.uni-goettingen.de/h1/pages/cs/sys/portal/hisinoneIframePage.faces?id=studip&navigationPosition=link_studip&url=https%3A%2F%2Fstudip-ecampus.uni-goettingen.de%2Findex.php%3Fsso%3Dcasgoe%26cancel_login%3D1%26again%3Dyes%26redirect_to%3Dhttps%253A%252F%252Fstudip-ecampus.uni-goettingen.de%252Fdispatch.php%252Fmy_courses%26redirect_token%3D947a61f0a9df959879bce689abac0ffa
|
||||
|
||||
|
||||
# Other modules
|
||||
Zusammenhang Mensch und Natur; Modul B.Phy.1609
|
||||
|
||||
3
S3/links.md
Normal file
3
S3/links.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Links
|
||||
|
||||
Preparation for the third semester links
|
||||
BIN
pdfs/template.pdf
Normal file
BIN
pdfs/template.pdf
Normal file
Binary file not shown.
14
preamble.typ
Normal file
14
preamble.typ
Normal file
@@ -0,0 +1,14 @@
|
||||
#import "./default.typ": *
|
||||
|
||||
#let conf(num: none, ueb: false, body) = {
|
||||
// Global settings
|
||||
show: default
|
||||
|
||||
// Set the header
|
||||
[Testing Preamble]
|
||||
// Make tcahe outline
|
||||
outline()
|
||||
|
||||
// load the document
|
||||
body
|
||||
}
|
||||
@@ -4,5 +4,3 @@
|
||||
|
||||
= Uebersicht
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user