Additional fixes and changes in Variables.
3 files modified
3 files added
| New file |
| | |
| | | #StartUvod |
| | | \vskip-2.9mm\noindent |
| | | \begin{tabular}{lr} |
| | | \begin{minipage}[t]{0.5\textwidth} |
| | | Na vi"sini $h=/*/h/*/\mathrm{m}$ nad nevtralno prevodno podlago |
| | | se nahajata prema vodnika polmera $r_0=/*/r0/*/$m. |
| | | Razdalja med njima je $d=/*/d/*/$m, naelektrena sta z |
| | | $\pm{q}=\pm/*/q/*/$C/m naboja na dol"zinsko enoto. |
| | | To"cki A in B sta na meji med ravno podlago in zrakom. |
| | | \end{minipage} |
| | | \hskip0.01\textwidth |
| | | \begin{minipage}[t]{0.4\textwidth} |
| | | \vskip-5mm |
| | | \begin{tikzpicture}[scale=0.7] |
| | | \fill[color=black] (0,2) circle (0.2); |
| | | \fill[color=black] (4,2) circle (0.2); |
| | | \node[above] at (0.4,2) {$-q$}; |
| | | \node[above] at (4.4,2) {$+q$}; |
| | | \draw [dashed,stealth-stealth] (-1,0) -- (-1,2); |
| | | \draw [dashed,stealth-stealth] (0,0.5) -- (4,0.5); |
| | | \draw [dotted] (0,0) -- (0,3); |
| | | \draw [dotted] (-1.5,2) -- (5.5,2); |
| | | \draw [dotted] (4,0) -- (4,3); |
| | | \fill[color=black!20] (-3.0,0) -- (8.5,0) -- (8.5,-0.8) -- (-3.0,-0.8); |
| | | \node[left] at (-1,1) {$h=/*/h/*/$m}; |
| | | \node[above] at (2,0.5) {$d=/*/d/*/$m}; |
| | | \node[below] at (4,0) {A}; |
| | | \node[below] at (8,0) {B}; |
| | | \fill[color=black] (4,0) circle (0.05); |
| | | \fill[color=black] (8,0) circle (0.05); |
| | | \draw [dashed,stealth-stealth] (4,0.5) -- (8,0.5); |
| | | \node[above] at (6,0.5) {$d=/*/d/*/$m}; |
| | | \end{tikzpicture} |
| | | \end{minipage} |
| | | \end{tabular} |
| | | \vskip-2mm |
| | | #EndUvod |
| | | |
| | | #StartPodnaloga |
| | | Kolik"sna je absolutna vrednost elektri"cne poljske jakosti |
| | | v to"cki A? |
| | | #EndPodnaloga |
| | | |
| | | #StartRezultat |
| | | TeX: E(\mathrm{A}) |
| | | izpis: sci 3 |
| | | enota: V/m |
| | | formula: eps0=8.854e-12;EA=q/(pi*eps0*h)*abs(-1+1/(1+(d/h)^2));EA |
| | | napacna: q/(2*pi*eps0*h)*abs(-1+1/(1+(d/h)^2)) |
| | | napacna: 5.29864*EA |
| | | napacna: q/(pi*eps0*h)*abs(1/(1+(d/h)^2)) |
| | | #EndRezultat |
| | | |
| | | #StartPodnaloga |
| | | Kolik"sno je razmerje povr"sinskih gostot naboja v to"ckah A in B? |
| | | #EndPodnaloga |
| | | |
| | | #StartRezultat |
| | | TeX: \sigma_\mathrm{A}/\sigma_\mathrm{B} |
| | | izpis: dec 3 |
| | | enota: |
| | | formula: ka=d/h;(1+4*ka^2)/3 |
| | | napacna: (1+ka^2)/3 |
| | | napacna: (1+4*ka^2) |
| | | napacna: (1+2*ka^2)/3 |
| | | #EndRezultat |
| | | |
| | | #StartPodnaloga |
| | | Kolik"sna je kapacitivnost dvovoda na enoto dol"zine? |
| | | #EndPodnaloga |
| | | |
| | | #StartRezultat |
| | | TeX: c |
| | | izpis: sci 3 |
| | | enota: F/m |
| | | formula: D=sqrt(d^2+4*h^2);c=pi*eps0/log(2*h*d/(r0*D));c |
| | | napacna: 2.4869128*c |
| | | napacna: 0.84128*c |
| | | napacna: 0.6838*c |
| | | napacna: 1.376*c |
| | | napacna: 19.14869128*c |
| | | #EndRezultat |
| | | |
| | | |
| | | #StartSkalar |
| | | ime: q |
| | | izpis: sci 2 |
| | | nacin: FixedVals 40e-9 50e-9 60e-9 |
| | | #EndSkalar |
| | | |
| | | #StartSkalar |
| | | ime: d |
| | | izpis: sci 1 |
| | | nacin: FixedVals 6 8 |
| | | #EndSkalar |
| | | |
| | | #StartSkalar |
| | | ime: h |
| | | izpis: sci 1 |
| | | nacin: FixedVals 1 2 |
| | | #EndSkalar |
| | | |
| | | #StartSkalar |
| | | ime: r0 |
| | | izpis: sci 1 |
| | | nacin: FixedVals 5e-3 6e-3 8e-3 |
| | | #EndSkalar |
| | | |
| | | |
| New file |
| | |
| | | #StartUvod |
| | | Kolikšno silo mora prenesti stena, v katero je usmerjen curek vodnega topa, |
| | | ki ima pretok 0.1 kg/s in hitrost 10 m/s? |
| | | #EndUvod |
| | | |
| | | #StartPodnaloga |
| | | ki ima pretok 0.1 kg/s in hitrost 10 m/s? |
| | | #EndPodnaloga |
| | | |
| | | #StartRezultat |
| | | TeX: |
| | | izpis: str |
| | | enota: |
| | | formula: '1 N' |
| | | napacna: '10 N' |
| | | napacna: '100 N' |
| | | napacna: '0.1 N' |
| | | napacna: '0.01 N' |
| | | #EndRezultat |
| | | |
| | | #StartSkalar |
| | | ime: dl |
| | | izpis: dec 2 |
| | | nacin: FixedVals 0.05 0.1 |
| | | #EndSkalar |
| | |
| | | |
| | | def substitute_variables(self, text): |
| | | for key, var in self.varDict.items(): |
| | | text = re.sub("\/\*\/" + key + "\/\*\/", var.format_as_tex(), text) |
| | | text = re.sub("\/\*\/" + key + "\/\*\/", var.format_without_dollar(), text) |
| | | return text |
| | | |
| | | def substitute_octave(self, text): |
| New file |
| | |
| | | Pomembna navodila: |
| | | ================== |
| | | |
| | | Uvod mora biti vedno prisoten. Za naloge brez podprimerov je uvod edino besedilo. Tudi pri nalogah s podprimeri, mora |
| | | obstajati uvod! |
| | | |
| | | |
| | | Nacini zrebanja stevil: |
| | | ======================= |
| | | * FixedVals N1 N2 N3 N4 |
| | | |
| | | Zreba med stevili N1-N4. |
| | | |
| | | * RandLinear START STOP |
| | | |
| | | Zreba stevilo med START in STOP. |
| | | |
| | | |
| | | Formatna dolocila |
| | | ================= |
| | | |
| | | * sci N |
| | | |
| | | N pove stevilo signifikantnih mest. Izpis bo v obliki 1.2345\cdot{123}, razen ce je eksponent 0, takrat je izpis 1.2345 |
| | | |
| | | primer: sci 2 |
| | | |
| | | * eng N (se ne dela) |
| | | |
| | | N pove stevilo signifikantnih mest. Izpis bo v obliki 1.2345\cdot{123}, kjer je eksponent veckratnik stevila 3. Ce je |
| | | eksponent 0, potem je izpis 1.2345. |
| | | |
| | | * dec N (se ne dela) |
| | | |
| | | N pove stevilo signifikantnih mest. Izpis bo s predpono 1.2345\,\upmu. Ce predpone ni, bo izpis 1.2345. |
| | | |
| | | * str |
| | | |
| | | Spremenljivka je niz. Zaenkrat samo v formulah in napacnih rezultatov. |
| | | |
| | | |
| | | |
| | | Navodila za pisanje formul: |
| | | =========================== |
| | | |
| | | 1. Uporabljas lahko katerikoli pythonov ukaz. Importirana je knjiznica math (from math import *). |
| | | |
| | | 2. Pomembno! Uporabljas lahko ^ ali **. Znak ^ se interno prevede v **! |
| | | |
| | | 3. Pomembno! Formula lahko vkljucuje serijo ukazov, locenih s ;. Zadnji ukaz naj ne bo 'enacba' tipa nekaj=nekaj. |
| | | |
| | | Primer napacne formule: |
| | | formula: eps0=8.854e-12;EA=q/(pi*eps0*h)*abs(-1+1/(1+(d/h)^2)) |
| | | Primer pravilne forume |
| | | formula: eps0=8.854e-12;EA=q/(pi*eps0*h)*abs(-1+1/(1+(d/h)^2));EA |
| | | |
| | | V prvem primeru se noben izraz ne 'izpise'. |
| | | |
| | | 4. Znotraj naloge se deklarirane vrednosti pri enem podproblemu lahko uporabijo v naslednjem! |
| | | |
| | |
| | | {"problem_number": 0, "text": problem_dict["introduction"]} |
| | | ) |
| | | for sp, sol in zip(problem_dict["subproblems"], problem_dict["solutions"]): |
| | | if sol["correct"][0].formatting == 'str': |
| | | formatstr = "{}{}{}" |
| | | else: |
| | | formatstr = "${}={}\,\mathrm{{{}}}$" |
| | | retstr += Template(self.template["subproblem"]).substitute( |
| | | { |
| | | "text": sp, |
| | | "ans1": ("${}={}\,\mathrm{{{}}}$").format(sol['glyph'],sol["correct"][0], sol['unit']), |
| | | "ans2": ("${}={}\,\mathrm{{{}}}$").format(sol['glyph'],sol["wrong"][0], sol['unit']), |
| | | "ans3": ("${}={}\,\mathrm{{{}}}$").format(sol['glyph'],sol["wrong"][1], sol['unit']), |
| | | "ans4": ("${}={}\,\mathrm{{{}}}$").format(sol['glyph'],sol["wrong"][2], sol['unit']), |
| | | "ans1": sol["correct"][0].format_as_tex(glyph=sol['glyph'], unit=sol['unit']), |
| | | "ans2": sol["wrong"][0].format_as_tex(glyph=sol['glyph'], unit=sol['unit']), |
| | | "ans3": sol["wrong"][1].format_as_tex(glyph=sol['glyph'], unit=sol['unit']), |
| | | "ans4": sol["wrong"][2].format_as_tex(glyph=sol['glyph'], unit=sol['unit']), |
| | | } |
| | | ) |
| | | retstr += Template(self.template["subproblem_end"]).substitute() |
| | | else: |
| | | if problem_dict["solutions"][0]["correct"][0].formatting == 'str': |
| | | formatstr = "{}{}{}" |
| | | else: |
| | | formatstr = "${}={}\,\mathrm{{{}}}$" |
| | | retstr += Template(self.template["problem"]).substitute( |
| | | { |
| | | "problem_number": 0, |
| | | "text": problem_dict["introduction"], |
| | | "ans1": formatstr.format(problem_dict["solutions"][0]["glyph"],problem_dict["solutions"][0]["correct"][0], problem_dict["solutions"][0]["unit"]), |
| | | "ans2": formatstr.format(problem_dict["solutions"][0]["glyph"],problem_dict["solutions"][0]["wrong"][0], problem_dict["solutions"][0]["unit"]), |
| | | "ans3": formatstr.format(problem_dict["solutions"][0]["glyph"],problem_dict["solutions"][0]["wrong"][1], problem_dict["solutions"][0]["unit"]), |
| | | "ans4": formatstr.format(problem_dict["solutions"][0]["glyph"],problem_dict["solutions"][0]["wrong"][2], problem_dict["solutions"][0]["unit"]), |
| | | "ans1": problem_dict["solutions"][0]["correct"][0].format_as_tex(glyph=problem_dict["solutions"][0]["glyph"],unit=problem_dict["solutions"][0]["unit"]), |
| | | "ans2": problem_dict["solutions"][0]["wrong"][0].format_as_tex(glyph=problem_dict["solutions"][0]["glyph"],unit=problem_dict["solutions"][0]["unit"]), |
| | | "ans3": problem_dict["solutions"][0]["wrong"][1].format_as_tex(glyph=problem_dict["solutions"][0]["glyph"],unit=problem_dict["solutions"][0]["unit"]), |
| | | "ans4": problem_dict["solutions"][0]["wrong"][2].format_as_tex(glyph=problem_dict["solutions"][0]["glyph"],unit=problem_dict["solutions"][0]["unit"]) |
| | | } |
| | | ) |
| | | return retstr |
| | |
| | | formatter = FormatterFactory.get_formatter(formatting) |
| | | self.formatted_value = formatter.getValue(self.value) |
| | | |
| | | def format_as_tex(self, formatting=None): |
| | | #if self.type != STRING: |
| | | def format_as_tex(self, formatting=None, glyph=None, unit=None): |
| | | if formatting is None: |
| | | formatting = self.formatting |
| | | formatter = FormatterFactory.get_formatter(formatting) |
| | | if formatting=="str": |
| | | return formatter.toFormat(self.value) |
| | | elif(glyph is None and unit is None): |
| | | return ("${}$").format(formatter.toFormat(self.value)) |
| | | elif(glyph is None and unit is not None): |
| | | return ("${}\,\mathrm{{{}}}$").format(formatter.toFormat(self.value), unit) |
| | | elif(glyph is not None and unit is None): |
| | | return ("${}={}$").format(glyph,formatter.toFormat(self.value)) |
| | | else: |
| | | return ("${}={}\,\mathrm{{{}}}$").format(glyph,formatter.toFormat(self.value), unit) |
| | | |
| | | def format_without_dollar(self, formatting=None): |
| | | if formatting is None: |
| | | formatting = self.formatting |
| | | formatter = FormatterFactory.get_formatter(formatting) |
| | | return formatter.toFormat(self.value) |
| | | #else: |
| | | # return self.value |
| | | |
| | | def get_formatted_value(self): |
| | | return self.formatted_value |