|
|
Bestimmen von Nullstellen
Erstes Beispiel
> |
f:= x -> x*cos(x):
lgn:= solve (f(x) = 0, x); |

Mit solve erhält man hier offensichtlich (zunächst)
nicht alle Lösungswerte:
> |
plot (f(x), x =
-2*Pi..2*Pi); |

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

Die Eigenschaften der Konstanten _B1 und _Z1:
> |
about(_B1);
about(_Z1); |

Dies ergibt:
> |
lgn:= 0, 2*Pi*(k -
1/4), 2*Pi*(k + 1/4); |

Numerische Berechnung einiger Nullstellen von f(x):
> |
zeros:= {0}:
for i from -2 to 2 do
zeros:= zeros union {subs (k = i, evalf(lgn[2]))}:
zeros:= zeros union {subs (k = i, evalf(lgn[3]))}:
od:
op (sort (convert (zeros, list))); |

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


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:
2.107, 3.705, -0.7823
Drittes Beispiel
> |
f:= x ->
0.0008*exp(x)*sin(x) + cos(x)^2;
plot (f(x), x = -15..10, y = -4..4); |


Maple ist nicht allmächtig:
> |
x:= solve (f(x) = 0, x); |
Warning, solutions may have been lost
Aber:
> |
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; |

Die Situation in einer kleinen Umgebung von −4,712, bzw. von −7,854:
> |
plot (f(x), x =
-4.714..-4.710, tickmarks = [3,3]); |

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

Viertes Beispiel
> |
restart;
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 = 0..2, y = -2..1, tickmarks = [4,3]); |


|