49 lines
1.3 KiB
Typst
49 lines
1.3 KiB
Typst
#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")
|
|
})
|
|
|