Band 2 Grafiken bis 2.4
This commit is contained in:
215
Band2/grafiken.typ
Normal file
215
Band2/grafiken.typ
Normal file
@@ -0,0 +1,215 @@
|
||||
#import "@preview/cetz:0.4.2"
|
||||
#import "@preview/cetz-plot:0.1.3": plot
|
||||
|
||||
#let b2_1 = 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")
|
||||
})
|
||||
|
||||
#let b2_2 = 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")
|
||||
})
|
||||
|
||||
#let b2_3 = cetz.canvas(length: 3cm, {
|
||||
import cetz.draw: *
|
||||
|
||||
set-style(
|
||||
mark: (fill: black, scale: 2),
|
||||
stroke: (thickness: 0.4pt, cap: "round"),
|
||||
angle: (
|
||||
radius: 0.3,
|
||||
label-radius: .22,
|
||||
fill: green.lighten(80%),
|
||||
stroke: (paint: green.darken(50%))
|
||||
),
|
||||
content: (padding: 1pt)
|
||||
)
|
||||
|
||||
//grid((-.25, -.25), (2, 2 ), step: 0.5, stroke: gray + 0.2pt)
|
||||
|
||||
line((0, 0.25), (3, 0.25), mark: (end: "stealth", scale: 0.8))
|
||||
content((), $ x $, anchor: "west")
|
||||
|
||||
line((0.5,0.25),(2.5,0.25), stroke: 2pt)
|
||||
|
||||
circle((0.5,0.25), radius: 0.025, fill: white, stroke: (paint: black, thickness: 1.25pt), name: "01")
|
||||
|
||||
//content("01.end", anchor: "north", padding: (left: 3mm, bottom: 2mm), text(green.darken(30%))[Punkt $(a_1, a_2)$])
|
||||
|
||||
content("01.south", padding: (left: 0mm, bottom: -5mm), text([$x_0 -c$]))
|
||||
|
||||
circle((1.5,0.25), radius: 0.025, fill: white, stroke: (paint: black, thickness: 1.25pt), name: "02")
|
||||
|
||||
content("02.south", padding: (left: 0mm, bottom: -5mm), text([$x_0$]))
|
||||
|
||||
circle((2.5,0.25), radius: 0.025, fill: white, stroke: (paint: black, thickness: 1.25pt), name: "03")
|
||||
|
||||
content("03.south", padding: (left: 0mm, bottom: -5mm), text([$x_0 +c$]))
|
||||
|
||||
circle((1.5,0), radius: 0.0005, fill: white, stroke: (paint: white, thickness: 1.25pt), name: "02")
|
||||
|
||||
})
|
||||
|
||||
#let b2_4 = cetz.canvas({
|
||||
import cetz.draw: *
|
||||
//import cetz-plot: *
|
||||
|
||||
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))
|
||||
|
||||
|
||||
|
||||
// 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, 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)))
|
||||
|
||||
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.1,f(x2)))
|
||||
})
|
||||
|
||||
content("plot.F", text(0.85em)[$y=x^2$], anchor: "west", name: "pt")
|
||||
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user