TEST_F(LinguisticVariableTesting, testAddExistingSet){

	TriangularFuzzySet triangle("triangle",1,2,3);
	RectangularFuzzySet rect("triangle", 3,5);

	variable->addSet(&triangle);
	ASSERT_FALSE(variable->addSet(&rect));

	TrapezoidalFuzzySet trapez("trapezoid", -10,0,9,10);
	ASSERT_TRUE(variable->addSet(&trapez));
}
Esempio n. 2
0
mp_real mpe2gausstheo(mp_real x0_)
{ 
  static mp_real SQRTpi = sqrt(mppic) ;
  double gd = 1.0;  /* gd = 1/2 gamma !!!; hier gamma = 0.5 */
  double x0d = dble(x0_);
  mp_real g = mp_real(gd);
  mp_real fac = g/SQRTpi;
  double h = 1E-03;
  int n = 10000;
  double yd_ = trapez(kerngauss,x0d,gd,x0d,h,n); 
  mp_real y_ = fac * mp_real(yd_);
  return y_;
}
Esempio n. 3
0
mp_real mpe2gauss(mp_real x0_)
{ 
  static mp_real SQRTpi = sqrt(mppic) ;
  double gd = 1.0;  /* gd = 1/2 gamma !!!; hier gamma = 0.5 */
  double x0d = dble(x0_);
//  double xi = Xi4(x0d); /*Rauschen*/
  double xi = 0.0; /*Rauschen*/
  mp_real g = mp_real(gd);
  mp_real fac = g/SQRTpi;
  double h = 1E-03;
  int n = 10000;
  double yd_ = trapez(kerngauss,x0d,gd,x0d,h,n); 
  mp_real y_ = fac * mp_real(yd_);
  //y_ = y_ * (mp_real(1.0) + mp_real(0.0) * xi);
  return y_;
}
QString Integration::logInfo()
{
	ApplicationWindow *app = (ApplicationWindow *)parent();
    QLocale locale = app->locale();
    int prec = app->d_decimal_digits;

	QString logInfo = "[" + QDateTime::currentDateTime().toString(Qt::LocalDate);
	if (d_integrand == AnalyticalFunction){
		logInfo += "\n" + tr("Numerical integration of") + " f(" + d_variable + ") = " + d_formula + " ";
		logInfo += tr("using a %1 order method").arg(d_method) + "\n";
		logInfo += tr("From") + " x = " + locale.toString(d_from, 'g', prec) + " ";
		logInfo += tr("to") + " x = " + locale.toString(d_to, 'g', prec) + "\n";
		logInfo += tr("Tolerance") + " = " + locale.toString(d_tolerance, 'g', prec) + "\n";
		logInfo += tr("Iterations") + ": " + QString::number(romberg()) + "\n";
	} else if (d_integrand == DataSet){
		if (d_graph)
			logInfo += tr("\tPlot")+ ": ''" + d_graph->multiLayer()->objectName() + "'']\n";
		else
			logInfo += "\n";
		QString dataSet;
		if (d_curve)
			dataSet = d_curve->title().text();
		else
			dataSet = d_y_col_name;
		logInfo += "\n" + tr("Numerical integration of") + ": " + dataSet + " ";
		logInfo += tr("using the Trapezoidal Rule") + "\n";
		logInfo += tr("Points") + ": " + QString::number(d_n) + " " + tr("from") + " x = " + locale.toString(d_from, 'g', prec) + " ";
    	logInfo += tr("to") + " x = " + locale.toString(d_to, 'g', prec) + "\n";

		// use GSL to find maximum value of data set
		gsl_vector *aux = gsl_vector_alloc(d_n);
		for(int i=0; i < d_n; i++)
			gsl_vector_set (aux, i, fabs(d_y[i]));
		int maxID = gsl_vector_max_index (aux);
		gsl_vector_free(aux);

    	logInfo += tr("Peak at") + " x = " + locale.toString(d_x[maxID], 'g', prec)+"\t";
		logInfo += "y = " + locale.toString(d_y[maxID], 'g', prec)+"\n";
		d_area = trapez();
	}

	logInfo += tr("Area") + "=" + locale.toString(d_area, 'g', prec);
	logInfo += "\n-------------------------------------------------------------\n";
    return logInfo;
}
Esempio n. 5
0
File: obwody.c Progetto: DeziR/Wp_10
void obwody() {
    system("clear");
    int zmienna;
    printf("Wybrales obwody figur plaskich!\n");
    printf("Obwod jakiej figury chcesz policzyc?\n");
    printf("Kwadrat - nacisnij 1\n");
    printf("Prostokat - nacisnij 2\n");
    printf("Trojkat - nacisnij 3\n");
    printf("Kolo - nacisnij 4\n");
    printf("Trapez - nacisnij 5\n");
    printf("Romb - nacisnij 6\n");
    printf("Rownoleglobok - nacisnij 7\n");
    scanf("%d", &zmienna);
    switch (zmienna)
    {
    case 1:
        kwadrat();
        break;
    case 2:
        prostokat();
        break;
    case 3:
        trojkat();
        break;
    case 4:
        kolo();
        break;
    case 5:
        trapez();
        break;
    case 6:
        romb();
        break;
    case 7:
        rownoleglobok();
        break;
    default:
        printf("Zle wybrales!");
        break;
    }
}