math stuff
4 realunknown
c_cpp
2 years ago
550 B
3
Indexable
Never
#include <math.h> #include <stdio.h> double f1(double a, double b, double x) { double result = fabs(pow(x, a + 2) - 1) + pow(cos(b * x + M_PI), 3); return result; } double f2(double a, double b, double x) { double result = cos(x + M_PI) * pow(log(a / x + pow(M_E, -2 * M_PI)), 2) - pow(M_E, -x + b); return result; } int main() { printf("f1(1, 1, 1) = %f\nf2(1, 1, 1) = %f\n", f1(1, 1, 1), f2(1, 1, 1)); printf("f1(-1, -0.4, -0.5) = %f\nf2(-1, -0.4, -0.5) = %f\n", f1(-1, -0.4, -0.5), f2(-1, -0.4, -0.5)); return 0; }