Пример #1
0
string TestCell::allTests()
{
    //For each testing function, run and concatenate the results to output string
    string output = "";
    output += testConstructor();
    output += testStep();
    output += testEvolve();
    output += testAssign_Apoptosis();
    output += testAssign_Proliferation();
    output += testAssign_Differentiation();
    output += testAssign_Move();

    if (output == "")
        output = "All tests passed successfully\n";

    return output;
}
Пример #2
0
/*
 * 对三种方法比较进行比较
 */
void comparePrint(OdeFormula f,real t0,real x0,real step,int n)
{
	real t,x,h,mx,sx,A,tx;
	t = t0;
	tx = sx = mx=x = x0;
	h = step;	
	A = f(t,x,INITIAL);
	printf("变量\t|欧拉法\t误差\t|中点法\t误差\t误差比\t|测试\t误差|公式法|\n");
	for(int i=0;i<n;i++){
		x = eulerStep(f,t,x,h);
		mx = midpointStep(f,t,mx,h);
		tx = testStep(f,t,tx,h);
		t+=h;
		sx = f(t,A,SOLVE);
		printf("%.4f\t|%.4f\t%.4f\t|%.4f\t%.4f\t%.4f\t|%.4f\t%.7f|%.4f|\n",t,x,sx-x,mx,mx-sx,fabs(mx-sx)/fabs(sx-x),tx,tx-sx,sx);
	}		
}