analyze.red 595 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. % function analysis
  2. % Function f (x) is defined ?
  3. if (freeof(f,x)) then << write "first define function f(x)"; end; >>
  4. fp:=df (f, x);
  5. fpp:=df (fp, x);
  6. % zeroes
  7. xz:=solve (f, x);
  8. % extremes
  9. xe:=solve (fp, x);
  10. % reversal points
  11. xr:=solve (fpp, x);
  12. % extreme values
  13. x1:=first (xe);
  14. y1:=sub (x1, f);
  15. y2:=sub (x1, fpp);
  16. on rounded;
  17. if numberp(y2) then
  18. if y2<0 then write "local maximum" else
  19. if y2=0 then write "reversal point"
  20. else write "local minimum";
  21. off rounded;
  22. % integration of 2nd derivative
  23. f1:=int (fpp, x);
  24. % integration of 1st derivative
  25. f0:=int (f1, x);
  26. f0:=int (fp, x);
  27. end;