diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-03 18:54:14 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-03 18:54:14 +0200 |
commit | 3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb (patch) | |
tree | dc51ea1b9dc4429546c50dd54d232e81dd0538fd | |
parent | ds2teor (diff) | |
parent | razne stvari iz b (diff) | |
download | r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.gz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.bz2 r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.lz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.xz r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.zst r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.zip |
-rwxr-xr-x | skripti/365_prenesi_omejene_vsebine.sh | 19 | ||||
-rw-r--r-- | skripti/completion.bash | 6 | ||||
-rwxr-xr-x | skripti/earhorn_m3u.sh | 33 | ||||
-rwxr-xr-x | skripti/init_script_interpreter.sh | 115 | ||||
-rwxr-xr-x | skripti/service.sh | 28 | ||||
-rwxr-xr-x | skripti/videonadzor.sh | 10 | ||||
-rwxr-xr-x | skripti/zone/axfr.py | 7 | ||||
-rwxr-xr-x | skripti/zone/update.py | 10 | ||||
-rw-r--r-- | šola/ana2/fja.scad | 13 | ||||
-rw-r--r-- | šola/ana2/kolokvij1.lyx | 976 | ||||
-rw-r--r-- | šola/p2/dn/DN07a_63230317.c | 25 | ||||
-rw-r--r-- | šola/p2/dn/DN07b_63230317.c | 24 |
12 files changed, 1249 insertions, 17 deletions
diff --git a/skripti/365_prenesi_omejene_vsebine.sh b/skripti/365_prenesi_omejene_vsebine.sh index f9a8c69..510b0c1 100755 --- a/skripti/365_prenesi_omejene_vsebine.sh +++ b/skripti/365_prenesi_omejene_vsebine.sh @@ -7,13 +7,24 @@ set -euo pipefail page=`curl --fail-with-body https://365.rtvslo.si/oddaja/dnevnik/92` # outputa preveč shita za set -x set -x -for id in `find -type f -size 7931523c | sed -E 's/^.*\[([0-9]*)\].*$/\1/g'` # repair broken downloads (pravice potekle) -do - yt-dlp --no-continue http://365.rtvslo.si/arhiv/oddaja/$id +find . -size -12M -type f -name '*.mp4' | while read file +do # grep for specific audio codec ... if sample rate is 44100 and (tv broadcast is at 48000) and smaller than 12M, it's most likely the dummy/pravicepotekle video + samplerate=`ffprobe "$file" 2>&1 | grep 0x6134706D | grep -Eo '[0-9]+ Hz' | cut -d\ -f1` + id=`grep -Eo "\[[0-9]+\]\.mp" <<<"$file" | grep -o '[0-9]*'` + if [ $samplerate -eq 48000 ] + then + continue + fi + if [ $samplerate -eq 44100 ] + then + yt-dlp --no-continue http://365.rtvslo.si/arhiv/oddaja/$id # retry fu*ked up downloads + continue + fi + echo -e "Subject: unknown samplerate in 365.sh\n\nVideo file: $file\nsamplerate: $samplerate\n" | sendmail root done rm -f Error\ \[*\].mp4 dnevnik_id=`grep href=./arhiv/dnevnik <<<"$page" | cut -d\" -f2 | cut -d/ -f4 | head -n1` -client_id=`grep client-id <<<"$page" | cut -d\" -f2 | head -n1` +client_id=`grep 'client-id="' <<<"$page" | head -n1 | sed -E 's/^.*client-id="([^"]*)".*$/\1/'` if [ ! -f zadnji ] then echo $dnevnik_id > zadnji diff --git a/skripti/completion.bash b/skripti/completion.bash new file mode 100644 index 0000000..fbe834d --- /dev/null +++ b/skripti/completion.bash @@ -0,0 +1,6 @@ +# completion skript za vse stvari v /skripti/ +_service_sh_complete() { + [ $1 = $3 ] && { COMPREPLY=($(compgen -W "`service.sh list`" $2)); return; } + COMPREPLY=($(compgen -W "`service.sh $3 list`" $2)) +} +complete -F _service_sh_complete service.sh diff --git a/skripti/earhorn_m3u.sh b/skripti/earhorn_m3u.sh new file mode 100755 index 0000000..e89a151 --- /dev/null +++ b/skripti/earhorn_m3u.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -eo pipefail +# $1 je prefix +# $2 je prejšnji file (za caching dolžin) +# $3=1 forsira cache kljub version failu +echo "#EXTM3U" +ver="#earhorn_m3u.sh različica 0" +echo $ver +cache=0 +if [ ! x$3 = x ] || [ ! x$2 = x ] && [ -f $2 ] +then + if [ x"`head -n2 $2 | tail -n1`" = x"$ver" ] + then + cache=1 + fi +fi +find 2* -type f | while read file +do + date=`cut -d/ -f1,2,3 <<<$file | sed s,/,-,g` + time=`cut -d/ -f4 <<<$file | cut -d. -f1` + h=${time:0:2} + m=${time:2:2} + s=${time:4:2} + dol="" + if [ $cache -eq 1 ] + then + grep -B2 ^$1$file$ $2 && continue + fi + dol=`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $file | cut -d. -f1` + echo "#EXTINF:$dol,Radijski arhiv" + echo "#EXT-X-PROGRAM-DATE-TIME:${date}T$h:$m:${s}Z" + echo $1$file +done diff --git a/skripti/init_script_interpreter.sh b/skripti/init_script_interpreter.sh new file mode 100755 index 0000000..fc461ce --- /dev/null +++ b/skripti/init_script_interpreter.sh @@ -0,0 +1,115 @@ +#!/bin/bash +set -eo pipefail +name=`rev <<<$1 | cut -d/ -f1 | rev` +SVCNAME=$name +pidfile=/run/user/`id -u`/$name.pid +[ -w /run/user/`id -u`/log ] && stdout_logger="logger --socket /run/user/`id -u`/log" || stdout_logger=logger # failback to logging to syslog +stderr_logger=$stdout_logger +[ -r `sed s,/init.d/,/conf.d/, <<<$1` ] && . `sed s,/init.d/,/conf.d/, <<<$1` +. $1 +type eerror > /dev/null 2> /dev/null || eerror() { + echo NAPAKA: $@ +} +type ewarn > /dev/null 2> /dev/null || ewarn() { + echo OPOZORILO: $@ +} +type einfo > /dev/null 2> /dev/null || einfo () { + echo INFO: $@ +} +type ebegin > /dev/null 2> /dev/null || ebegin() { + echo ZAČENJAM: $@ +} +type need_net > /dev/null 2> /dev/null || need_net() { + [ `ip a | grep ^[[:digit:]] | wc -l` -gt 1 ] || { eerror "Ni omrežnih vmesnikov poleg lo." && return 1; } + [ `ip route | wc -l` -gt 1 ] || { eerror "Usmerjevalna tabela je prazna." && return 1; } +} +type need_clock > /dev/null 2> /dev/null || need_clock() { + year=`date +%Y` + [ $? -eq 0 ] || { eerror "Ura ne deluje." && return 1; } + [ $year -ge 2024 ] || { eerror "Ura je narobe nastavljena." && return 1; } +} +type need_hostname > /dev/null 2> /dev/null || need_hostname() { + hn=`hostname` + [ $? -eq 0 ] || { eerror "Ni mogoče pridobiti imena gostitelja." && return 1; } + [ x$hn = x ] && { eerror "Ni imena gostitelja" && return 1; } + [ x$hn = xlocalhost ] && { eerror "Ime gostitelja je localhost." && return 1; } + return 0 +} +needs= +needs_izpolnjen=0 +type need > /dev/null 2> /dev/null || need() { + for i in $@ + do + needs="$needs $i" + need_$i || { eerror "Odvisnost $i ni izpolnjena." && needs_izpolnjen=1; } + done +} +provides= +type provide > /dev/null 2> /dev/null || provide() { + for i in $@ + do + provides="$provides $i" + done +} +type depend > /dev/null 2> /dev/null || depend() { + return +} +type check_dependencies > /dev/null 2> /dev/null || check_dependencies() { + depend + return $needs_izpolnjen +} +type needs > /dev/null 2> /dev/null || needs() { + depend + echo $needs +} +type provides > /dev/null 2> /dev/null || provides() { + depend + echo $provides +} +type checkconfig > /dev/null 2> /dev/null || checkconfig() { + return +} +type start > /dev/null 2> /dev/null || start() { + checkconfig || { eerror "Checkconfig ni uspel." && return 1; }; + check_dependencies || { eerror "Odvisnosti niso izpolnjene."; return 1; } + ebegin "Zaganjam $SVCNAME" + start-stop-daemon --start --verbose `[ x$command_background = true ] || echo --background --make-pidfile` `[ x$chdir = x ] || echo --chdir $chdir` --stdout-logger "$stdout_logger" --stderr-logger "$stderr_logger" --exec $command --pidfile $pidfile -- $command_args || { eerror "start-stop-daemon ni uspel. Koda napake: $?"; return 1; } +} +type stop > /dev/null 2> /dev/null || stop() { + ebegin "Ustavljam $SVCNAME" + start-stop-daemon --stop --pidfile $pidfile --verbose --exec $command -- $command_args || { eerror "start-stop-daemon ni uspel. Koda napake: $?"; return 1; } +} +type restart > /dev/null 2> /dev/null || restart() { + checkconfig || { eerror "Checkconfig ni uspel." && return 1; }; + stop || ewarn "Stop ni uspel. Vseeno poskušam zagnati storitev." + start || { eerror "Start ni uspel." && return 1; } +} +type reload > /dev/null 2> /dev/null || reload() { + checkconfig || { eerror "Checkconfig ni uspel." && return 1; }; + ebegin "Pošiljam SIGHUP storitvi $SVCNAME" + start-stop-daemon --signal HUP $start_stop_daemon_args +} +type status > /dev/null 2> /dev/null || status() { + if [ -r $pidfile ] + then + if [ -d /proc/`cat $pidfile` ] + then + einfo started + else + einfo crashed + return 3 + fi + else + einfo stopped + return 3 + fi +} +type list > /dev/null 2> /dev/null || list() { + echo start stop restart $extra_commands $extra_started_commands $extra_stopped_commands status reload list check_dependencies needs provides +} +if type $2 > /dev/null 2> /dev/null +then + ${@:2} +else + eerror "Ta ukaz ne obstaja!" +fi diff --git a/skripti/service.sh b/skripti/service.sh new file mode 100755 index 0000000..2617253 --- /dev/null +++ b/skripti/service.sh @@ -0,0 +1,28 @@ +#!/bin/bash +[ x$INITPATH = x ] && for i in `tr : ' ' <<<$MORE_INITPATH` `tr : ' ' <<<$XDG_CONFIG_DIRS` ~/.config ~ /etc +do + [ -d $i/init.d ] && INITPATH=$INITPATH:$i/init.d +done +if [ x$1 = xlist ] +then + for i in `tr : ' ' <<<$INITPATH` + do + if [ -w $i ] + then + ls $i + else + for j in $i/* + do + [ ! -x $j ] && continue + head -n1 $j | grep "#!.*openrc-run" > /dev/null 2> /dev/null && continue + echo `rev <<<$j | cut -f/ -d1 | rev` + done + fi + done + exit 1 +fi +[ x$1 = x ] && { echo -e "Uporaba:\n\t$0 list\n\t$0 <storitev> <dejanje>"; exit 1; } +for i in `tr : ' ' <<<$INITPATH` +do + [ -x $i/$1 ] && exec $i/$@ +done diff --git a/skripti/videonadzor.sh b/skripti/videonadzor.sh index 3e6fa51..e097c58 100755 --- a/skripti/videonadzor.sh +++ b/skripti/videonadzor.sh @@ -22,7 +22,7 @@ do do if [ $prev = devica ] then - first=$i + first=`rev <<<"$i" | cut -d. -f2- | rev` prev=$i continue fi @@ -36,7 +36,7 @@ do prev=$i done { - ffmpeg -f concat -safe 0 -i concat.txt -fps_mode vfr file:$first.mkv + ffmpeg -f concat -safe 0 -i concat.txt -vsync vfr file:$first.mkv if [ -s $first.mkv ] then while read line @@ -44,8 +44,8 @@ do grep ^file <<<$line > /dev/null && rm `cut -d: -f2- <<<$line | cut -d\' -f1` done < concat.txt fi - oldstart=`ls --sort=time | grep mkv$ | tail -f1 | cut -d: -f1` - if [ ! $oldstart = `cut -d: -f1` <<<"$t" ] + oldstart=`ls --sort=time | grep mkv$ | tail -n1 | cut -d: -f1` + if [ ! $oldstart = `cut -d: -f1 <<<"$t"` ] then echo "ffconcat version 1.0" > concat.txt prev=devica @@ -63,7 +63,7 @@ do fi prev=$i done - ffmpeg -f concat -safe 0 -i concat.txt -fps_mode vfr file:$oldstart.mp4 + ffmpeg -f concat -safe 0 -i concat.txt -vsync vfr file:$oldstart.mp4 if [ -s $oldstart.mp4 ] then while read line diff --git a/skripti/zone/axfr.py b/skripti/zone/axfr.py index fe508f1..11eaad9 100755 --- a/skripti/zone/axfr.py +++ b/skripti/zone/axfr.py @@ -20,8 +20,8 @@ for naslov in naslovi: # opcijsko dodaj tule kakšen try catch break config = None try: - config = json.loads(b''.join(dns.resolver.resolve("_urejevalnik." + domena, "TXT")[0].strings).decode()) -except dns.resolver.NXDOMAIN: + config = json.loads(b''.join(zone["_urejevalnik"].get_rdataset(dns.rdataclass.IN, dns.rdatatype.TXT)[0].strings).decode()) +except KeyError: pass except json.decoder.JSONDecodeError: pass @@ -53,7 +53,8 @@ for r in zone.iterate_rdatas(): konec = config["i"][r[0].to_unicode()] print(r[0].to_unicode(), end=konec) if r[1] != config["t"]: - print(r[1], end="\t") + print(r[1], end="") + print("\t", end="") if r[2].rdclass != dns.rdataclass.IN: print(r[2].rdataclass.name, end="\t") print(r[2].rdtype.name, end="\t") diff --git a/skripti/zone/update.py b/skripti/zone/update.py index 34a4e39..ead2c39 100755 --- a/skripti/zone/update.py +++ b/skripti/zone/update.py @@ -24,8 +24,8 @@ for naslov in naslovi: # opcijsko dodaj tule kakšen try catch break config = None try: - config = json.loads(b''.join(dns.resolver.resolve("_urejevalnik." + domena, "TXT")[0].strings).decode()) -except dns.resolver.NXDOMAIN: + config = json.loads(b''.join(zone["_urejevalnik"].get_rdataset(dns.rdataclass.IN, dns.rdatatype.TXT)[0].strings).decode()) +except KeyError: pass except json.decoder.JSONDecodeError: pass @@ -61,7 +61,7 @@ for r in zone.iterate_rdatas(): vrednost = '"' + niz + '"' else: vrednost = r[2].to_text() - rrs.append((r[1], r[0].to_unicode(), komentar, konec, r[2].rdclass, r[2].rdtype, vrednost)) + rrs.append((r[1], r[0].to_unicode(), komentar, None, r[2].rdclass, r[2].rdtype, vrednost)) komentar = "" lineno = 1 novikomentarji = {} @@ -118,7 +118,7 @@ while True: except dns.rdatatype.UnknownRdatatype: pass if tip == None: - print(f"NAPAKA: na vrstici {lineno} ne najdem tipa zapisa. Vrstica je lahko bodisi komentar, ki se začne z ';', bodisi je v obliki IME [TTL={newconfig["t"]}] [CLASS=IN] TIP PODATKI.") + print(f"NAPAKA: na vrstici {lineno} ne najdem tipa zapisa. Vrstica je lahko bodisi komentar, ki se začne z ';', bodisi je v obliki IME [TTL={newconfig['t']}] [CLASS=IN] TIP PODATKI.") print(f"Vsebina neveljavne vrstice: " + line) sys.exit(1) while line[datastart] in [" ", "\t"]: @@ -133,7 +133,7 @@ while True: data = data.split() data[2] = str(int(data[2])+newconfig["+"]) data = " ".join(data) - tapl = (ttl, ime, komentar, konec, razred, tip, data) + tapl = (ttl, ime, komentar, None, razred, tip, data) if komentar != "": novikomentarji[ime + " " + tip.to_text(tip)] = komentar if konec != "\t": diff --git a/šola/ana2/fja.scad b/šola/ana2/fja.scad new file mode 100644 index 0000000..4d18a17 --- /dev/null +++ b/šola/ana2/fja.scad @@ -0,0 +1,13 @@ +echo(version=version()); +function sinh(x) = (exp(1)-exp(-x))/2; +function f(x, y, z) = sinh(z)*sinh(y)-sin(x); +epsilon = 0.01; +rob = 1; +korak = 0.1; +particle = 0.1; +for (x = [-rob : korak : rob]) + for (y = [-rob : korak : rob]) + for (z = [-rob : korak : rob]) + if (f(x, y, z) < epsilon) + translate([x, y, z]) + cube(particle);
\ No newline at end of file diff --git a/šola/ana2/kolokvij1.lyx b/šola/ana2/kolokvij1.lyx new file mode 100644 index 0000000..a4f9569 --- /dev/null +++ b/šola/ana2/kolokvij1.lyx @@ -0,0 +1,976 @@ +#LyX 2.3 created this file. For more info see http://www.lyx.org/ +\lyxformat 544 +\begin_document +\begin_header +\save_transient_properties true +\origin unavailable +\textclass article +\begin_preamble +\usepackage{siunitx} +\usepackage{pgfplots} +\usepackage{listings} +\usepackage{multicol} +\usepackage{amsmath} +\sisetup{output-decimal-marker = {,}, quotient-mode=fraction, output-exponent-marker=\ensuremath{\mathrm{3}}} +\DeclareMathOperator{\g}{g} +\DeclareMathOperator{\sled}{sled} +\DeclareMathOperator{\Aut}{Aut} +\DeclareMathOperator{\Cir}{Cir} +\DeclareMathOperator{\ecc}{ecc} +\DeclareMathOperator{\rad}{rad} +\DeclareMathOperator{\diam}{diam} +\newcommand\euler{e} +\end_preamble +\use_default_options true +\begin_modules +enumitem +\end_modules +\maintain_unincluded_children false +\language slovene +\language_package default +\inputencoding auto +\fontencoding global +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 100 +\font_tt_scale 100 100 +\use_microtype false +\use_dash_ligatures true +\graphics xetex +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry true +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification false +\use_refstyle 1 +\use_minted 0 +\index Index +\shortcut idx +\color #008000 +\end_index +\leftmargin 1cm +\topmargin 1cm +\rightmargin 1cm +\bottommargin 2cm +\headheight 1cm +\headsep 1cm +\footskip 1cm +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\is_math_indent 0 +\math_numbering_side default +\quotes_style german +\dynamic_quotes 0 +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +setlength{ +\backslash +columnseprule}{0.2pt} +\backslash +begin{multicols}{2} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Section +Podmnožice v evklidskih prostorih +\end_layout + +\begin_layout Standard +\begin_inset Formula $A$ +\end_inset + + zaprta, če +\begin_inset Formula $\forall$ +\end_inset + + zaporedje s členi v +\begin_inset Formula $A:$ +\end_inset + + vsa stekališča v +\begin_inset Formula $A$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Formula $A$ +\end_inset + + kompaktna, če +\begin_inset Formula $\forall$ +\end_inset + + zaporedje s členi v +\begin_inset Formula $A$ +\end_inset + +: +\begin_inset Formula $\exists$ +\end_inset + + stekališče v +\begin_inset Formula $A$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Formula $f$ +\end_inset + + je kompozitum zveznih +\begin_inset Formula $\Rightarrow$ +\end_inset + + +\begin_inset Formula $f$ +\end_inset + + zvezna +\end_layout + +\begin_layout Standard +za +\begin_inset Formula $x\in\mathbb{R}^{k}$ +\end_inset + +: +\begin_inset Formula $\text{\left|\left|x\right|\right|\ensuremath{\coloneqq}}\sqrt{x_{1}^{2}+\cdots+x_{k}^{2}}$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $A\subseteq\mathbb{R}^{k}$ +\end_inset + + omejena +\begin_inset Formula $\Leftrightarrow\exists M\in\mathbb{R}\forall x\in A:\left|\left|x\right|\right|<M$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $K\left(s\in\mathbb{R}^{k},M\in\mathbb{R}\right)\coloneqq\left\{ s+x\in\mathbb{R}^{k};\text{\left|\left|x\right|\right|}<M\right\} $ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $x\in A$ +\end_inset + + notranja +\begin_inset Formula $\Leftrightarrow\exists\varepsilon\ni:K\left(x,\varepsilon\right)\subset A$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $A\subseteq\mathbb{R}^{k}$ +\end_inset + + odprta +\begin_inset Formula $\Leftrightarrow\forall x\in A:x$ +\end_inset + + notranja +\end_layout + +\begin_layout Standard +\begin_inset Formula $A\subseteq\mathbb{R}^{k}$ +\end_inset + + zaprta +\begin_inset Formula $\Leftrightarrow\mathbb{R}^{k}\setminus A$ +\end_inset + + odprta +\end_layout + +\begin_layout Standard +\begin_inset Formula $x\in\mathbb{R}^{k}$ +\end_inset + + stekališče +\begin_inset Formula $A\Leftrightarrow\forall\varepsilon>0:K\left(x,\varepsilon\right)\cup\left(A\setminus\left\{ x\right\} \right)\not=\emptyset$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $x\in\mathbb{R}^{k}$ +\end_inset + + izolirana točka +\begin_inset Formula $A\Leftrightarrow x$ +\end_inset + + ni stekališče +\begin_inset Formula $A$ +\end_inset + + +\end_layout + +\begin_layout Standard +Zaporedje +\begin_inset Formula $a_{n}:\mathbb{N}\to\mathbb{R}^{k}$ +\end_inset + + konvergira proti +\begin_inset Formula $a\in\mathbb{R}^{k}$ +\end_inset + + kadar +\begin_inset Formula $\forall\varepsilon>0\exists N\in\mathbb{N}\forall n>N:\left|\left|a_{n}-a\right|\right|<\varepsilon$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $s\in\mathbb{R}^{k}$ +\end_inset + + stekališče zap. + +\begin_inset Formula $\Leftrightarrow$ +\end_inset + + v +\begin_inset Formula $\text{\ensuremath{\varepsilon}}-$ +\end_inset + +okolici +\begin_inset Formula $s$ +\end_inset + + je +\begin_inset Formula $\infty$ +\end_inset + +mnogo členov +\end_layout + +\begin_layout Standard +Vsako omejeno zaporedje ima stekališče. +\end_layout + +\begin_layout Section +Funkcije več spremenljivk +\end_layout + +\begin_layout Standard +fja +\begin_inset Formula $k$ +\end_inset + + spremenljivk je preslikava +\begin_inset Formula $f:D\subseteq\mathbb{R}^{k}\to\mathbb{R}$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Formula $L\in\mathbb{R}$ +\end_inset + + je limita +\begin_inset Formula $f:D\subseteq\text{\ensuremath{\mathbb{R}^{k}}}\to\mathbb{R}$ +\end_inset + + v stekališču +\begin_inset Formula $a\in D$ +\end_inset + +, če +\begin_inset Formula $\forall\varepsilon>0\exists\delta>0\forall x\in D\setminus\left\{ a\right\} :\left|\left|x-a\right|\right|<\delta\Rightarrow\left|f\left(x\right)-L\right|<\varepsilon$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\lim_{x\to a}\left(f\oslash g\right)x=\lim_{x\to a}fx\oslash\lim_{x\to a}gx$ +\end_inset + +, če obstajata. + +\begin_inset Formula $\oslash\in\left\{ +,-,\cdot\right\} $ +\end_inset + +. + +\begin_inset Formula $\oslash$ +\end_inset + + je lahko deljenje, kadar +\begin_inset Formula $\lim_{x\to a}gx\not=0$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Formula $f$ +\end_inset + + zvezna v +\begin_inset Formula $a\Leftrightarrow\forall\varepsilon\exists\delta\forall x\in D:\left|\left|x-a\right|\right|<\delta\Rightarrow\left|fx-fa\right|<\varepsilon$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f$ +\end_inset + + zvezna +\begin_inset Formula $\Leftrightarrow\forall a\in D:f$ +\end_inset + + zvezna v +\begin_inset Formula $a$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f$ +\end_inset + + zvezna v stekališču +\begin_inset Formula $a\Leftrightarrow\lim_{x\to a}fx=fa$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $A\subseteq\mathbb{R}^{k}$ +\end_inset + + kompaktna, +\begin_inset Formula $f:A\to\mathbb{R}$ +\end_inset + + zvezna +\begin_inset Formula $\Rightarrow f$ +\end_inset + + omejena in doseže maksimum in minimum (obstoj globalnega ekstrema). +\end_layout + +\begin_layout Standard +\begin_inset Formula $f,g$ +\end_inset + + zv. + +\begin_inset Formula $\Rightarrow f\oslash g$ +\end_inset + + zv. + +\begin_inset Formula $\oslash\in\left\{ +,-,\cdot,\circ\right\} ,\oslash=/\Leftrightarrow\forall x:gx\not=0$ +\end_inset + + +\end_layout + +\begin_layout Section +Odvodi funkcij več spremenljivk +\end_layout + +\begin_layout Standard +\begin_inset Formula $f_{x_{i}}a$ +\end_inset + +, +\begin_inset Formula $i\in\left\{ 1..k\right\} $ +\end_inset + + je odvod fje +\begin_inset Formula $x_{i}\to f\left(a_{1},\dots,a_{i-1},x_{i},a_{i+1},\dots,a_{k}\right)$ +\end_inset + + v točki +\begin_inset Formula $a_{i}$ +\end_inset + +. + +\begin_inset Formula $f_{x_{i}}a=\lim_{x_{i}\to a_{i}}\frac{f\left(a_{1},\dots,a_{i-1},x_{i},a_{i+1},\dots,a_{k}\right)-fa}{x_{i}-a_{i}}$ +\end_inset + + +\end_layout + +\begin_layout Standard +Tang. + ravn. + v +\begin_inset Formula $a=\left(b,c\right)$ +\end_inset + + +\begin_inset Formula $a=\left(b,c\right)$ +\end_inset + +: +\begin_inset Formula $z=fa+f_{x}a\cdot\left(x-b\right)+f_{y}a\cdot\left(y-c\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f$ +\end_inset + + je odvedljiva v +\begin_inset Formula $a\Leftrightarrow\lim_{h\to\left(0,0\right)}\frac{R_{a}\left(a+h\right)}{\left|\left|h\right|\right|}=0$ +\end_inset + +, kjer je +\begin_inset Formula $R_{a}\left(a+h\right)\coloneqq f\left(a+h\right)-fa-f_{x}\left(a\right)\cdot u+f_{y}\left(a\right)\cdot v$ +\end_inset + + za +\begin_inset Formula $h=\left(u,v\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $dfa\coloneqq\left[f_{x_{1}}a\cdots f_{x_{k}}a\right]=\nabla fa,dfa\cdot h\coloneqq f_{x_{1}}a\cdot h_{1}+\cdots+f_{x_{k}}a\cdot h_{k}$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f$ +\end_inset + + v +\begin_inset Formula $a$ +\end_inset + + odvedljiva +\begin_inset Formula $\Rightarrow f$ +\end_inset + + v +\begin_inset Formula $a$ +\end_inset + + zvezna +\end_layout + +\begin_layout Standard +\begin_inset Formula $\forall i\in\left\{ 1..k\right\} :\exists f_{x_{i}}\wedge f_{x_{i}}$ +\end_inset + + zvezna +\begin_inset Formula $\Rightarrow f$ +\end_inset + + odvedljiva +\end_layout + +\begin_layout Standard +Lagrange: +\begin_inset Formula $fx_{1}-fx_{2}=f'\xi\left(x_{2}-x_{1}\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f\in C^{r}U\sim$ +\end_inset + + +\begin_inset Formula $f$ +\end_inset + + +\begin_inset Formula $r-$ +\end_inset + +krat zvezno odvedljiva v vsaki točki +\begin_inset Formula $U$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f:U\subseteq\mathbb{R}^{k}\to\mathbb{R},f\in C^{2}U\Rightarrow\forall i,j\in\left\{ 1..k\right\} :f_{x_{i}}=f_{x_{j}}$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\frac{df}{d\vec{s}}\left(x,y\right)=\lim_{t\to0}\frac{f((x,y)+t\vec{s})-f(x,y)}{t}=s_{1}f(x,y)+s_{2}f_{x}(x,y)$ +\end_inset + + +\end_layout + +\begin_layout Standard +Tangentna ravnina v +\begin_inset Formula $\left(x_{0},y_{0},f\left(x_{0},y_{0}\right)\right)$ +\end_inset + + je +\begin_inset Formula $f_{x}\left(x_{0},y_{0}\right)\left(x-x_{0}\right)+f_{y}\left(x_{0},y_{0}\right)\left(y-y_{0}\right)-z+f\left(x_{0},y_{0}\right)$ +\end_inset + + in razpenjata jo vektorja +\begin_inset Formula $\left(1,0,f_{x}\right)$ +\end_inset + + in +\begin_inset Formula $\left(0,1,f_{y}\right)$ +\end_inset + +. +\end_layout + +\begin_layout Section +Taylorjeva formula in verižno pravilo +\end_layout + +\begin_layout Standard +\begin_inset Formula $f$ +\end_inset + + diferenciabilna v +\begin_inset Formula $a\in\mathbb{R}^{k}\Rightarrow f\left(a+h\right)\cong fa+dfa\cdot h=fa+f_{x_{1}}a\cdot h_{1}+\cdots+f_{x_{k}}a\cdot h_{k}$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Formula $U\subseteq R^{k}$ +\end_inset + + odprta in +\begin_inset Formula $f:U\to\mathbb{R},f\in C^{n+1}U$ +\end_inset + +. + Naj bo +\begin_inset Formula $D_{f,r,a}$ +\end_inset + + vektor vseh parcialnih odvodov reda +\begin_inset Formula $r$ +\end_inset + + v točki +\begin_inset Formula $a$ +\end_inset + +. + Primer: +\begin_inset Formula $D_{f,2,a}=\left(f_{xx}a,2f_{xy}a+f_{yy}a\right)$ +\end_inset + +. + +\begin_inset Formula $D_{f,0,a}\coloneqq f\left(a\right)$ +\end_inset + +. + Naj bo +\begin_inset Formula $H_{r}$ +\end_inset + + vektor z vsemi kombinacijami dolžine +\begin_inset Formula $r$ +\end_inset + + komponent +\begin_inset Formula $h$ +\end_inset + +. + Primer: +\begin_inset Formula $H_{2}=\left(uu,2uv,vv\right)$ +\end_inset + +. + +\begin_inset Formula $H_{0}=1$ +\end_inset + +. + +\begin_inset Formula $D_{f,r,a}\cdot H_{r}$ +\end_inset + + je njun skalarni produkt. +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +T_{f,a,n}\left(h_{1}=x-a,h_{2}=y-b\right)=\sum_{i=0}^{n}\frac{1}{i!}\left(D_{f,i,a}\cdot H_{i}\right) +\] + +\end_inset + + +\end_layout + +\begin_layout Section +Ekstremalni problemi +\end_layout + +\begin_layout Standard +Kandidati so +\begin_inset Formula $a$ +\end_inset + +, da +\begin_inset Formula $\nabla fa=0$ +\end_inset + + ali +\begin_inset Formula $f$ +\end_inset + + ni odv. + v +\begin_inset Formula $a$ +\end_inset + + ali +\begin_inset Formula $a$ +\end_inset + + robna točka. +\end_layout + +\begin_layout Standard +\begin_inset Formula +\[ +H\left(a,b\right)=\left[\begin{array}{cc} +f_{xx}\left(a,b\right) & f_{xy}\left(a,b\right)\\ +f_{yx}\left(a,b\right) & f_{yy}\left(a,b\right) +\end{array}\right] +\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $\det H\left(a,b\right)>0$ +\end_inset + +: +\begin_inset Formula $f_{xx}\left(a,b\right)>0$ +\end_inset + + l. + min., +\begin_inset Formula $f_{xx}\left(a,b\right)<0$ +\end_inset + + l. + max. +\end_layout + +\begin_layout Standard +\begin_inset Formula $\det H\left(a,b\right)<0$ +\end_inset + + sedlo +\end_layout + +\begin_layout Standard +Izrek o implicitni funkciji: +\begin_inset Formula $D\subseteq\mathbb{R}^{2}$ +\end_inset + + odprta, +\begin_inset Formula $f:D\to\mathbb{R}$ +\end_inset + + zvezno parcialno odvedljiva. + +\begin_inset Formula $K=\left\{ \left(x,y\right)\in D;f\left(x,y\right)=0\right\} $ +\end_inset + +. + Za +\begin_inset Formula $\left(a,b\right)\in D$ +\end_inset + +, +\begin_inset Formula $f\left(a,b\right)=0\wedge\nabla f\left(a,b\right)\not=0\exists h\left(a\right)=b,f\left(x,h\left(x\right)\right)=0\forall x\in U$ +\end_inset + +. +\end_layout + +\begin_layout Standard +Vezani ekstrem: +\begin_inset Formula $D^{\text{odp.}}\subseteq\mathbb{R}^{n}$ +\end_inset + +, +\begin_inset Formula $f:D\to\mathbb{R}$ +\end_inset + + diferenciabilna na +\begin_inset Formula $D$ +\end_inset + +. + let +\begin_inset Formula $g:D\to\mathbb{R}$ +\end_inset + + zvezno parcialno odvedljiva, +\begin_inset Formula $A\coloneqq\left\{ x\in D;gx=0\right\} $ +\end_inset + +. + +\begin_inset Formula $\exists$ +\end_inset + + vezani ekstrem +\begin_inset Formula $f$ +\end_inset + + pri pogoju +\begin_inset Formula $g\Leftrightarrow\nabla fa=\lambda\nabla ga$ +\end_inset + +. + Kandidati za vezane ekstreme so stac. + točke fje +\begin_inset Formula $F\left(x,\lambda\right)=fx-\lambda gx$ +\end_inset + +. +\end_layout + +\begin_layout Section +Krivulje in ploskve +\end_layout + +\begin_layout Standard +Pot v +\begin_inset Formula $\mathbb{R}^{3}\sim\vec{r}:I\to\mathbb{R}^{3},I\in\mathbb{R}$ +\end_inset + + interval. + +\begin_inset Formula $\forall t\in I:\vec{r}t=\left(xt,yt,zt\right)$ +\end_inset + +. +\end_layout + +\begin_layout Standard +Odvod poti: +\begin_inset Formula $\dot{\vec{r}}\left(t\right)=\left(\dot{x}\left(t\right),\dot{y}\left(t\right),\dot{z}\left(t\right)\right)$ +\end_inset + +. + +\begin_inset Formula $\dot{\vec{r}}t$ +\end_inset + + je tangentni vektor na krivuljo v točki +\begin_inset Formula $\vec{r}t$ +\end_inset + +. +\end_layout + +\begin_layout Standard +Dolžina poti +\begin_inset Formula $\vec{r}:\left[a,b\right]\to\mathbb{R}^{3}$ +\end_inset + + je +\begin_inset Formula +\[ +L=\int_{a}^{b}\left|\dot{\vec{r}}t\right|dt=\int_{a}^{b}\sqrt{\dot{x}^{2}t+\dot{y}^{2}t}dt +\] + +\end_inset + +. +\end_layout + +\begin_layout Standard +Ploščina območja, ki ga omejuje krivulja, če je parametrizacija taka, da + je krivulja levo od +\begin_inset Formula $\vec{r}t$ +\end_inset + +: +\begin_inset Formula $\text{Pl\left(D\right)=\ensuremath{\frac{1}{2}\int_{a}^{b}\left(xt\dot{y}t-\dot{x}tyt\right)dt}}$ +\end_inset + +. +\end_layout + +\begin_layout Standard +Ploskev eksplicitno kot graf +\begin_inset Formula $f:D^{\text{odp.}}\subseteq\mathbb{R}^{2}\to\mathbb{R}$ +\end_inset + +. + +\begin_inset Formula $f$ +\end_inset + + difer. + v +\begin_inset Formula $\left(x,y\right)\Rightarrow$ +\end_inset + + v +\begin_inset Formula $\left(x,y,f\left(x,y\right)\right)$ +\end_inset + + definiramo tangentno ravnino z normalo +\begin_inset Formula $\left(-f_{x}\left(x,y\right),-f_{y}\left(x,y\right),1\right)$ +\end_inset + + +\end_layout + +\begin_layout Standard +Ploskev implicitno: +\begin_inset Formula $f:\mathbb{R}^{3}\to\mathbb{R}$ +\end_inset + + zvezno parcialno odvedljiva. +\begin_inset Formula +\[ +P=\left\{ \left(x,y,z\right)\in\mathbb{R}^{3};f\left(x,y,z\right)=0\right\} +\] + +\end_inset + +Če +\begin_inset Formula $\forall\left(x,y,z\right)\in P:\nabla f\left(x,y,z\right)\not=0\Rightarrow P$ +\end_inset + + ploskev v +\begin_inset Formula $\mathbb{R}^{3}$ +\end_inset + +, saj je po izreku o implicitni fji +\begin_inset Formula $P$ +\end_inset + + lokalno graf fje dveh spremenljivk. + Normala tangentne ravnine v +\begin_inset Formula $\left(x,y,z\right)\in P$ +\end_inset + + ima normalo +\begin_inset Formula $\nabla f\left(x,y,z\right)$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset ERT +status open + +\begin_layout Plain Layout + + +\backslash +end{multicols} +\end_layout + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/šola/p2/dn/DN07a_63230317.c b/šola/p2/dn/DN07a_63230317.c new file mode 100644 index 0000000..3bc5323 --- /dev/null +++ b/šola/p2/dn/DN07a_63230317.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <stdlib.h> +int globina (int * t) { + fprintf(stderr, "-> %d %d\n", t[0], t[1]); + if (!t[0] && !t[1]) + return 0; + int r = 0; + if (t[0]) + r = globina(t+2*t[0]); + if (t[1]) { + int g = globina(t+2*t[1]); + if (g > r) + r = g; + } + return r+1; + +} +int main (void) { + int n; + scanf("%d\n", &n); + int t[2*n]; + for (int i = 0; i < 2*n; i++) + scanf("%d", &t[i]); + printf("%d\n", globina(t)); +} diff --git a/šola/p2/dn/DN07b_63230317.c b/šola/p2/dn/DN07b_63230317.c new file mode 100644 index 0000000..72a1ee9 --- /dev/null +++ b/šola/p2/dn/DN07b_63230317.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdbool.h> +#include <string.h> +int main (void) { + int n = 0; + scanf("%d\n", &n); + char nizi[n][43]; + int offseti[n]; + memset(offseti, 0, n*sizeof offseti[0]); + for (int i = 0; i < n; i++) + gets(nizi[i]); // izziv je v domačih nalogah pisat čim bolj nevarno a vseeno standardno C kodo + while (true) { + for (int i = 0; i < n; i++) + putchar(nizi[i][offseti[i]]); + putchar('\n'); + offseti[n-1]++; + for (int i = n-1; !nizi[i][offseti[i]]; i--) { + offseti[i] = 0; + offseti[i-1]++; + if (!i) + return 0; + } + } +} |