void graph(double(*dFunct)(pt in),pt pt0,double delta,pt max, pt min,FILE* output){ bmp out = bmp(500,500); int i,ii; pt origin; pt size; size.x = max.x-min.x; size.y = max.y-min.y; origin.x = out.width*(-min.x/(size.x)); origin.y = out.height*(-min.y/(size.y)); if(origin.x<0) origin.x = 0; if(origin.y<0) origin.y = 0; for(i = 0;i<out.width;i++){ out.pixlearray[i][origin.y]; } for(i = 0;i<out.height;i++){ out.pixlearray[origin.x][ii]; } pt loc = pt0; while(ptwithin(loc,min,max)){ out.pxilearray[((loc.x*out.width)/size.x)-min.x][((loc.y*out.height)/size.y)-min.y]; loc = euler_step(dFunct,loc,delta); } }
static bool euler_advance(void* context, real_t t1, real_t t2, real_t* x) { // Well, if you're not going to be picky, we're going to be greedy. After // all, the backward Euler method is L-stable, so you're probably only // calling this if you're using theta == 1. And if you're not, it's time // to learn from your mistakes. real_t max_dt = t2 - t1; // Take one honkin' step. real_t t = t1; return euler_step(context, max_dt, &t, x); }