dh-Materialien Einführung in Maple    Übungen
|  Home  |  Back  |  <   >  |

Informatik
 

Einführung in Maple
  Hinweise
  Übersicht
  Übungen
  Anwendungen
  Stichworte
  Download

 

 

 

Ableiten von Polynomen

restart;
diffPol:= proc (term, x)
  local n, i, koeff,
      dterm, ablterm,
      term_is_poly;

Falls in  term  kein "x" vorkommt,
liefert  diffPol den Wert 0 zurück:
  if not has (term, x) then RETURN (0)
  else
Bestimmung des höchsten Exponenten in  term:
    if degree (term) = FAIL then
      n:= degree (term, x)
    else n:= degree (term):
    fi:

Es gibt keine Polynome mit negativem Grad, 
der Fall  n = 0  ist bereits erledigt, also:
    if (n < 1) then n:= 1: fi:

Ist  term ein Polynom?
    term_is_poly:= false;
    for i to n do
      if ispoly (term, i, x) then
        term_is_poly:= true:
        break:
      fi:
    od:

    if term_is_poly then
      n:= i:

Bestimmung der Koeffizienten des Polynoms:
      for i from 0 to n do
        koeff[i]:= coeff (term, x, i):
      od:

Anwendung der Potenzregel:
      for i from n by -1 to 1 do
        dterm[i-1]:= i*koeff[i]*x^(i-1):
      od:

Anwendung der Summenregel:
      ablterm:= 0;
      for i from n-1 by -1 to 0 do
        ablterm:= ablterm + dterm[i];
      od:
      RETURN (ablterm)
    else RETURN (`Term ist kein Polynom.`):
    fi:
  fi:
end;



















Testen der Prozedur diffPol:

diffPol (x^2, x);

2*x

diffPol ((2*x^5 + x^3)*(-3*x^2 - 4), x);

-42*x^6-55*x^4-12*x^2

diffPol (4*sin(x)^2, x);

`Term ist kein Polynom.`

diffPol ((2*x^2)^4, x);

128*x^7

diffPol (2*t^3 - x^2, t);

6*t^2

diffPol (x^(-1), x);

`Term ist kein Polynom.`

diffPol (x^(-1), z);

0

diffPol (3, x);

0

diffPol (a*b*x^4 - 2*x^7, x);

-14*x^6+4*a*b*x^3

diffPol (a^5*x^2, x);

2*a^5*x

diffPol (sin(bc)*x - z^2*sqrt(bb) + 2.5*x^3, x);

7.5*x^2+sin(bc)

diffPol (tt^5*ab^3*x^2 - (5*s^10)*x, x);

2*tt^5*ab^3*x-5*s^10

Copyright

Valid HTML 4.01 Transitional

|  Home  |  Back  |  Top  |