164 lines
3.5 KiB
Typst
164 lines
3.5 KiB
Typst
#import "@preview/fletcher:0.5.8" as fletcher: diagram, node, edge
|
|
#import "@preview/cetz:0.4.2" //Grafiken
|
|
#import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
#let bent-edge(from, to, ..args) = {
|
|
let midpoint = (from, 50%, to)
|
|
let vertices = (
|
|
from,
|
|
(from, "|-", midpoint),
|
|
(midpoint, "-|", to),
|
|
to,
|
|
)
|
|
edge(..vertices, "-|", ..args)
|
|
}
|
|
|
|
|
|
#let b3_0 = diagram(
|
|
node-stroke: luma(80%),
|
|
edge-corner-radius: none,
|
|
spacing: (10pt, 20pt),
|
|
|
|
// Nodes
|
|
node((1.5,0), [1.#h(3mm)2.#h(3mm)3.1.], name: <a>),
|
|
node((0.5,1), [4.1.-4.3.], name: <b>),
|
|
node((2.5,1), [3.2.-3.3.], name: <c>),
|
|
|
|
node((0,2), [4.4.-4.5.], name: <d>),
|
|
node((1,2), [4.6.], name: <e>),
|
|
|
|
node((2.501,2), [5.1.-5.5.], name: <f>),
|
|
node((2,3), [5.6.], name: <g>),
|
|
node((3,3), [5.7.], name: <h>),
|
|
node((4,3), [5.8.], name: <i>),
|
|
node((5,3), [5.9.], name: <j>),
|
|
node((6,3), [5.10.], name: <k>),
|
|
node((2.001,4), [#h(1mm)6.#h(1mm) ], name: <m>),
|
|
|
|
// Edges
|
|
bent-edge(<a>, <b>),
|
|
bent-edge(<a>, <c>),
|
|
bent-edge(<b>, <d>),
|
|
bent-edge(<b>, <e>),
|
|
bent-edge(<c>, <f>),
|
|
bent-edge(<c>, <f>),
|
|
bent-edge(<f>, <g>),
|
|
bent-edge(<f>, <h>),
|
|
bent-edge(<f>, <i>),
|
|
bent-edge(<f>, <j>),
|
|
bent-edge(<f>, <k>),
|
|
bent-edge(<g>, <m>),
|
|
)
|
|
|
|
|
|
#let b2_4 = cetz.canvas({
|
|
import cetz.draw: *
|
|
//import cetz-plot: *
|
|
|
|
let f = x => (0.01 * calc.pow(x, 3) - 0.2 * calc.pow(x, 2) + 0.8 * x + 3) + 5
|
|
let g = x => -(0.01 * calc.pow(x, 3) - 0.2 * calc.pow(x, 2) + 0.8 * x + 3) + 5
|
|
|
|
plot.plot(
|
|
size: (6, 7),
|
|
name: "plot",
|
|
axis-style: "school-book",
|
|
x-tick-step: none,
|
|
y-tick-step: none,
|
|
x-label: $x$,
|
|
y-label: $y$,
|
|
x-ticks: ((3, $x_1$), (12, $x_2$), (8, $x$)),
|
|
|
|
{
|
|
plot.add(domain: (2, 13), f, style: (stroke: red), samples: 300)
|
|
plot.add(domain: (2, 13), g, style: (stroke: blue), samples: 300)
|
|
|
|
plot.add-fill-between(
|
|
domain: (3, 12),
|
|
g,
|
|
f,
|
|
style: (
|
|
stroke: none,
|
|
fill: tiling(size: (3pt, 3pt), square(stroke: gray)),
|
|
),)
|
|
|
|
|
|
|
|
// Hilfslinie damit Koordinatensystem nicht verrutscht
|
|
plot.add(((0, 0), (0, 0.1)), style: (stroke: none))
|
|
|
|
plot.add-anchor("G1", (3, g(3)))
|
|
plot.add-anchor("F1", (3, f(3)))
|
|
plot.add-anchor("G1", (12, g(12)))
|
|
plot.add-anchor("G1", (12, g(12)))
|
|
|
|
plot.add(((3, 0), (3, f(3))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
plot.add(((12, 0), (12, f(12))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
},
|
|
)
|
|
})
|
|
|
|
|
|
#let EC_func(x) = {
|
|
let y = x*x*x - 4*x + 6
|
|
if y < 0 {
|
|
return 0
|
|
}
|
|
return calc.sqrt(y)
|
|
}
|
|
|
|
|
|
#let EC_drawing = cetz.canvas({
|
|
plot.plot(
|
|
size: (10, 10),
|
|
x-tick-step: 5,
|
|
y-tick-step: 20,
|
|
x-min: -5,
|
|
max: 10,
|
|
x-grid: true,
|
|
y-grid: true,
|
|
|
|
{
|
|
plot.add(domain: (-5, 10), EC_func, samples: 300)
|
|
plot.add(domain: (-5, 10), t => (t, -EC_func(t)),samples: 300)
|
|
})
|
|
})
|
|
|
|
#let EC_func2(x) = {
|
|
let y = (x - 3)*(x - 3)*(x - 3) - 4*(x - 3) + 12
|
|
if y < 0 {
|
|
return 0
|
|
}
|
|
return calc.sqrt(y)
|
|
}
|
|
|
|
|
|
#let EC_func3(x) = {
|
|
let y = -((x - 3)*(x - 3)*(x - 3) - 4*(x - 3)) + 4
|
|
if y < 0 {
|
|
return 0
|
|
}
|
|
return calc.sqrt(y)
|
|
}
|
|
|
|
|
|
#let EC_drawing2 = cetz.canvas({
|
|
plot.plot(
|
|
name: "plot",
|
|
|
|
axis-style: "school-book",
|
|
size: (10, 10),
|
|
x-tick-step: none,
|
|
y-tick-step: 20,
|
|
x-min: 0,
|
|
x-max: 7,
|
|
x-grid: true,
|
|
y-grid: true,
|
|
|
|
{
|
|
plot.add(((0, 0), (0, 0.1)), style: (stroke: none))
|
|
|
|
plot.add(domain: (1, 6), EC_func2, samples: 300)
|
|
|
|
plot.add(domain: (1, 6), EC_func3,samples: 300)
|
|
})
|
|
}) |