Ejemplo n.º 1
0
// Huen's Method for ODEs that return a double
double heuns_3dF2d(double x_k, double y_k, double x_step, double (*differential)(double, double)){
	
	double k1, k2, half_step;

	half_step = x_step / 2.0;
	k1 = differential(x_k, y_k);
	k2 = differential( (x_k + x_step), (y_k + (x_step * k1)) );

	return ( y_k + half_step * (k1+k2) );	
	
}
Ejemplo n.º 2
0
static gint
edge_detect (const guchar *data)
{
  gint ret;

  switch (evals.edgemode)
    {
    case SOBEL:
      ret = sobel (data);
      break;
    case PREWITT:
      ret = prewitt (data);
      break;
    case GRADIENT:
      ret = gradient (data);
      break;
    case ROBERTS:
      ret = roberts (data);
      break;
    case DIFFERENTIAL:
      ret = differential (data);
      break;
    case LAPLACE:
      ret = laplace (data);
      break;
    default:
      ret = -1;
      break;
    }

  return CLAMP0255 (ret);
}
Ejemplo n.º 3
0
Real
AuxChem::computeValue()
{
  Real matrix_energy(0.0);
  Real precip_energy(0.0);
  Real differential(0.0);

  matrix_energy = computeEnergy(_coupled_cons[_qp], _coupled_noncons[_qp], true);
  precip_energy = computeEnergy(_precip_conserved, _precip_nonconserved, false);
  differential = computeDifferential(_coupled_cons[_qp], _coupled_noncons[_qp]);

  return (matrix_energy - precip_energy + differential);
}
Ejemplo n.º 4
0
int main() {
   double h = 0;
   double x = 0;

   x = 1.8;

   /* 0.1 */
   h = 0.1;
   printf("h = %2.5lf, f(%2.5lf + %2.5lf) = %10.5lf, f' = %10.5lf\n",
       h, x, h, log(x + h), differential(log, h, x));

   /* 0.01 */
   h = 0.01;
   printf("h = %2.5lf, f(%2.5lf + %2.5lf) = %10.5lf, f' = %10.5lf\n",
       h, x, h, log(x + h), differential(log, h, x));

   /* 0.001 */
   h = 0.001;
   printf("h = %2.5lf, f(%2.5lf + %2.5lf) = %10.5lf, f' = %10.5lf\n",
       h, x, h, log(x + h), differential(log, h, x));

   return 0;
}