#include <stdio.h> #include <time.h> #include <stdlib.h> void expr (void); void term (void); void fact (void); int main (void) { time_t t; struct tm tm = *localtime(&(time_t){time(NULL)}); printf ("(C) David Vajda\n"); printf ("%s", asctime(&tm)); printf ("Uebungen fuer Integralrechnung und Extrema\n\n"); srand ((unsigned)time (&t)); expr (); printf ("\n"); return 0; } void expr (void) { term (); if ((rand () % 3) == 2) { printf (" + "); expr (); } return; } void term (void) { fact (); if ((rand () % 3) == 2) { printf (" * "); term (); } return; } int count = 0; void fact (void) { if ((rand () % 3) == 2) { printf ("("); expr (); printf (")"); count++; } else printf ("%i*x^%i", 1+rand() % 8, rand () % 8); return; } |
(C) David Vajda Mon Dec 16 12:25:19 2024 Uebungen fuer Integralrechnung und Extrema 4*x^0 + (1*x^2 + 1*x^2) = 4*x^2 + 4*x^2 = 16*x^2 F(x) = 16/3 * x^3 Intervall 2 .. 5 F(5) = 16/3 * 5^2 F(2) = 16/3 * 2^2 F(5) = 16/3 * 5^2 = 80/3 F(2) = 16/3 * 2^2 = 32/3 F(5) - F(2) = 80/3 - 32/3 = 48/3 = (45/3) + (3/3) = (15) + 1 = 16 ein rechenfehler! Ausversehen, x^2 genommmen nicht x^3 (%i1) integrate (16*x^2, x, 2, 5); (%o1) 624 (%i2) F(5) = 16/3 * 5^3 F(2) = 16/3 * 2^3 F(5) = 16/3 * 125 F(2) = 16/3 * 8 F(5) - F(2) = 2000/3 - 128/3 = 624 |