Files
maing01_06/Band2/Grafiken/B2.3.typ
2026-03-28 12:25:05 +01:00

136 lines
4.0 KiB
Typst

#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),
ymin: -2,
ymax: 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, $0$),),
{
//berechnungen und plot
plot.add(x => (calc.pow(x, 2) -2), domain: (-1.4, 1.8))
plot.add(x => (calc.pow(x, 2) +2), domain: (-1.4, 1.8))
}
)
})
#let linspace(start, end, n)=range(0,n).map(x => x / n * (end - start) + start)
#cetz.canvas({
import cetz.draw: *
line((-5,0), (5,0), mark: (end: "stealth", fill: black))
content((), block(inset: 0.2em)[$x$], anchor: "west")
line((0,-5), (0,5), mark: (end: "stealth", fill: black))
content((), block(inset: 0.2em)[$p^0$], anchor: "east")
let pe = linspace(-2, 2, 200).map(x => (calc.pow(x,2) +2, x))
line(..pe, stroke: olive)
// let draw-point(pos, text, color, anchor) = {
// circle(pos, radius: 0.1, fill: color, stroke: none)
// content((), block(inset: 0.3em)[#text], anchor: anchor)
//}
// draw-point((0, 3), "(a)", red, "east")
// draw-point((0, -3), "(b)", blue, "east")
// draw-point((1, 1), "(c)", red, "south-east")
// draw-point((1, -1), "(d)", blue, "north-east")
// draw-point((3, 0), "(e)", olive, "north-east")
// draw-point((0, 0), "(f)", olive, "east")
})
#let linspace(start, end, n)=range(0,n).map(x => x / n * (end - start) + start)
#cetz.canvas({
import cetz.draw: *
line((0,0), (5,0), mark: (end: "stealth", fill: black))
content((), block(inset: 0.2em)[$abs(bold(p))$], anchor: "west")
line((0,-5), (0,5), mark: (end: "stealth", fill: black))
content((), block(inset: 0.2em)[$p^0$], anchor: "east")
let pa = linspace(0, 4, 100).map(x => (x, calc.sqrt(9+x*x)))
line(..pa, stroke: red)
let pb = linspace(0, 4, 100).map(x => (x, -calc.sqrt(9+x*x)))
line(..pb, stroke: blue)
line((0,0), (5,5), stroke: red)
line((0,0), (5,-5), stroke: blue)
let pe = linspace(-4, 4, 100).map(x => (calc.sqrt(9+x*x), x))
line(..pe, stroke: olive)
let draw-point(pos, text, color, anchor) = {
circle(pos, radius: 0.1, fill: color, stroke: none)
content((), block(inset: 0.3em)[#text], anchor: anchor)
}
draw-point((0, 3), "(a)", red, "east")
draw-point((0, -3), "(b)", blue, "east")
draw-point((1, 1), "(c)", red, "south-east")
draw-point((1, -1), "(d)", blue, "north-east")
draw-point((3, 0), "(e)", olive, "north-east")
draw-point((0, 0), "(f)", olive, "east")
})
#import "@preview/cetz:0.3.2"
#import "@preview/cetz-plot:0.1.1"
#cetz.canvas(
{
import cetz.draw: *
import cetz-plot: *
plot.plot(
//size: (5,5),
xmin: -2cm,
xmax: 2cm,
ymin: -2cm,
ymax: 4cm,
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: ((2, $2$),(1, $1$)),
plot.add(
domain: (-5,5),
x => calc.pow(x, 2)+2
)
)
}
)
#import "@preview/cetz:0.4.1"
#import "@preview/cetz-plot:0.1.2"
#cetz.canvas({
import cetz.draw: *
import cetz-plot: *
let f = x => (calc.pow(x,2)+2)
plot.plot(size: (6,9), axis-style: "school-book", 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: ((2, $2$),), {
plot.add(domain: (-1.5, 1.5), f)
// Hilfslinie damit Koordinatensystem nicht verrutscht
plot.add(((0, 0), (0, 0.1)), style: (stroke: none))
})
})