diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | fiz/vaje/10/.gitignore | 1 | ||||
-rw-r--r-- | fiz/vaje/10/dokument.lyx | 49 | ||||
-rwxr-xr-x | fiz/vaje/10/tab.py | 22 | ||||
-rw-r--r-- | inf/rn/dok/lyx/Summary.lyx | 28 | ||||
-rw-r--r-- | inf/rn/dok/lyx/eksperimentalni.lyx | 24 | ||||
-rw-r--r-- | inf/rn/dok/lyx/thesis.lyx | 78 | ||||
-rw-r--r-- | inf/rn/dok/lyx/uvod.lyx | 26 | ||||
-rw-r--r-- | inf/rn/dok/lyx/zaključek.lyx | 25 | ||||
-rwxr-xr-x | inf/zotksd/1 | bin | 0 -> 282656 bytes | |||
-rw-r--r-- | inf/zotksd/1.c | 57 | ||||
-rw-r--r-- | inf/zotksd/1.txt | 8 | ||||
-rw-r--r-- | inf/zotksd/1.txt2 | 8 | ||||
-rwxr-xr-x | inf/zotksd/2 | bin | 0 -> 284000 bytes | |||
-rw-r--r-- | inf/zotksd/2.c | 88 | ||||
-rw-r--r-- | inf/zotksd/2.txt | 3 | ||||
-rw-r--r-- | inf/zotksd/2.txt2 | 4 | ||||
-rwxr-xr-x | inf/zotksd/3 | bin | 0 -> 282408 bytes | |||
-rw-r--r-- | inf/zotksd/3.c | 22 | ||||
-rwxr-xr-x | inf/zotksd/4 | bin | 0 -> 283072 bytes | |||
-rw-r--r-- | inf/zotksd/4.c | 96 | ||||
-rw-r--r-- | inf/zotksd/4.txt | 2 | ||||
-rw-r--r-- | inf/zotksd/4.txt2 | 2 |
23 files changed, 515 insertions, 30 deletions
@@ -1,6 +1,6 @@ *.pdf .~lock.*.od*# -fit.log +*.log core *.lyx~ \#*.lyx# diff --git a/fiz/vaje/10/.gitignore b/fiz/vaje/10/.gitignore index 8c9c1c2..da2a8f9 100644 --- a/fiz/vaje/10/.gitignore +++ b/fiz/vaje/10/.gitignore @@ -1,3 +1,4 @@ *.csv p.tsv podatki.lyx +graf.tex diff --git a/fiz/vaje/10/dokument.lyx b/fiz/vaje/10/dokument.lyx index 3209653..bf0df5c 100644 --- a/fiz/vaje/10/dokument.lyx +++ b/fiz/vaje/10/dokument.lyx @@ -124,10 +124,10 @@ Teoretični model \begin_inset Formula $s_{0}\left(\nu\right)$ \end_inset - je + harmoničnega nihala s tremi parametri je \begin_inset Formula \[ -s_{0}=A\frac{\omega}{\sqrt{\left(\omega^{2}+\omega_{0}^{2}\right)^{2}+4\beta^{2}\omega^{2}}}\text{{,}} +s_{0}=\frac{A}{\sqrt{\left(B^{2}-\omega^{2}\right)^{2}+C^{2}\omega^{2}}}\text{{,}} \] \end_inset @@ -145,15 +145,6 @@ kjer je \end_inset . - Resonančna frekvenca, razbrana iz grafa — vrh, je -\begin_inset Formula $6,5$ -\end_inset - - radianov na sekundo, kar je -\begin_inset Formula $6,5\pi2$ -\end_inset - - nihajev na sekundo. \end_layout \begin_layout Standard @@ -975,7 +966,8 @@ status open \begin_inset Caption Standard \begin_layout Plain Layout -Izmerjeni in izračunani podatki +Izmerjeni in izračunani podatki. + Podatek o amplitudi je natančen na milimeter. \end_layout \end_inset @@ -986,6 +978,10 @@ Izmerjeni in izračunani podatki \end_inset +\begin_inset Note Note +status open + +\begin_layout Plain Layout \begin_inset Float figure placement H wide false @@ -1044,14 +1040,14 @@ addlegendentry{meritve} \backslash -addplot[blue] (x, {0.490752637*x/sqrt((x^2+6.6^2)^2+4*(-0.000179148908)^2*x^2)}); +addplot[blue] (x, {0.47583543/sqrt(-6.87050654^2-x^2)^2+1.2365817^2*x^2}); \end_layout \begin_layout Plain Layout \backslash -addlegendentry{Teoretični model} +addlegendentry{$A=0.47583543$, $B=-6.87050654$, $C=1.2365817$} \end_layout \begin_layout Plain Layout @@ -1224,8 +1220,31 @@ name "fig:graf-1" \end_layout +\end_inset + + +\end_layout + \begin_layout Standard -Meritve se ne ujemajo z napovedano vrednostjo. +\begin_inset CommandInset include +LatexCommand input +filename "graf.tex" + +\end_inset + + +\end_layout + +\begin_layout Standard +Iz grafa za harmonično nihanje razberemo 6,819 kot +\begin_inset Formula $\omega_{0}$ +\end_inset + +, kar pomeni, da je resonančna frekvenca matematičnega nihala +\begin_inset Formula $\SI{1,085}{\per\second}$ +\end_inset + +. \end_layout \end_body diff --git a/fiz/vaje/10/tab.py b/fiz/vaje/10/tab.py index c5c24db..2b0bbae 100755 --- a/fiz/vaje/10/tab.py +++ b/fiz/vaje/10/tab.py @@ -1,7 +1,11 @@ #!/usr/bin/python3 import pandas -import sys +from sys import argv, stderr from math import pi +from numpy import sqrt, arange, argmax +from scipy.optimize import curve_fit +from matplotlib import pyplot +from tikzplotlib import get_tikz_code l = 23.5 df = pandas.read_csv("podatki.tsv", sep="\t") df.index.name = "idx" @@ -9,6 +13,18 @@ df["x"] = (df["y"]/13*l) df["omega"] = ((9.81/df["l"])**(1/2)) df["f"] = (df["omega"]*0.5/pi) df = df.astype(float).round(6); -data = df.values +def objective(x, A, B, C): + return A/sqrt((B**2-x**2)**2+C**2*x**2) +popt, _ = curve_fit(objective, df.values[:, 3], df.values[:, 2]) +print(popt, file=stderr) +pyplot.scatter(df.values[:, 3], df.values[:, 2]) +iksi = arange(min(df.values[:, 3]), max(df.values[:, 3]), 0.01) +ipsiloni = objective(iksi, popt[0], popt[1], popt[2]) +print(f"omega nič je {iksi[argmax(ipsiloni)]}, kar je {iksi[argmax(ipsiloni)]/2/pi} Hz", file=stderr) +pyplot.plot(iksi, ipsiloni, "--", color="red") +pyplot.xlabel('$s_0 \\left[\\si{\\meter}\\right]$') +pyplot.ylabel('$\\omega=2\\pi\\nu$') +pyplot.title("$s_0\\left(\\omega\\right)$") if __name__ == "__main__": - df.to_csv("/dev/stdout", sep=","); + # df.to_csv("/dev/stdout", sep=argv[1][0]); + print(get_tikz_code(axis_width="0.75\\textwidth")) diff --git a/inf/rn/dok/lyx/Summary.lyx b/inf/rn/dok/lyx/Summary.lyx index 963d4f6..c4bb94a 100644 --- a/inf/rn/dok/lyx/Summary.lyx +++ b/inf/rn/dok/lyx/Summary.lyx @@ -145,9 +145,31 @@ Porazdeljene razpršilne tabele (angl. \end_layout \begin_layout Standard -V raziskovalni nalogi je preverjena praktična zmožnost pridobivanja velike - količine podatkov v omrežju BitTorrent za P2P izmenjavo datotek, pridobljeni - podatki pa so analizirani. +V +\begin_inset Branch seminarska +inverted 1 +status open + +\begin_layout Standard +raziskovalni +\end_layout + +\end_inset + + +\begin_inset Branch seminarska +inverted 0 +status open + +\begin_layout Standard +seminarski +\end_layout + +\end_inset + + nalogi je preverjena praktična zmožnost pridobivanja velike količine podatkov + v omrežju BitTorrent za P2P izmenjavo datotek, pridobljeni podatki pa so + analizirani. Vsaka poizvedba po seznamu imetnikov datotek vsebuje ključ podatka v DHT in se prenese preko okoli \begin_inset Formula $\log_{2}n$ diff --git a/inf/rn/dok/lyx/eksperimentalni.lyx b/inf/rn/dok/lyx/eksperimentalni.lyx index 4fd6797..980ee7f 100644 --- a/inf/rn/dok/lyx/eksperimentalni.lyx +++ b/inf/rn/dok/lyx/eksperimentalni.lyx @@ -306,7 +306,29 @@ Eksperimentalni del \end_layout \begin_layout Standard -Namen raziskovalne naloge je prenesti čim več +Namen +\begin_inset Branch seminarska +inverted 1 +status open + +\begin_layout Standard +raziskovalne +\end_layout + +\end_inset + + +\begin_inset Branch seminarska +inverted 0 +status open + +\begin_layout Standard +seminarske +\end_layout + +\end_inset + + naloge je prenesti čim več \family typewriter info \family default diff --git a/inf/rn/dok/lyx/thesis.lyx b/inf/rn/dok/lyx/thesis.lyx index 36056a0..00c2a10 100644 --- a/inf/rn/dok/lyx/thesis.lyx +++ b/inf/rn/dok/lyx/thesis.lyx @@ -165,6 +165,11 @@ customHeadersFooters \filename_suffix 0 \color #faf0e6 \end_branch +\branch seminarska +\selected 1 +\filename_suffix 0 +\color #faf0e6 +\end_branch \index Index \shortcut idx \color #008000 @@ -278,9 +283,30 @@ Use the official terms and title page layout of your university instead \end_layout \begin_layout Title +\begin_inset Branch seminarska +inverted 1 +status open + +\begin_layout Standard Pridobivanje podatkov iz omrežja DHT \end_layout +\end_inset + + +\begin_inset Branch seminarska +inverted 0 +status open + +\begin_layout Standard +Odjemalec za komunikacijski protokol in omrežni teleskop +\end_layout + +\end_inset + + +\end_layout + \begin_layout Subtitle Analiza pretočnega prometa skozi vozlišča protokola BitTorrent in prenos metapodatkov @@ -342,11 +368,53 @@ status open \end_layout \begin_layout Subject +\begin_inset Branch seminarska +inverted 1 +status open + +\begin_layout Standard Računalništvo in informatika \end_layout +\end_inset + + +\begin_inset Branch seminarska +inverted 0 +status open + +\begin_layout Standard +Seminarska naloga pri informatiki +\end_layout + +\end_inset + + +\end_layout + \begin_layout Publishers -Raziskovalna naloga +\begin_inset Branch seminarska +inverted 1 +status open + +\begin_layout Standard +Raziskovalna +\end_layout + +\end_inset + + +\begin_inset Branch seminarska +inverted 0 +status open + +\begin_layout Standard +Seminarska +\end_layout + +\end_inset + + naloga \end_layout \begin_layout Publishers @@ -427,10 +495,14 @@ Gimnazija Bežigrad \end_inset -\begin_inset Note Note +\end_layout + +\begin_layout Publishers +\begin_inset Branch seminarska +inverted 0 status open -\begin_layout Dedication +\begin_layout Standard \begin_inset Quotes eld \end_inset diff --git a/inf/rn/dok/lyx/uvod.lyx b/inf/rn/dok/lyx/uvod.lyx index fd303d6..d593bf4 100644 --- a/inf/rn/dok/lyx/uvod.lyx +++ b/inf/rn/dok/lyx/uvod.lyx @@ -1009,8 +1009,30 @@ V seznam soležnikov za torrent, opisan z njegovim infohashom, vstavi IP \end_layout \begin_layout Standard -Cilj raziskovalne naloge je s sodelovanjem v DHT omrežju pridobiti čim več - obstoječih ključev v razpršilni tabeli, da lahko z operacijo +Cilj +\begin_inset Branch seminarska +inverted 1 +status open + +\begin_layout Standard +raziskovalne +\end_layout + +\end_inset + + +\begin_inset Branch seminarska +inverted 0 +status open + +\begin_layout Standard +seminarske +\end_layout + +\end_inset + + naloge je s sodelovanjem v DHT omrežju pridobiti čim več obstoječih ključev + v razpršilni tabeli, da lahko z operacijo \series bold pridobi soležnike \series default diff --git a/inf/rn/dok/lyx/zaključek.lyx b/inf/rn/dok/lyx/zaključek.lyx index 28c2ef3..c430135 100644 --- a/inf/rn/dok/lyx/zaključek.lyx +++ b/inf/rn/dok/lyx/zaključek.lyx @@ -306,8 +306,29 @@ Zaključek \end_layout \begin_layout Standard -Raziskovana naloga predstavi kako je praktično mogoče preprosto implementirati - učinkovito metodo za pridobivanje izvlečka metapodatkov iz omrežja BitTorrent. +\begin_inset Branch seminarska +inverted 1 +status open + +\begin_layout Standard +Raziskovana +\end_layout + +\end_inset + + +\begin_inset Branch seminarska +inverted 0 +status open + +\begin_layout Standard +Seminarska +\end_layout + +\end_inset + + naloga predstavi kako je praktično mogoče preprosto implementirati učinkovito + metodo za pridobivanje izvlečka metapodatkov iz omrežja BitTorrent. Prav tako je prikazana uporabna vrednost korpusa prenesenih podatkov za nadaljnje raziskave in osnovne metode analize takih podatkov. \end_layout diff --git a/inf/zotksd/1 b/inf/zotksd/1 Binary files differnew file mode 100755 index 0000000..a11970d --- /dev/null +++ b/inf/zotksd/1 diff --git a/inf/zotksd/1.c b/inf/zotksd/1.c new file mode 100644 index 0000000..7a2de18 --- /dev/null +++ b/inf/zotksd/1.c @@ -0,0 +1,57 @@ +// naloge ne razumem najbolje +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#define S 25000 +int main (void) { + int crke[25]; + char buf[S]; + fgets(buf, S, stdin); + int n = strtol(buf, NULL, 10); + for (int i = 0; i < n; i++) { + int crkecopy[25]; + memcpy(crkecopy, crke, sizeof(crke)); + fgets(buf, S, stdin); + char dodaten = -1; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-compare" + if (strlen(buf) != i+1 && 0) { +#ifndef EVAL + fprintf(stderr, "napačna dolžina niza %s na indeksu %d\n", buf, i); +#endif + printf("%d\n", i); + return 0; + } +#pragma GCC diagnostic pop +#ifndef EVAL + fprintf(stderr, "pri i==%d obdelujem niz %s", i, buf); +#endif + for (int j = 0; j <= i; j++) { + int crka = buf[j]-'A'; + if (--crkecopy[crka] < 0) { + if (dodaten != -1) { + printf("%d\n", i); +#ifndef EVAL + fprintf(stderr, "konec, ker je preveč novih, dodaten je %c\n", dodaten+'A'); +#endif + return 0; + } + dodaten = crka; +#ifndef EVAL + fprintf(stderr, "i==%d, dodaten je sedaj %c\n", i, dodaten+'A'); +#endif + crke[crka]++; + } + } + for (int j = 0; j < 25; j++) + if (crkecopy[j] != 0 && crkecopy[j] != -1) { + printf("%d\n", i); +#ifndef EVAL + fprintf(stderr, "konec, ker ni pobrisal vseh\n"); +#endif + return 0; + } + } + printf("%d\n", n); + return 0; +} diff --git a/inf/zotksd/1.txt b/inf/zotksd/1.txt new file mode 100644 index 0000000..9820f10 --- /dev/null +++ b/inf/zotksd/1.txt @@ -0,0 +1,8 @@ +7 +R +AR +RAK +TRAK +KARTA +RAKETA +TRAKTOR diff --git a/inf/zotksd/1.txt2 b/inf/zotksd/1.txt2 new file mode 100644 index 0000000..334d077 --- /dev/null +++ b/inf/zotksd/1.txt2 @@ -0,0 +1,8 @@ +7 +R +AR +RAK +TRAK +KARTA +RAKETAx +TRAKTOR diff --git a/inf/zotksd/2 b/inf/zotksd/2 Binary files differnew file mode 100755 index 0000000..d5071c2 --- /dev/null +++ b/inf/zotksd/2 diff --git a/inf/zotksd/2.c b/inf/zotksd/2.c new file mode 100644 index 0000000..4b6be92 --- /dev/null +++ b/inf/zotksd/2.c @@ -0,0 +1,88 @@ +// todo: moje karte so drevo +#include <stdlib.h> +#include <stdio.h> +#ifdef EVAL +#define NDEBUG 1 +#endif +#include <assert.h> +#define SI 10000000 +static int compar (const void * a, const void * b) { + return *(int *) a < *(int *) b; +} +int in_arr (int elem, int * ar /* najv do najm */, int len) { + int prej = -1; // zadnja obstoječa karta + for (int i = 0; i < len; i++) { + if (ar[i] == -1) // prazen element -- vzeta karta + continue; + if (elem == ar[i]) + return -1; // moja karta + if (elem > ar[i]) { + if (prej == -1) + return -2; // njegova karta, izguba + return prej; + } + prej = i; + } +#ifndef EVAL + fprintf(stderr, "najmanjša karta idx %d vrednost %d\n", len-1, ar[len-1]); +#endif + return len-1; +} +int main (void) { + char * buf = malloc(SI); + fgets(buf, SI, stdin); + char * cp = buf; + int igralcev = strtol(cp, &cp, 10); + int kart = strtol(++cp, NULL, 10); + int NK = igralcev*kart; + int * moje = malloc(sizeof*moje*kart); + int ** njihove = malloc(sizeof*njihove*igralcev); + fgets(buf, SI, stdin); + cp = buf; + for (int j = 0; j < kart; j++) { + moje[j] = strtol(cp, &cp, 10); + cp++; + } + qsort(moje, kart, sizeof(int), compar); + for (int i = 0; i < igralcev-1; i++) { + njihove[i] = malloc(sizeof*moje*kart); + fgets(buf, SI, stdin); + cp = buf; + for (int j = 0; j < kart; j++) { + njihove[i][j] = strtol(cp, &cp, 10); + cp++; + } + qsort(njihove[i], kart, sizeof(int), compar); + } +#ifndef EVAL + for (int i = 0; i < kart; i++) + fprintf(stderr, "%d ", moje[i]); + fprintf(stderr, "\n%d %d\n", in_arr(6, moje, kart), in_arr(3, moje, kart)); + for (int i = 0; i < igralcev-1; i++) { + fprintf(stderr, "igralec %d: ", i); + for (int j = 0; j < kart; j++) + fprintf(stderr, "%d ", njihove[i][j]); + fprintf(stderr, "\n"); + } +#endif + for (int stih = 0; stih < kart; stih++) { + int najv = 0; + for (int i = 0; i < igralcev-1; i++) + if (najv < njihove[i][stih]) + najv = njihove[i][stih]; +#ifndef EVAL + fprintf(stderr, "štih z najv karto %d ", najv); +#endif + int ret = in_arr(najv, moje, kart); + assert(ret != -1); // ne more biti moja karta + if (ret == -2) { + puts("NE\n"); // on ima večjo karto + return 0; + } +#ifndef EVAL + fprintf(stderr, "premagam in porabim karto %d na idx %d\n", moje[ret], ret); +#endif + moje[ret] = -1; // porabim karto + } + puts("DA\n"); +} diff --git a/inf/zotksd/2.txt b/inf/zotksd/2.txt new file mode 100644 index 0000000..68d7fe9 --- /dev/null +++ b/inf/zotksd/2.txt @@ -0,0 +1,3 @@ +2 3 +4 2 6 +5 1 3 diff --git a/inf/zotksd/2.txt2 b/inf/zotksd/2.txt2 new file mode 100644 index 0000000..77472da --- /dev/null +++ b/inf/zotksd/2.txt2 @@ -0,0 +1,4 @@ +3 4 +7 10 6 12 +8 11 4 9 +1 3 5 2 diff --git a/inf/zotksd/3 b/inf/zotksd/3 Binary files differnew file mode 100755 index 0000000..ffb3da7 --- /dev/null +++ b/inf/zotksd/3 diff --git a/inf/zotksd/3.c b/inf/zotksd/3.c new file mode 100644 index 0000000..b7723b1 --- /dev/null +++ b/inf/zotksd/3.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#define ABS(x) ((x) > 0 ? (x) : -(x)) +#define N unsigned long long int +int main (void) { + char buf[512]; + fgets(buf, 512, stdin); + N n = strtoull(buf, NULL, 10); + N num = 0; + for (N i = 1; i < ceill(sqrtl(n)); i++) { + if (n % i) + continue; + if (ABS(i-n/i) % 2) + continue; + num++; +#ifndef EVAL + fprintf(stderr, "(%llu, %llu)\n", i, n/i); +#endif + } + printf("%llu\n", num); +} diff --git a/inf/zotksd/4 b/inf/zotksd/4 Binary files differnew file mode 100755 index 0000000..634ce55 --- /dev/null +++ b/inf/zotksd/4 diff --git a/inf/zotksd/4.c b/inf/zotksd/4.c new file mode 100644 index 0000000..4c3113a --- /dev/null +++ b/inf/zotksd/4.c @@ -0,0 +1,96 @@ +// todo: pazi na težave s prvim elementom +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> +#define S 1600002 +#define ABS(x) ((x) > 0 ? (x) : -(x)) +int main (void) { + int ukazov = 0; + char buf[S]; + fgets(buf, S, stdin); + int n = strtol(buf, NULL, 10); + fgets(buf, S, stdin); + char * cp = buf; + int * arr = calloc(n, sizeof *arr); + int * repr = calloc(10e6, sizeof *arr); + int najrepr = 0; + int najreprval = 0; + for (int i = 0; i < n; i++) { + arr[i] = strtol(cp, &cp, 10); + if (++repr[arr[i]] > najreprval) { + najreprval = repr[arr[i]]; + najrepr = arr[i]; + } + cp++; + } + free(repr); + int razd_od_centr = INT_MAX; + int center = 0; + if (najreprval == 1) { + najrepr = arr[n/2]; + center = n/2; + } + for (int i = 0; i < n; i++) { + if (arr[i] == najrepr && ABS(n/2-i) < razd_od_centr) { + razd_od_centr = ABS(n/2-i); + center = i; + } + } + if (najreprval == 1) { + center = n/2; + } +#ifndef EVAL + fprintf(stderr, "najrepr je število %d, ki ima toliko pojavitev: %d\n", najrepr, najreprval); +#endif + int levo = 0; + int desno = n-1; + s: + while (arr[levo] == najrepr) { + if (levo == n-1) + goto k; + levo++; + } + while (arr[desno] == najrepr) { + if (desno == 0) + goto k; + desno--; + } + if (levo == desno) { + ukazov++; + goto k; + } + if (center > levo && center < desno) { + ukazov++; + arr[levo] = najrepr; + arr[desno] = najrepr; +#ifndef EVAL + fprintf(stderr, "(%d, %d, %d) .. cached center\n", levo, center, desno); +#endif + goto s; + } + center = 0; + for (int i = levo+1; i < desno; i++) { + if (arr[i] == najrepr) { + center = i; + arr[levo] = najrepr; + arr[desno] = najrepr; + ukazov++; +#ifndef EVAL + fprintf(stderr, "(%d, %d, %d) .. našel center, en ukaz\n", levo, center, desno); +#endif + goto s; + } + } + if (center == 0) { + ukazov += 2; + arr[levo] = najrepr; + arr[desno] = najrepr; + arr[(center = levo+(desno-levo)/2)] = najrepr; +#ifndef EVAL + fprintf(stderr, "(%d, %d, %d) .. ni bilo centra, dva ukaza\n", levo, center, desno); +#endif + goto s; + } + k: + printf("%d\n", ukazov); +} diff --git a/inf/zotksd/4.txt b/inf/zotksd/4.txt new file mode 100644 index 0000000..b10a269 --- /dev/null +++ b/inf/zotksd/4.txt @@ -0,0 +1,2 @@ +5 +1 3 2 3 4 diff --git a/inf/zotksd/4.txt2 b/inf/zotksd/4.txt2 new file mode 100644 index 0000000..7191255 --- /dev/null +++ b/inf/zotksd/4.txt2 @@ -0,0 +1,2 @@ +11 +2 2 2 1 1 1 1 1 2 2 2 |