Numerische Berechnung eines Integrals
> restart; with(Student[Calculus1]):
Festlegen der Optionen zum Zeichnen der Diagramme bzw. zum Berechnen der Näherungswerte:
> plotopts:= output = plot,
font = [COURIER, 12],
partition = 6,
title = "",
showarea = false,
labels = ["", ""],
size = [350, 255],
functionoptions = [color=navy, thickness=2],
caption = "",
boxoptions = [color=red, transparency=0.7]:
calcopts:= output = sum,
partition = 500:
partition = 6,
title = "",
showarea = false,
labels = ["", ""],
size = [350, 255],
functionoptions = [color=navy, thickness=2],
caption = "",
boxoptions = [color=red, transparency=0.7]:
calcopts:= output = sum,
partition = 500:
Definition einer Funktion:
> f:= x -> exp(sin(x)^7-cos(x)^7)-1.5;
plot(f(x), x = -1..3,
color = navy,
thickness = 2,
size = [350, 230],
font = [COURIER, 12]);
color = navy,
thickness = 2,
size = [350, 230],
font = [COURIER, 12]);
Das zu berechnende Integral:
> Int(f(x), x = -1..3);
Approximation des Integrals mit dem Riemannverfahren:
> ApproximateInt(f(x), x= -1..3, method = midpoint, plotopts);
evalf(ApproximateInt(f(x), x= -1..3, method = midpoint, calcopts));
Approximation des Integrals mit dem Trapezverfahren:
> ApproximateInt(f(x), x= -1..3, method = trapezoid, plotopts);
evalf(ApproximateInt(f(x), x= -1..3, method = trapezoid, calcopts));
Approximation des Integrals mit dem Simpsonverfahren:
> ApproximateInt(f(x), x= -1..3, method = simpson, plotopts);
evalf(ApproximateInt(f(x), x= -1..3, method = simpson, calcopts));
> evalf(Int(f(x), x= -1..3));
− 0.8984786647