916 lines
25 KiB
Typst
916 lines
25 KiB
Typst
// #import "@preview/cetz:0.4.0": canvas
|
|
// #import "@preview/cetz-plot:0.1.2": plot
|
|
|
|
// #canvas({
|
|
// plot.plot(
|
|
// size: (8, 8),
|
|
// axis-style: "school-book", // nur Achsen, kein Rahmen[web:17]
|
|
// x-min: -2, x-max: 2, // negativer und positiver x-Bereich[web:27]
|
|
// y-min: -1, y-max: 3.5,
|
|
|
|
// x-tick-step: none, // automatische Ticks aus[web:24]
|
|
// y-tick-step: none,
|
|
// // nur 1/2 und x auf der x-Achse:
|
|
// x-ticks: (
|
|
// (0.5, $1/2$),
|
|
// (1.25, $x$),
|
|
// ),
|
|
// // z.B. ein paar y-Ticks, falls gewünscht:
|
|
// y-ticks: (
|
|
// (0.25, $1/4$),
|
|
// (1.5625, $x^2$),
|
|
// ),
|
|
|
|
// shared-zero: false, // optional: 0 am Ursprung ausblenden[web:16]
|
|
|
|
// // Parabel: y = x^2 auf [-2,2]
|
|
// plot.add(
|
|
// domain: (-3, 3),
|
|
// (x) => x * x,
|
|
// )
|
|
|
|
// )
|
|
// })
|
|
|
|
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
// #import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
// #cetz.canvas({
|
|
// //import cetz.plot
|
|
// //import cetz.palette
|
|
// import cetz.draw: *
|
|
// plot.plot(
|
|
// size: (6, 6),
|
|
// x-tick-step: none,
|
|
// y-tick-step: none,
|
|
// axis-style: "school-book",
|
|
// x-label: $x$,
|
|
// y-label: $y$,
|
|
// x-ticks: (
|
|
// (0.5, $1/2$),
|
|
// (1.25, $x$),
|
|
// ),
|
|
// y-ticks: (
|
|
// (0.25, $1/4$),
|
|
// (1.5625, $x^2$),
|
|
// ),
|
|
// {
|
|
// let f = x => calc.pow(x, 2)
|
|
|
|
// // Definition der Punkte
|
|
// let x0 = 0.5
|
|
// let y0 = f(x0)
|
|
// let x1 = 1.25
|
|
// let y1 = f(x1)
|
|
|
|
|
|
|
|
|
|
// // Berechnung der Steigung m = (y1 - y0) / (x1 - x0)
|
|
// let m = (y1 - y0) / (x1 - x0)
|
|
// // Sekantenfunktion: s(x) = m * (x - x0) + y0
|
|
// let s = x => m * (x - x0) + y0
|
|
|
|
// // 1. Die Parabel
|
|
// plot.add(f, domain: (-1.3, 1.8), label: $f(x) = x^2$)
|
|
|
|
// // 2. Die Sekante (etwas weiter gezeichnet für die Optik)
|
|
// plot.add(s, domain: (0, 2), style: (stroke: blue))
|
|
|
|
// // 3. Die Punkte markieren
|
|
// plot.add(((x0, y0),), mark: "o", label: $P_0$)
|
|
// plot.add(((x1, y1),), mark: "o", label: $P$)
|
|
|
|
// // 4. Hilfslinien (gestrichelt)
|
|
// plot.add(((x0, 0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.5pt)))
|
|
// plot.add(((x1, 0), (x1, y1)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.5pt)))
|
|
|
|
// plot.add(((x0, y0), (x1, y0)), style: (stroke: ( paint: gray.darken(80%), thickness: 0.5pt)))
|
|
|
|
|
|
// plot.add-anchor("pt1", (2,5))
|
|
// }
|
|
|
|
// )
|
|
// // content("plot.x", [asdf])
|
|
// })
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
// #import "@preview/cetz-plot:0.1.2": plot
|
|
|
|
// #cetz.canvas({
|
|
// plot.plot(
|
|
// size: (6, 6),
|
|
// x-tick-step: 1,
|
|
// y-tick-step: 1,
|
|
// axis-style: "school-book",
|
|
// x-label: $x$,
|
|
// y-label: $y$,
|
|
// {
|
|
// let f = x => calc.pow(x, 2)
|
|
// let x0 = 0.5
|
|
// let x1 = 1.5
|
|
|
|
// // 1. Die Parabel
|
|
// plot.add(f, domain: (-1.3, 1.8), label: $f(x)$)
|
|
|
|
// // 2. Die Sekante
|
|
// let m = (f(x1) - f(x0)) / (x1 - x0)
|
|
// plot.add(x => m * (x - x0) + f(x0), domain: (0, 2), style: (stroke: blue))
|
|
|
|
// // 3. Hilfslinien
|
|
// plot.add(((x0, 0), (x0, f(x0))), style: (stroke: (dash: "dashed", paint: gray)))
|
|
// plot.add(((x1, 0), (x1, f(x1))), style: (stroke: (dash: "dashed", paint: gray)))
|
|
|
|
// // 4. Beschriftungen OHNE den "bounds" Fehler
|
|
// // Wir nutzen plot.add mit leeren Markern oder speziellen Labels
|
|
|
|
// // Punkte markieren und direkt beschriften
|
|
// plot.add(((x0, f(x0)),), mark: "o", label: $P_0$)
|
|
// plot.add(((x1, f(x1)),), mark: "o", label: $P$)
|
|
|
|
// // Beschriftung an der x-Achse
|
|
// // Trick: Wir addieren einen "unsichtbaren" Punkt an der Achse mit Label
|
|
// plot.add(((x0, 0),), label: $x_0$, mark: none)
|
|
// plot.add(((x1, 0),), label: $x$, mark: none)
|
|
// }
|
|
// )
|
|
// })
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
// #import "@preview/cetz-plot:0.1.2" as cetz_plot
|
|
|
|
// #cetz.canvas({
|
|
// let cp = cetz_plot.plot
|
|
|
|
// let x0 = 0.5
|
|
// let x1 = 1.5
|
|
// let f = x => calc.pow(x, 2)
|
|
// let y0 = f(x0)
|
|
// let y1 = f(x1)
|
|
|
|
// cp.plot(
|
|
// size: (6, 6),
|
|
// x-tick-step: 1,
|
|
// y-tick-step: 1,
|
|
// axis-style: "school-book",
|
|
// x-label: $x$,
|
|
// y-label: $y$,
|
|
// {
|
|
// // 1. Die Graphen
|
|
// cp.add(f, domain: (-1.3, 1.8))
|
|
|
|
// let m = (y1 - y0) / (x1 - x0)
|
|
// cp.add(x => m * (x - x0) + y0, domain: (-0.2, 2.2), style: (stroke: blue))
|
|
|
|
// // 2. Hilfslinien
|
|
// cp.add(((x0, 0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray)))
|
|
// cp.add(((x1, 0), (x1, y1)), style: (stroke: (dash: "dashed", paint: gray)))
|
|
|
|
// // 3. Punkte P0 und P
|
|
// cp.add(((x0, y0),), mark: "o")
|
|
// cp.add(((x1, y1),), mark: "o")
|
|
|
|
// // 4. BESCHRIFTUNG (Der Trick: add mit mark: none)
|
|
// // Wir setzen die Labels direkt an die Koordinaten
|
|
|
|
// // x-Achse Beschriftung (leicht unter y=0 verschoben mit 'label-offset')
|
|
// cp.add(((x0, 0),), label: $x_0$, mark: none)
|
|
// cp.add(((x1, 0),), label: $x$, mark: none)
|
|
|
|
// // Punkte beschriften
|
|
// cp.add(((x0 - 0.1, y0 + 0.3),), label: $P_0$, mark: none)
|
|
// cp.add(((x1 + 0.2, y1),), label: $P$, mark: none)
|
|
|
|
// // Funktionsnamen
|
|
// cp.add(((1.6, 3.2),), label: $f(x)$, mark: none)
|
|
// }
|
|
// )
|
|
// })
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
// #import "@preview/cetz-plot:0.1.2" as cetz_plot
|
|
|
|
// #cetz.canvas({
|
|
// import cetz.draw: *
|
|
// let cp = cetz_plot.plot
|
|
|
|
// // 1. Parameter festlegen
|
|
// let (w, h) = (6, 6) // Größe des Plots
|
|
// let x-min = -1.5
|
|
// let x-max = 2.5
|
|
// let y-min = -1.0
|
|
// let y-max = 4.0
|
|
|
|
// let x0 = 0.5
|
|
// let x1 = 1.5
|
|
// let f = x => calc.pow(x, 2)
|
|
// let y0 = f(x0)
|
|
// let y1 = f(x1)
|
|
|
|
// // 2. Den Plot zeichnen (als Basis)
|
|
// cp.plot(
|
|
// size: (w, h),
|
|
// x-tick-step: 1,
|
|
// y-tick-step: 1,
|
|
// axis-style: "school-book",
|
|
// x-label: $x$,
|
|
// y-label: $y$,
|
|
// x-domain: (x-min, x-max),
|
|
// y-domain: (y-min, y-max),
|
|
// name: "p",
|
|
// {
|
|
// cp.add(f, domain: (x-min, x-max))
|
|
|
|
// let m = (y1 - y0) / (x1 - x0)
|
|
// cp.add(x => m * (x - x0) + y0, domain: (x-min, x-max), style: (stroke: blue))
|
|
|
|
// cp.add(((x0, 0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray)))
|
|
// cp.add(((x1, 0), (x1, y1)), style: (stroke: (dash: "dashed", paint: gray)))
|
|
|
|
// cp.add(((x0, y0),), mark: "o")
|
|
// cp.add(((x1, y1),), mark: "o")
|
|
// }
|
|
// )
|
|
|
|
// // 3. DER FIX: Manuelle Beschriftung über das "p.origin"
|
|
// // Wir nutzen die Größe des Plots, um die Koordinaten selbst zu setzen.
|
|
// // Da der Ursprung im school-book Stil bei (0,0) liegt:
|
|
// let plot-coords(x, y) = {
|
|
// let px = (x / (x-max - x-min)) * w
|
|
// let py = (y / (y-max - y-min)) * h
|
|
// return (rel: (px, py), to: "p.origin")
|
|
// }
|
|
|
|
// // Beschriftungen (Diese liegen nun außerhalb des Plot-Berechnungs-Logik)
|
|
// content(plot-coords(x0, -0.4), $x_0$)
|
|
// content(plot-coords(x1, -0.4), $x$)
|
|
// content(plot-coords(x0 - 0.3, y0 + 0.3), $P_0$)
|
|
// content(plot-coords(x1 + 0.3, y1), $P$)
|
|
// content(plot-coords(1.6, 3.2), $f(x)$)
|
|
// })
|
|
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
|
|
// #cetz.canvas({
|
|
// import cetz.draw: *
|
|
|
|
// // 1. Koordinatensystem manuell skalieren (1 Einheit = 1.5cm)
|
|
// scale(1.5)
|
|
|
|
// // Parameter
|
|
// let x0 = 0.5
|
|
// let x1 = 1.5
|
|
// let f(x) = calc.pow(x, 2)
|
|
// let y0 = f(x0)
|
|
// let y1 = f(x1)
|
|
|
|
// // 2. Achsen zeichnen (School-Book)
|
|
// line((-1.5, 0), (2.5, 0), mark: (end: ">"), name: "xaxis")
|
|
// line((0, -1), (0, 4), mark: (end: ">"), name: "yaxis")
|
|
|
|
// content((2.5, -0.3), $x$)
|
|
// content((-0.3, 4), $y$)
|
|
|
|
// // 3. Parabel zeichnen (Sampling-Methode: Sicherster Weg ohne Extra-Module)
|
|
// let points = ()
|
|
// for i in range(-13, 19) {
|
|
// let x = i / 10
|
|
// points.push((x, f(x)))
|
|
// }
|
|
// line(..points, stroke: black)
|
|
|
|
// // 4. Sekante zeichnen
|
|
// let m = (y1 - y0) / (x1 - x0)
|
|
// // Gerade: y = m*(x - x0) + y0
|
|
// line((-0.5, m * (-0.5 - x0) + y0), (2.2, m * (2.2 - x0) + y0), stroke: blue)
|
|
|
|
// // 5. Hilfslinien & Punkte
|
|
// line((x0, 0), (x0, y0), stroke: (dash: "dashed", paint: gray))
|
|
// line((x1, 0), (x1, y1), stroke: (dash: "dashed", paint: gray))
|
|
|
|
// circle((x0, y0), radius: 0.05, fill: black)
|
|
// circle((x1, y1), radius: 0.05, fill: black)
|
|
|
|
// // 6. BESCHRIFTUNGEN (Direkt an den Objekten)
|
|
// content((x0, -0.4), $x_0$)
|
|
// content((x1, -0.4), $x$)
|
|
|
|
// content((x0 - 0.3, y0 + 0.2), $P_0$)
|
|
// content((x1 + 0.3, y1), $P$)
|
|
|
|
// content((1.8, f(1.8)), $f(x)$, anchor: "west", padding: .1)
|
|
// content((2.1, 3.5), [Sekante], fill: white, padding: .1)
|
|
// })
|
|
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
|
|
// #cetz.canvas({
|
|
// import cetz.draw: *
|
|
|
|
// // 1. Koordinatensystem manuell skalieren (1 Einheit = 1.5cm)
|
|
// scale(1.5)
|
|
|
|
// // Parameter
|
|
// let x0 = 0.5
|
|
// let x1 = 1.5
|
|
// let f(x) = calc.pow(x, 2)
|
|
// let y0 = f(x0)
|
|
// let y1 = f(x1)
|
|
|
|
// // 2. Achsen zeichnen (School-Book)
|
|
// line((-1.5, 0), (2.5, 0), mark: (end: ">"), name: "xaxis")
|
|
// line((0, -1), (0, 4), mark: (end: ">"), name: "yaxis")
|
|
|
|
// content((2.5, -0.3), $x$)
|
|
// content((-0.3, 4), $y$)
|
|
|
|
// // 3. Parabel zeichnen (Sampling-Methode: Sicherster Weg ohne Extra-Module)
|
|
// let points = ()
|
|
// for i in range(-13, 19) {
|
|
// let x = i / 10
|
|
// points.push((x, f(x)))
|
|
// }
|
|
// line(..points, stroke: black)
|
|
|
|
// // 4. Sekante zeichnen
|
|
// let m = (y1 - y0) / (x1 - x0)
|
|
// // Gerade: y = m*(x - x0) + y0
|
|
// line((-0.5, m * (-0.5 - x0) + y0), (2.2, m * (2.2 - x0) + y0), stroke: blue)
|
|
|
|
// // 5. Hilfslinien & Punkte
|
|
// line((x0, 0), (x0, y0), stroke: (dash: "dashed", paint: gray))
|
|
// line((x1, 0), (x1, y1), stroke: (dash: "dashed", paint: gray))
|
|
|
|
// circle((x0, y0), radius: 0.05, fill: black)
|
|
// circle((x1, y1), radius: 0.05, fill: black)
|
|
|
|
// // 6. BESCHRIFTUNGEN (Direkt an den Objekten)
|
|
// content((x0, -0.4), $x_0$)
|
|
// content((x1, -0.4), $x$)
|
|
|
|
// content((x0 - 0.3, y0 + 0.2), $P_0$)
|
|
// content((x1 + 0.3, y1), $P$)
|
|
|
|
// content((1.8, f(1.8)), $f(x)$, anchor: "west", padding: .1)
|
|
// content((2.1, 3.5), [Sekante], fill: white, padding: .1)
|
|
// })
|
|
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
|
|
// #align(center,
|
|
// cetz.canvas({
|
|
// // import cetz.plot
|
|
// import cetz.palette
|
|
// import cetz.draw: *
|
|
|
|
// plot.plot(size: (5,5),
|
|
// name: "plot",
|
|
// x-tick-step: 2,
|
|
// x-minor-tick-step: 1,
|
|
// y-tick-step: 6,
|
|
// y-minor-tick-step: 1,
|
|
// axis-style: "school-book", {
|
|
// plot.add(domain: (-2.5, 2.5),
|
|
// x => (4-calc.pow(x, 2)),
|
|
// style: palette.tango-light)
|
|
// plot.add(domain: (-2.5, 2.5),
|
|
// x => (4-2*x),
|
|
// style: palette.tango-light)
|
|
// plot.add-fill-between(domain: (0, 2),
|
|
// x => (4-calc.pow(x, 2)),
|
|
// x => (4-2*x),
|
|
// style: palette.tango-light)
|
|
// plot.add(((0,4), (2,0)),
|
|
// mark: "o",
|
|
// mark-style: (stroke: none, fill: black),
|
|
// style: (stroke: none))
|
|
// plot.add-anchor("pt1", (2,5))
|
|
// plot.add-anchor("pt2", (-2,5.5))
|
|
// plot.add-anchor("parab", (1, 4-calc.pow(1, 2)+0.2))
|
|
// plot.add-anchor("rline", (-1.5, 4-2*(-1.5)-0.2))
|
|
// })
|
|
|
|
// content("plot.pt1", [$y=4-2x^2$], anchor: "south", name: "prb")
|
|
// line("plot.parab", "prb", mark: (start: ">"))
|
|
|
|
// content("plot.pt2", [$y=4-2x$], anchor: "north", name: "curve2")
|
|
// line("plot.rline", "curve2", mark: (start: ">"))
|
|
|
|
// })
|
|
// )
|
|
|
|
// #align(center,
|
|
// cetz.canvas({
|
|
// // import cetz.plot
|
|
// // import cetz.palette
|
|
// import cetz.draw: *
|
|
|
|
// plot.plot(
|
|
// size: (6,6),
|
|
// name: "plot",
|
|
// x-tick-step: none,
|
|
// y-tick-step: none,
|
|
// x-label: $x$,
|
|
// y-label: $y$,
|
|
// x-ticks: ((0.5, $1/2$),(1.25, $x$),),
|
|
// y-ticks: ((0.25, $1/4$),(1.5625, $x^2$),),
|
|
// axis-style: "school-book",
|
|
|
|
// plot.add(
|
|
// domain: (-1.3, 1.8),
|
|
|
|
// x => (calc.pow(x, 2)),
|
|
|
|
// )
|
|
// )}))
|
|
|
|
|
|
|
|
// #import "@preview/cetz:0.4.2"
|
|
// #import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
// #cetz.canvas({
|
|
// //import cetz.plot
|
|
// //import cetz.palette
|
|
// import cetz.draw: *
|
|
// plot.plot(
|
|
// size: (6, 6),
|
|
// x-tick-step: none,
|
|
// y-tick-step: none,
|
|
// axis-style: "school-book",
|
|
// x-label: $x$,
|
|
// y-label: $y$,
|
|
// x-ticks: (
|
|
// (0.5, $1/2$),
|
|
// (1.25, $x$),
|
|
// ),
|
|
// y-ticks: (
|
|
// (0.25, $1/4$),
|
|
// (1.5625, $x^2$),
|
|
// ),
|
|
// {
|
|
// let f = x => calc.pow(x, 2)
|
|
|
|
// // Definition der Punkte
|
|
// let x0 = 0.5
|
|
// let y0 = f(x0)
|
|
// let x1 = 1.25
|
|
// let y1 = f(x1)
|
|
|
|
// // Berechnung der Steigung m = (y1 - y0) / (x1 - x0)
|
|
// let m = (y1 - y0) / (x1 - x0)
|
|
// // Sekantenfunktion: s(x) = m * (x - x0) + y0
|
|
// let s = x => m * (x - x0) + y0
|
|
|
|
// // 1. Die Parabel
|
|
// plot.add(f, domain: (-1.3, 1.8), label: $f(x) = x^2$)
|
|
|
|
// // 2. Die Sekante (etwas weiter gezeichnet für die Optik)
|
|
// plot.add(s, domain: (0, 2), style: (stroke: blue))
|
|
|
|
// // 3. Die Punkte markieren
|
|
// plot.add(((x0, y0),), mark: "o", label: $P_0$)
|
|
// plot.add(((x1, y1),), mark: "o", label: $P$)
|
|
|
|
// // 4. Hilfslinien (gestrichelt)
|
|
// plot.add(((x0, 0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.5pt)))
|
|
// plot.add(((x1, 0), (x1, y1)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.5pt)))
|
|
|
|
// plot.add(((x0, y0), (x1, y0)), style: (stroke: ( paint: gray.darken(80%), thickness: 0.5pt)))
|
|
|
|
|
|
// plot.add-anchor("pt1", (2,5))
|
|
// }
|
|
|
|
// )
|
|
// // content("plot.x", [asdf])
|
|
// })
|
|
|
|
|
|
#import "@preview/cetz:0.4.2"
|
|
#import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
#cetz.canvas({
|
|
import cetz.draw: *
|
|
plot.plot(
|
|
//definitionen
|
|
{
|
|
//berechnungen und plot
|
|
}
|
|
)
|
|
})
|
|
|
|
|
|
|
|
#import "@preview/cetz:0.4.2"
|
|
#import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
#cetz.canvas(length: 1.25cm,{
|
|
import cetz.draw: *
|
|
set-style(
|
|
axes: (
|
|
// Basisstil beibehalten
|
|
stroke: (thickness: 0.5pt),
|
|
// x-Achse: stealth-Pfeil am Ende
|
|
x: (mark: (end: "stealth", fill: black)),
|
|
// y-Achse: stealth-Pfeil am Ende
|
|
y: (mark: (end: "stealth", fill: black)),
|
|
),
|
|
)
|
|
plot.plot(
|
|
//definitionen
|
|
name: "plot",
|
|
size: (6, 6),
|
|
x-tick-step: none,
|
|
y-tick-step: none,
|
|
axis-style: "school-book",
|
|
x-label: $x$,
|
|
y-label: $y$,
|
|
x-ticks: ((0.5, $1/2$),(1.25, $x$),),
|
|
y-ticks: ((0.25, $1/4$),(1.5625, $x^2$),),
|
|
{
|
|
//berechnungen und plot
|
|
let f = x => calc.pow(x, 2)
|
|
let x0 = 0.5
|
|
let y0 = f(x0)
|
|
let x1 = 1.25
|
|
let y1 = f(x1)
|
|
// Berechnung der Steigung m = (y1 - y0) / (x1 - x0)
|
|
let m = (y1 - y0) / (x1 - x0)
|
|
|
|
|
|
// Sekantenfunktion: s(x) = m * (x - x0) + y0
|
|
let s = x => m * (x - x0) + y0
|
|
|
|
let x1_1 = x1 + 0.1
|
|
let x0_1 = x0 - 0.2
|
|
let y0_1 = y0 + 0.2
|
|
let x2 = ((x1 - x0)/2) + x0
|
|
let y3 = ((y1 - y0)/2) +y0
|
|
|
|
plot.add(x => calc.pow(x, 2), domain: (-1.4, 1.8))
|
|
//Sekante
|
|
plot.add(s, domain: (0.3, 1.7), style: (stroke: red))
|
|
plot.add-anchor("pt1", (-1.4,y1))
|
|
plot.add-anchor("P", (x1_1,y1))
|
|
plot.add-anchor("P0", (x0_1,y0_1))
|
|
|
|
plot.add-anchor("F1", (x2,0.14))
|
|
plot.add-anchor("F2", (x1+0.1,y3))
|
|
|
|
|
|
plot.add(((x0, 0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.75pt)))
|
|
plot.add(((x1, 0), (x1, y1)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.75pt)))
|
|
plot.add(((0, y1), (x1, y1)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.75pt)))
|
|
plot.add(((0, y0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.75pt)))
|
|
|
|
plot.add(((x0, y0), (x1, y0)), style: (stroke: ( paint: gray.darken(80%), thickness: 0.5pt)))
|
|
plot.add(((x1, y0), (x1, y1)), style: (stroke: ( paint: gray.darken(80%), thickness: 0.5pt)))
|
|
|
|
|
|
plot.add(((x0, y0),), mark: "o")
|
|
plot.add(((x1, y1),), mark: "o")
|
|
|
|
|
|
|
|
}
|
|
)
|
|
//Der Plot muss einen Namen haben
|
|
content("plot.pt1", text(0.85em)[$y=x^2$], anchor: "east", name: "pt")
|
|
content("plot.P", text(0.75em)[$P$], anchor: "west", name: "p")
|
|
content("plot.P0", text(0.75em)[$P_0$], anchor: "west", name: "p0")
|
|
content("plot.F1", text(0.75em)[$x- 1/2$], anchor: "center", name: "f1")
|
|
content("plot.F2", text(0.75em)[$x^2- 1/4$], anchor: "west", name: "f2")
|
|
})
|
|
|
|
#import "@preview/cetz:0.4.2"
|
|
#import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
#cetz.canvas({
|
|
|
|
import cetz.draw: *
|
|
set-style(
|
|
axes: (
|
|
// Basisstil beibehalten
|
|
stroke: (thickness: 0.5pt),
|
|
// x-Achse: stealth-Pfeil am Ende
|
|
x: (mark: (end: "stealth", fill: black)),
|
|
// y-Achse: stealth-Pfeil am Ende
|
|
y: (mark: (end: "stealth", fill: black)),
|
|
),
|
|
)
|
|
plot.plot(
|
|
name: "plot",
|
|
size: (5, 5),
|
|
x-tick-step: none,
|
|
y-tick-step: none,
|
|
axis-style: "school-book",
|
|
x-label: $x$,
|
|
y-label: $y$,
|
|
x-ticks: ((0.5, $1/2$),),
|
|
y-ticks: ((1, $1$),),
|
|
|
|
//definitionen
|
|
{
|
|
let f = x => if x != 0.5 { (calc.pow(x, 2) - 0.25) / (x - 0.5) } else { none }
|
|
let x0 = 0.5
|
|
let y0 = 1
|
|
plot.add(f, domain: (-0.6, 0.75), style: (stroke: blue))
|
|
|
|
plot.add(((x0, 0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.75pt)))
|
|
|
|
plot.add(((0, y0), (x0, y0)), style: (stroke: (dash: "dashed", paint: gray, thickness: 0.75pt)))
|
|
|
|
plot.add(((x0, y0),), mark: "o")
|
|
|
|
plot.add-anchor("F1", (-.7,0.5))
|
|
plot.add-anchor("F2", (-.7,0.35))
|
|
}
|
|
)
|
|
content("plot.F1", text(0.85em)[$y=(x^2-1/4)/(x-1/2)$], anchor: "west", name: "pt")
|
|
content("plot.F2", text(0.85em)[$(x eq.not 1/2)$], anchor: "west", name: "pt")
|
|
})
|
|
|
|
#import "@preview/cetz:0.4.2"
|
|
#import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
#cetz.canvas({
|
|
import cetz.draw: *
|
|
plot.plot(
|
|
//definitionen
|
|
{
|
|
//berechnungen und plot
|
|
}
|
|
)
|
|
})
|
|
|
|
#import "@preview/cetz:0.4.1"
|
|
#import "@preview/cetz-plot:0.1.2"
|
|
|
|
#cetz.canvas({
|
|
import cetz.draw: *
|
|
import cetz-plot: *
|
|
set-style(
|
|
axes: (
|
|
stroke: (thickness: 0.5pt),
|
|
x: (mark: (end: "stealth", fill: black)),
|
|
y: (mark: (end: "stealth", fill: black)),
|
|
),
|
|
)
|
|
|
|
let f = x => (calc.pow(x,3)+0.5)
|
|
let x1 = 0.35
|
|
let x3 = 0.5
|
|
let x0 = 0.7
|
|
let x2 = 0.8
|
|
let y1 = f(x1)
|
|
|
|
|
|
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: ((x1, $x_1$),(x3, $x_3$),(x0, $x_0$),(x2, $x_2$),),
|
|
y-ticks: ((f(x1), $f(x_1)$),(f(x2), $f(x_2)$),(f(x0), $g$),(f(x3), $f(x_3)$)), {
|
|
plot.add(domain: (0.25, 1), f, style: (stroke: red))
|
|
|
|
plot.add(((x1, 0), (x1, f(x1))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
plot.add(((0, f(x1)), (x1, f(x1))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
|
|
plot.add(((x3, 0), (x3, f(x3))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
plot.add(((0, f(x3)), (x3, f(x3))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
|
|
plot.add(((x0, 0), (x0, f(x0))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
plot.add(((0, f(x0)), (x0, f(x0))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
|
|
plot.add(((x2, 0), (x2, f(x2))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
plot.add(((0, f(x2)), (x2, f(x2))), style: (stroke: (dash: "dashed", paint: gray, thickness: 1pt)))
|
|
|
|
// Hilfslinie damit Koordinatensystem nicht verrutscht
|
|
plot.add(((0, 0), (0, 0.1)), style: (stroke: none))
|
|
//circle((x1, y1), radius: 0.05, fill: black)
|
|
plot.add(((x1, f(x1)),), mark: "o", mark-style:(stroke: (paint: black, thickness: 0.75pt), fill: black))
|
|
plot.add(((x3, f(x3)),), mark: "o", mark-style:(stroke: (paint: black, thickness: 0.75pt), fill: black))
|
|
plot.add(((x0, f(x0)),), mark: "o", mark-style:(stroke: (paint: black, thickness: 0.75pt), fill: white))
|
|
plot.add(((x2, f(x2)),), mark: "o", mark-style:(stroke: (paint: black, thickness: 0.75pt), fill: black))
|
|
|
|
plot.add-anchor("F", (x2 - 0.05,f(x2)+0.1))
|
|
})
|
|
|
|
content("plot.F", text(0.85em)[$y=f(x)$], anchor: "east", name: "pt")
|
|
|
|
|
|
})
|
|
|
|
#import "@preview/cetz:0.4.2"
|
|
|
|
#align(center,
|
|
cetz.canvas({
|
|
import cetz-plot: *
|
|
import cetz.palette
|
|
import cetz.draw: *
|
|
|
|
plot.plot(size: (5,5),
|
|
name: "plot",
|
|
x-tick-step: 2,
|
|
x-minor-tick-step: 1,
|
|
y-tick-step: 2,
|
|
y-minor-tick-step: 1,
|
|
axis-style: "school-book", {
|
|
plot.add(domain: (-1, 2.5),
|
|
x => x - 1,
|
|
style: (color: red))
|
|
plot.add(domain: (-1, 2.5),
|
|
x => x - 1 + calc.exp(-x),
|
|
style: (color: yellow))
|
|
plot.add(domain: (-1, 2.5),
|
|
x => x - 1 - calc.exp(-x),
|
|
style: (color: red))
|
|
plot.add-anchor("pt1", (1,1.3))
|
|
plot.add-anchor("pt2", (1.8,-2))
|
|
plot.add-anchor("exp1", (1, calc.exp(-1)+0.2))
|
|
plot.add-anchor("exp2", (0.5, 0.5-1-calc.exp(-0.58)-0.2))
|
|
|
|
})
|
|
|
|
content("plot.pt1", [$y=t-1+e^(-t)$], anchor: "south", name: "prb")
|
|
line("plot.exp1", "prb", mark: (start: ">"))
|
|
|
|
content("plot.pt2", [$y=t-1-e^(-t)$], anchor: "north", name: "curve2")
|
|
line("plot.exp2", "curve2", mark: (start: ">"))
|
|
|
|
})
|
|
)
|
|
|
|
|
|
|
|
#import "@preview/cetz-plot:0.1.3": plot
|
|
|
|
#let intersection(plotA, plotB, style: (stroke: red + 2pt)) = {
|
|
let dataA = plotA.first().data
|
|
let dataB = plotB.first().data
|
|
|
|
let points = dataA.filter(x => x in dataB)
|
|
|
|
for ((i, point)) in points.enumerate() {
|
|
plot.add-anchor("i_" + str(i),point )
|
|
}
|
|
|
|
plotA
|
|
plotB
|
|
}
|
|
|
|
#canvas(
|
|
length: 1cm,
|
|
{
|
|
import draw: *
|
|
plot.plot(
|
|
name: "my_plot",
|
|
size: (5, 5),
|
|
axis-style: "school-book",
|
|
x-label: [$x$],
|
|
y-label: [$y$],
|
|
{
|
|
intersection(
|
|
plot.add(
|
|
style: (stroke: black + 1.5pt),
|
|
domain: (-1, 1),
|
|
x => calc.pow(x, 4) - 2 * calc.pow(x, 2) + 1,
|
|
),
|
|
plot.add(
|
|
style: (stroke: black + 1.5pt),
|
|
domain: (-1, 1),
|
|
x => -(calc.pow(x, 4) - 2 * calc.pow(x, 2) + 1),
|
|
)
|
|
)
|
|
}
|
|
)
|
|
|
|
// reference the point with {plot name}.i_{number}
|
|
line("my_plot.i_1", ((), "|-", (0,3.5)), mark: (start: ">"), name: "line")
|
|
content("line.end", [Here], anchor: "south", padding: .1)
|
|
},
|
|
)
|
|
|
|
|
|
#let intersection(plotA, plotB, style: (stroke: red + 2pt)) = {
|
|
import draw: *
|
|
let dataA = plotA.first().data
|
|
let dataB = plotB.first().data
|
|
|
|
plot.annotate({
|
|
hide({
|
|
intersections("i", line(..plotA.first().data), line(..plotB.first().data))
|
|
})
|
|
for-each-anchor("i", (name) => {
|
|
circle("i." + name, radius: 0.05, fill: red)
|
|
})
|
|
})
|
|
|
|
plotA
|
|
plotB
|
|
}
|
|
|
|
#canvas(
|
|
length: 1cm,
|
|
{
|
|
import draw: *
|
|
plot.plot(
|
|
name: "plot",
|
|
size: (10, 10),
|
|
axis-style: "school-book",
|
|
x-label: [$x$],
|
|
y-label: [$y$],
|
|
{
|
|
intersection(
|
|
plot.add(
|
|
style: (stroke: black + 1.5pt),
|
|
domain: (-1, 1),
|
|
x => calc.pow(x, 4) - 2 * calc.pow(x, 2) + 1,
|
|
),
|
|
plot.add(
|
|
style: (stroke: black + 1.5pt),
|
|
domain: (-1, 1),
|
|
x => -(calc.pow(x, 4) - 2 * calc.pow(x, 2) + 0.5),
|
|
),
|
|
)
|
|
},
|
|
)
|
|
},
|
|
)
|
|
|
|
|
|
#import "@preview/cetz:0.4.0"
|
|
#import "@preview/cetz-plot:0.1.2"
|
|
|
|
#let my-plot = cetz-plot.plot.plot.with(axis-style: "school-book")
|
|
|
|
#cetz.canvas({
|
|
import cetz.draw: *
|
|
import cetz-plot: *
|
|
set-style(
|
|
axes: (
|
|
stroke: (dash: "dotted", paint: gray),
|
|
x: (mark: (start: ">", end: ">"), padding: 1),
|
|
y: (mark: none),
|
|
tick: (stroke: gray + .5pt),
|
|
),
|
|
)
|
|
my-plot(
|
|
size: (5, 4),
|
|
y-tick-step: none,
|
|
{
|
|
plot.add(calc.sin, domain: (0, calc.pi * 2))
|
|
},
|
|
)
|
|
})
|
|
|
|
#let plot-cfg = (size: (5, 4), axis-style: "school-book")
|
|
#cetz.canvas({
|
|
import cetz.draw: *
|
|
import cetz-plot: *
|
|
plot.plot(..plot-cfg, {
|
|
plot.add(calc.sin, domain: (0, calc.pi * 2))
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
#import "@preview/simple-plot:0.3.0": plot
|
|
|
|
//#set page(width: auto, height: auto, margin: 0.5cm)
|
|
|
|
// Showcases: major grid only, grid-label-break, axis extension, integer ticks
|
|
#plot(
|
|
xmin: -3.1, xmax: 3.1,
|
|
ymin: -1, ymax: 9,
|
|
xlabel: $x$,
|
|
ylabel: $y$,
|
|
//show-grid: "major",
|
|
(fn: x => calc.pow(x, 2), stroke: blue + 1.5pt, label: $x^2$, label-pos: 0.7, label-side: "below-right"),
|
|
)
|
|
|
|
#plot(
|
|
xmin: -2 * calc.pi, xmax: 2 * calc.pi,
|
|
ymin: -2, ymax: 2,
|
|
width: 10, height: 5,
|
|
show-grid: "major",
|
|
xtick: (-2*calc.pi, -calc.pi, 0, calc.pi, 2*calc.pi),
|
|
xtick-labels: ($-2pi$, $-pi$, $0$, $pi$, $2pi$),
|
|
(fn: x => calc.sin(x), stroke: blue + 1.2pt),
|
|
(fn: x => calc.cos(x), stroke: red + 1.2pt),
|
|
)
|
|
|
|
#plot(
|
|
xmin: -2, xmax: 5,
|
|
ymin: 0, ymax: 32,
|
|
show-grid: true,
|
|
(fn: x => calc.pow(2, x), stroke: blue + 1.5pt, label: $2^x$),
|
|
(fn: x => calc.pow(3, x), stroke: red + 1.5pt, label: $3^x$),
|
|
) |