# test(solution, eq) for algebra and differential equation, return 0 is true; test(sol_,eq_):= if(has(eq,y(1,x)) or has(eq,ds(y,x)) or has(eq,ds(y,x,2)), chop(n( ( (simplify( expand(simplify(expand(simplify (replace(tods(eq),y,n(replace(replace(sol,C_1,1),C_2,1)))))))))))), chop(n(replace(eq,x,replace(sol,n,1)))) ); test(sol_,eql_=eqr_):= test(sol,eql-eqr); test(sol_,int(y(tt_),t_,a_,b_)=eqr_):=chop( expand(int(replace(sol,x,tt),t,a,b)-eqr)); test(sol_ and sol2_,eq_):= test(sol,eq) and test(sol2,eq); test(sol_ and sol2_,eq_=eqr_):= test(sol,eq-eqr) and test(sol2,eq-eqr); test(sol_ and sol2_ and sol3_,eq_):= test(sol,eq) and test(sol2,eq) and test(sol3,eq); test(sol_ and sol2_ and sol3_ and sol4_,eq_):= test(sol,eq) and test(sol2,eq) and test(sol3,eq) and test(sol4,eq); test(sol_=sol2_,eq_):= test(solve(n(replace(sol=sol2,C_1,0)),y),eq); test(sol_=sol2_,eql_=eqr_):= test(solve(n(replace(sol=sol2,C_1,0)),y),eql-eqr); test(sol_=x,eql_=eqr_):= test(sol=x,eql-eqr); test(sol_=x,ds(y_,x_)=eqr_):= chop(n(expand(d(sol,y)+replace(-1/eqr,x,sol)))); test(sol_=x,ds(y_,x_,p_)=eqr_):= chop(n(expand(d(sol,y,p)+replace(-1/eqr,x,sol)))); test(sol_=x,y(p_,x_)+eqr_):= chop(n(simplify(expand(d(sol,y,p)+replace(1/eqr,x,sol))))); test(sol_=x,y(p_,x_)=eqr_):= chop(n(simplify(expand(d(sol,y,p)+replace(-1/eqr,x,sol))))); test(sol_=x,y'+eqr_):= chop(n(expand(d(sol,y)+replace(1/eqr,x,sol)))); test(sol_,eq_,y_):= chop(n(expand(replace(eq,y,sol)))); test(sol_,eql_=eqr_,y_):= chop(n(expand(replace(eql-eqr,y,sol)))); test(x=sol_,x(p_,t_)=eqr_,eqr2_):= chop(n(expand(d(sol,y,p)-replace(eqr,x,sol)))); test(y=sol_,eqr1_,y(p_,t_)=eqr_):= chop(n(expand(d(sol,x,p)-replace(eqr,y,sol)))); test(xx_=a_ and yy_=b_,eq1_=eq1r_,eq2_=eq2r_):= chop(n(simplify(expand(simplify(replace(replace(tods(eq1-eq1r),xx,n(a)),yy,n(b))))))) and chop(n(simplify(expand(simplify(replace(replace(tods(eq2-eq2r),xx,n(a)),yy,n(b))))))); test(xx_=a_,yy_=b_,eq1_=eq1r_,eq2_=eq2r_):= chop(n(expand(simplify(replace(replace(tods(eq1-eq1r),xx,n(a)),yy,n(b)))))) and chop(n(expand(simplify(replace(replace(tods(eq2-eq2r),xx,n(a)),yy,n(b)))))); test(x=sol_ and y=sol2_,eq_,x,y):= chop(n(replace(replace(eq,x,replace(sol,n,1)),y,replace(sol2,n,1)))); test(x=sol_ and y=sol2_,eq_=eqr_,x,y):= chop(n(replace(replace(eq-eqr,x,replace(sol,n,1)),y,replace(sol2,n,1))));