How does one compute calculus?
Name:
Anonymous
2010-08-21 6:08
I'm serious.
Do any known algorithms exist that are somewhat easy to implement and don't require that much computing power?
Links please!
Name:
Anonymous
2010-08-21 6:25
I believe you are hoping to develop the code yourself isn't it?
If so search into automatic differentiation.
Otherwise use something like Maple or Mathematica.....
Name:
Anonymous
2010-08-21 6:32
This was covered in SICP.
Name:
Anonymous
2010-08-21 6:49
What kind of calculus? There's hundreds of calculi.
Name:
Anonymous
2010-08-21 6:49
>>3
Yeah that's symbolic differentiation though. It's pretty inefficient. I was hoping for something better.
Name:
Anonymous
2010-08-21 6:52
>>4
Differential and Integral Calculus.
Name:
Anonymous
2010-08-21 7:05
I'll start you off, OP (untested, also not even correct for a general polynomial):
#include <stdlib.h>
typedef struct _polynomial {
int num;
float* coeffs;
float* powers;
} Polynomial;
void differentiate(Polynomial* p) {
int i;
for(i = 0; i < p->num; i++) {
p->coeffs[i] *= p->powers[i];
p->powers[i] -= 1.0f;
}
}
int main(int argc, char** argv) {
Polynomial* p = malloc(sizeof(Polynomial));
p->num = 2;
p->coeffs = malloc(p->num * sizeof(int));
p->powers = malloc(p->num * sizeof(int));
p->coeffs[0] = 1.0f;
p->coeffs[1] = 3.0f;
p->powers[0] = 1;
p->powers[1] = 2;
differentiate(p);
free(p->coeffs);
free(p->powers);
free(p);
return 0;
}
Name:
Anonymous
2010-11-25 14:55