plotting and some other stuff
This commit is contained in:
parent
04a3fa6163
commit
e0d007d99e
7 changed files with 134 additions and 4 deletions
65
testing/cetz.typ
Normal file
65
testing/cetz.typ
Normal file
|
@ -0,0 +1,65 @@
|
|||
// #import "@preview/cetz:0.2.2": canvas, plot
|
||||
|
||||
#set page(width: auto, height: auto, margin: .5cm)
|
||||
|
||||
// #let style = (stroke: black, fill: rgb(0, 0, 200, 75))
|
||||
|
||||
// #canvas(length: 1cm, {
|
||||
// plot.plot(size: (8, 6),
|
||||
// x-tick-step: none,
|
||||
// x-ticks: ((-calc.pi, $-pi$), (0, $0$), (calc.pi, $pi$)),
|
||||
// y-tick-step: 1,
|
||||
// {
|
||||
// plot.add(
|
||||
// style: style,
|
||||
// domain: (-calc.pi, calc.pi), calc.sin)
|
||||
// plot.add(
|
||||
// hypograph: true,
|
||||
// style: style,
|
||||
// domain: (-calc.pi, calc.pi), calc.cos)
|
||||
// plot.add(
|
||||
// hypograph: true,
|
||||
// style: style,
|
||||
// domain: (-calc.pi, calc.pi), x => calc.cos(x + calc.pi))
|
||||
// })
|
||||
// })
|
||||
|
||||
// #canvas(length: 1cm, {
|
||||
// plot.plot(size: (-10, 10),
|
||||
// {},
|
||||
// )
|
||||
// })
|
||||
|
||||
|
||||
#import "@preview/cetz:0.2.2"
|
||||
// #cetz.canvas({
|
||||
// import cetz.draw: *
|
||||
// import cetz.plot
|
||||
// plot.plot(size: (2,2), x-tick-step: 2, y-tick-step: 2, x-equal: "y",
|
||||
// {
|
||||
// plot.add(((0,0), (1,1), (2,.5), (4,3)))
|
||||
// plot.add(domain: (0, 2 * calc.pi),
|
||||
// t => (calc.cos(t), calc.sin(t))
|
||||
// )
|
||||
// })
|
||||
// })
|
||||
|
||||
#cetz.canvas({
|
||||
import cetz.draw: *
|
||||
import cetz.plot
|
||||
plot.plot(size: (10, 4), x-tick-step: 2, y-tick-step: 50,
|
||||
{
|
||||
plot.add(domain: (-4, 4),
|
||||
x => (x, calc.pow(x, 4) ),
|
||||
label: $f(x)=x^4$
|
||||
)
|
||||
plot.add(domain: (-5, 6.34),
|
||||
x => (x, calc.pow(x, 3)),
|
||||
label: $f(x)=x^3$
|
||||
)
|
||||
plot.add(domain: (-10, 10),
|
||||
x => (x, calc.pow(x, 2)),
|
||||
label: $f(x) = x^2$
|
||||
)
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue