dh-Materialien
Maple   
Anwendungen

Bestimmen von Nullstellen

> restart;
  interface(displayprecision = 3):
  opts:= 'font = [Courier, 10], size = [350, 350]':

Erstes Beispiel

> f:= x -> x*cos(x):
lgn:= solve (f(x) = 0, x);

lgn:= 0, Pi/2

Mit solve erhält man hier offensichtlich (zunächst) nicht alle Lösungswerte:

> plot(f(x), x = -2*Pi..2*Pi, opts,
    numpoints = 5000,
    tickmarks = [5, 5]);

nullstellen2 

Aber:

> _EnvAllSolutions:= true:
lgn:= solve(f(x) = 0, x);

Eigenschaften der Konstante _Z1:

> about(_Z1);

Originally _Z1, renamed _Z1~:
  is assumed to be: integer

Dies ergibt:

> lgn:= 0, Pi*(k + 1/2);

lgn:= 0, 2*Pi*(k-1/4), 2*Pi*(k+1/4)

Numerische Berechnung einiger Nullstellen von f(x):

> zeros:= {0}:
for i from -5 to 4 do
  zeros:= zeros union {subs(k = i, evalf(lgn[2]))}:
od:
op(sort(convert(zeros, list)));

nullstellen5 

Zweites Beispiel

> restart;
  interface(displayprecision = 3):
  opts:= 'font = [Courier, 10], size = [350, 350]':

> f:= x -> 2^x - 0.95*x^2;
  plot(f(x), x = -2..5, y = -4..4, opts);

f:= x -> 2^x - 0.95*x^2

nullstellen7 

Mit fsolve erhält man im Allgemeinen jeweils nur einen Lösungswert:

> fsolve(f(x) = 0, x = -2..5);
fsolve(f(x) = 0, x = -1);
fsolve(f(x) = 0, x = 2);
fsolve(f(x) = 0, x = 4);

2.197
-0.7823
2.197
3.705

Aber:

> solve(f(x) = 0, x);

2.197, 3.705, -0.7823

Drittes Beispiel

> restart;
  interface(displayprecision = 4):
  opts:= 'font = [Courier, 10], size = [350, 350]':

> f:= x -> 0.0008*exp(x)*sin(x) + cos(x)^2;
plot(f(x), x = -15..10, y = -4..4,
  opts,
  thickness = 0);

f:= x -> 0.0008*e^x*sin(x) + cos(x)^2

nullstellen9 

Berechnung einiger Nullstellen von f:

> Digits:= 20:
interface(displayprecision = 10):
zeros:= {}:
for i from -18 to 10 do
  zero:= fsolve(f(x) = 0, x = i):
  if not evalb(zero in zeros) then
    zeros:= zeros union {zero}:
  fi:
od:
liste:= sort(convert(evalf(zeros), list)):
for i from 1 to nops(liste) do
  print(liste[i]);
od;

Nullstellen

Die Situation in einer kleinen Umgebung von −4,7125, bzw. von −7,854:

> plot(f(x), x = -4.713..-4.712,
    tickmarks = [3,3],
    opts,
    thickness = 0);

nullstellen10 

> plot(f(x), x = -7.855..-7.853,
    tickmarks = [3,4],
    opts);

nullstellen11 

Viertes Beispiel

> restart;
  interface(displayprecision = 10):
  opts:= 'font = [Courier, 10], size = [350, 350]':
  f:= x -> (sin(x^4))/(sqrt(x^2+1))-1;

Die Anwendung von solve liefert hier ein falsches Ergebnis:

> x[0]:= solve(f(x) = 0, x);
x[0]:= evalf(%);
f(x[0]);
plot(f(x), x = -1..2, y = -2..1,
  tickmarks = [4,3],
  opts,
  adaptive = true);

nullstellen15
nullstellen16