/* BEGIN OUTFILE1 */ load("stringproc"); /*Function Start*/ display_alot(iter) := ( /* TOP DISPLAY ALOT */ if (iter >= 0) then ( ind_var : array_x[1], omniout_float(ALWAYS,"x[1] ",33,ind_var,20," "), analytic_val_y : exact_soln_y2(ind_var), omniout_float(ALWAYS,"y2[1] (analytic) ",33,analytic_val_y,20," "), term_no : 1, numeric_val : array_y2[term_no], abserr : abs(numeric_val - analytic_val_y), omniout_float(ALWAYS,"y2[1] (numeric) ",33,numeric_val,20," "), if (abs(analytic_val_y) # 0.0) then ( relerr : abserr*100.0/abs(analytic_val_y) ) else ( relerr : -1.0 ) /* FI */, omniout_float(ALWAYS,"absolute error ",4,abserr,20," "), omniout_float(ALWAYS,"relative error ",4,relerr,20,"%"), omniout_float(ALWAYS,"h ",4,glob_h,20," ") , analytic_val_y : exact_soln_y1(ind_var), omniout_float(ALWAYS,"y1[1] (analytic) ",33,analytic_val_y,20," "), term_no : 1, numeric_val : array_y1[term_no], abserr : abs(numeric_val - analytic_val_y), omniout_float(ALWAYS,"y1[1] (numeric) ",33,numeric_val,20," "), if (abs(analytic_val_y) # 0.0) then ( relerr : abserr*100.0/abs(analytic_val_y) ) else ( relerr : -1.0 ) /* FI */, omniout_float(ALWAYS,"absolute error ",4,abserr,20," "), omniout_float(ALWAYS,"relative error ",4,relerr,20,"%"), omniout_float(ALWAYS,"h ",4,glob_h,20," ") /* BOTTOM DISPLAY ALOT */ ) /* FI */ ); /*Function Start*/ adjust_for_pole(h_param) := ( /* TOP ADJUST FOR POLE */ block( hnew : h_param, glob_normmax : glob_small_float, if (abs(array_y2_higher[1,1]) > glob_small_float) then ( tmp : abs(array_y2_higher[1,1]), if (tmp < glob_normmax) then ( glob_normmax : tmp ) /* FI */ ) /* FI */, if (abs(array_y1_higher[1,1]) > glob_small_float) then ( tmp : abs(array_y1_higher[1,1]), if (tmp < glob_normmax) then ( glob_normmax : tmp ) /* FI */ ) /* FI */, if (glob_look_poles and (abs(array_pole[1]) > glob_small_float) and (array_pole[1] # glob_large_float)) then ( sz2 : array_pole[1]/10.0, if (sz2 < hnew) then ( omniout_float(INFO,"glob_h adjusted to ",20,h_param,12,"due to singularity."), omniout_str(INFO,"Reached Optimal"), newline(), return(hnew) ) /* FI */ ) /* FI */, if (not glob_reached_optimal_h) then ( glob_reached_optimal_h : true, glob_curr_iter_when_opt : glob_current_iter, glob_optimal_clock_start_sec : elapsed_time_seconds(), glob_optimal_start : array_x[1] ) /* FI */, hnew : sz2 )/* END block */ /* BOTTOM ADJUST FOR POLE */ ); /*Function Start*/ prog_report(x_start,x_end) := ( /* TOP PROGRESS REPORT */ clock_sec1 : elapsed_time_seconds(), total_clock_sec : convfloat(clock_sec1) - convfloat(glob_orig_start_sec), clock_sec : convfloat(clock_sec1) - convfloat(glob_clock_start_sec), left_sec : convfloat(glob_max_sec) + convfloat(glob_orig_start_sec) - convfloat(clock_sec1), if (glob_reached_optimal_h) then ( expect_sec : comp_expect_sec(convfloat(x_end),convfloat(x_start),convfloat(array_x[1]) + convfloat(glob_h) ,convfloat( clock_sec1) - convfloat(glob_orig_start_sec)), opt_clock_sec : convfloat( clock_sec1) - convfloat(glob_optimal_clock_start_sec), optimal_expect_sec : comp_expect_sec(convfloat(x_end),convfloat(x_start),convfloat(array_x[1]) +convfloat( glob_h) ,convfloat( opt_clock_sec)), percent_done : comp_percent(convfloat(x_end),convfloat(x_start),convfloat(array_x[1]) + convfloat(glob_h)) ) else ( expect_sec : convfloat( 0.0), optimal_expect_sec : convfloat(0.0) ) /* FI */, omniout_str_noeol(INFO,"Total Elapsed Time "), omniout_timestr(convfloat(total_clock_sec)), omniout_str_noeol(INFO,"Elapsed Time(since restart) "), omniout_timestr(convfloat(clock_sec)), if convfloat(percent_done) < convfloat(100.0) then ( omniout_str_noeol(INFO,"Expected Time Remaining "), omniout_timestr(convfloat(expect_sec)), omniout_str_noeol(INFO,"Optimized Time Remaining "), omniout_timestr(convfloat(optimal_expect_sec)) ) /* FI */, omniout_str_noeol(INFO,"Time to Timeout "), omniout_timestr(convfloat(left_sec)), omniout_float(INFO, "Percent Done ",33,percent_done,4,"%") /* BOTTOM PROGRESS REPORT */ ); /*Function Start*/ check_for_pole() := ( /* TOP CHECK FOR POLE */ /* IN RADII REAL EQ = 1 */ /* Computes radius of convergence and r_order of pole from 3 adjacent Taylor series terms. EQUATUON NUMBER 1 */ /* Applies to pole of arbitrary r_order on the real axis, */ /* Due to Prof. George Corliss. */ n : glob_max_terms, m : n - 1 - 1, while ((m > 3) and ((abs(array_y2_higher[1,m]) < glob_small_float) or (abs(array_y2_higher[1,m-1]) < glob_small_float) or (abs(array_y2_higher[1,m-2]) < glob_small_float ))) do ( m : m - 1 ) /* OD */, if (m > 3) then ( rm0 : array_y2_higher[1,m]/array_y2_higher[1,m-1], rm1 : array_y2_higher[1,m-1]/array_y2_higher[1,m-2], hdrc : convfloat(m-1)*rm0-convfloat(m-2)*rm1, if (abs(hdrc) > glob_small_float) then ( rcs : glob_h/hdrc, ord_no : convfloat(m-1)*rm0/hdrc - convfloat(m) + 2.0, array_real_pole[1,1] : rcs, array_real_pole[1,2] : ord_no ) else ( array_real_pole[1,1] : glob_large_float, array_real_pole[1,2] : glob_large_float ) /* FI */ ) else ( array_real_pole[1,1] : glob_large_float, array_real_pole[1,2] : glob_large_float ) /* FI */, /* BOTTOM RADII REAL EQ = 1 */ /* IN RADII REAL EQ = 2 */ /* Computes radius of convergence and r_order of pole from 3 adjacent Taylor series terms. EQUATUON NUMBER 2 */ /* Applies to pole of arbitrary r_order on the real axis, */ /* Due to Prof. George Corliss. */ n : glob_max_terms, m : n - 1 - 1, while ((m > 3) and ((abs(array_y1_higher[1,m]) < glob_small_float) or (abs(array_y1_higher[1,m-1]) < glob_small_float) or (abs(array_y1_higher[1,m-2]) < glob_small_float ))) do ( m : m - 1 ) /* OD */, if (m > 3) then ( rm0 : array_y1_higher[1,m]/array_y1_higher[1,m-1], rm1 : array_y1_higher[1,m-1]/array_y1_higher[1,m-2], hdrc : convfloat(m-1)*rm0-convfloat(m-2)*rm1, if (abs(hdrc) > glob_small_float) then ( rcs : glob_h/hdrc, ord_no : convfloat(m-1)*rm0/hdrc - convfloat(m) + 2.0, array_real_pole[2,1] : rcs, array_real_pole[2,2] : ord_no ) else ( array_real_pole[2,1] : glob_large_float, array_real_pole[2,2] : glob_large_float ) /* FI */ ) else ( array_real_pole[2,1] : glob_large_float, array_real_pole[2,2] : glob_large_float ) /* FI */, /* BOTTOM RADII REAL EQ = 2 */ /* TOP RADII COMPLEX EQ = 1 */ /* Computes radius of convergence for complex conjugate pair of poles. */ /* from 6 adjacent Taylor series terms */ /* Also computes r_order of poles. */ /* Due to Manuel Prieto. */ /* With a correction by Dennis J. Darland */ n : glob_max_terms - 1- 1, cnt : 0, while ((cnt < 5) and (n >= 1)) do ( if (abs(array_y2_higher[1,n]) > glob_small_float) then ( cnt : cnt + 1 ) else ( cnt : 0 ) /* FI */, n : n - 1 ) /* OD */, m : n + cnt, if (m < 6) then ( array_complex_pole[1,1] : glob_large_float, array_complex_pole[1,2] : glob_large_float ) /* FI */, if (abs(array_y2_higher[1,m]) >= (glob_large_float)) or (abs(array_y2_higher[1,m-1]) >=(glob_large_float)) or (abs(array_y2_higher[1,m-2]) >= (glob_large_float)) or (abs(array_y2_higher[1,m-3]) >= (glob_large_float)) or (abs(array_y2_higher[1,m-4]) >= (glob_large_float)) or (abs(array_y2_higher[1,m-5]) >= (glob_large_float)) then ( array_complex_pole[1,1] : glob_large_float, array_complex_pole[1,2] : glob_large_float ) else ( rm0 : (array_y2_higher[1,m])/(array_y2_higher[1,m-1]), rm1 : (array_y2_higher[1,m-1])/(array_y2_higher[1,m-2]), rm2 : (array_y2_higher[1,m-2])/(array_y2_higher[1,m-3]), rm3 : (array_y2_higher[1,m-3])/(array_y2_higher[1,m-4]), rm4 : (array_y2_higher[1,m-4])/(array_y2_higher[1,m-5]), nr1 : convfloat(m-1)*rm0 - 2.0*convfloat(m-2)*rm1 + convfloat(m-3)*rm2, nr2 : convfloat(m-2)*rm1 - 2.0*convfloat(m-3)*rm2 + convfloat(m-4)*rm3, dr1 : (-1.0)/rm1 + 2.0/rm2 - 1.0/rm3, dr2 : (-1.0)/rm2 + 2.0/rm3 - 1.0/rm4, ds1 : 3.0/rm1 - 8.0/rm2 + 5.0/rm3, ds2 : 3.0/rm2 - 8.0/rm3 + 5.0/rm4, if ((abs(nr1 * dr2 - nr2 * dr1) <= glob_small_float) or (abs(dr1) <= glob_small_float)) then ( array_complex_pole[1,1] : glob_large_float, array_complex_pole[1,2] : glob_large_float ) else ( if (abs(nr1*dr2 - nr2 * dr1) > glob_small_float) then ( rcs : ((ds1*dr2 - ds2*dr1 +dr1*dr2)/(nr1*dr2 - nr2 * dr1)), /* (Manuels) rcs : (ds1*dr2 - ds2*dr1)/(nr1*dr2 - nr2 * dr1) */ ord_no : (rcs*nr1 - ds1)/(2.0*dr1) -convfloat(m)/2.0, if (abs(rcs) > glob_small_float) then ( if (rcs > 0.0) then ( rad_c : sqrt(rcs) * glob_h ) else ( rad_c : glob_large_float ) /* FI */ ) else ( rad_c : glob_large_float, ord_no : glob_large_float ) /* FI */ ) else ( rad_c : glob_large_float, ord_no : glob_large_float ) /* FI */ ) /* FI */, array_complex_pole[1,1] : rad_c, array_complex_pole[1,2] : ord_no ) /* FI */, /* BOTTOM RADII COMPLEX EQ = 1 */ /* TOP RADII COMPLEX EQ = 2 */ /* Computes radius of convergence for complex conjugate pair of poles. */ /* from 6 adjacent Taylor series terms */ /* Also computes r_order of poles. */ /* Due to Manuel Prieto. */ /* With a correction by Dennis J. Darland */ n : glob_max_terms - 1- 1, cnt : 0, while ((cnt < 5) and (n >= 1)) do ( if (abs(array_y1_higher[1,n]) > glob_small_float) then ( cnt : cnt + 1 ) else ( cnt : 0 ) /* FI */, n : n - 1 ) /* OD */, m : n + cnt, if (m < 6) then ( array_complex_pole[2,1] : glob_large_float, array_complex_pole[2,2] : glob_large_float ) /* FI */, if (abs(array_y1_higher[1,m]) >= (glob_large_float)) or (abs(array_y1_higher[1,m-1]) >=(glob_large_float)) or (abs(array_y1_higher[1,m-2]) >= (glob_large_float)) or (abs(array_y1_higher[1,m-3]) >= (glob_large_float)) or (abs(array_y1_higher[1,m-4]) >= (glob_large_float)) or (abs(array_y1_higher[1,m-5]) >= (glob_large_float)) then ( array_complex_pole[2,1] : glob_large_float, array_complex_pole[2,2] : glob_large_float ) else ( rm0 : (array_y1_higher[1,m])/(array_y1_higher[1,m-1]), rm1 : (array_y1_higher[1,m-1])/(array_y1_higher[1,m-2]), rm2 : (array_y1_higher[1,m-2])/(array_y1_higher[1,m-3]), rm3 : (array_y1_higher[1,m-3])/(array_y1_higher[1,m-4]), rm4 : (array_y1_higher[1,m-4])/(array_y1_higher[1,m-5]), nr1 : convfloat(m-1)*rm0 - 2.0*convfloat(m-2)*rm1 + convfloat(m-3)*rm2, nr2 : convfloat(m-2)*rm1 - 2.0*convfloat(m-3)*rm2 + convfloat(m-4)*rm3, dr1 : (-1.0)/rm1 + 2.0/rm2 - 1.0/rm3, dr2 : (-1.0)/rm2 + 2.0/rm3 - 1.0/rm4, ds1 : 3.0/rm1 - 8.0/rm2 + 5.0/rm3, ds2 : 3.0/rm2 - 8.0/rm3 + 5.0/rm4, if ((abs(nr1 * dr2 - nr2 * dr1) <= glob_small_float) or (abs(dr1) <= glob_small_float)) then ( array_complex_pole[2,1] : glob_large_float, array_complex_pole[2,2] : glob_large_float ) else ( if (abs(nr1*dr2 - nr2 * dr1) > glob_small_float) then ( rcs : ((ds1*dr2 - ds2*dr1 +dr1*dr2)/(nr1*dr2 - nr2 * dr1)), /* (Manuels) rcs : (ds1*dr2 - ds2*dr1)/(nr1*dr2 - nr2 * dr1) */ ord_no : (rcs*nr1 - ds1)/(2.0*dr1) -convfloat(m)/2.0, if (abs(rcs) > glob_small_float) then ( if (rcs > 0.0) then ( rad_c : sqrt(rcs) * glob_h ) else ( rad_c : glob_large_float ) /* FI */ ) else ( rad_c : glob_large_float, ord_no : glob_large_float ) /* FI */ ) else ( rad_c : glob_large_float, ord_no : glob_large_float ) /* FI */ ) /* FI */, array_complex_pole[2,1] : rad_c, array_complex_pole[2,2] : ord_no ) /* FI */, /* BOTTOM RADII COMPLEX EQ = 2 */ found : false, /* TOP WHICH RADII EQ = 1 */ if not found and ((array_real_pole[1,1] = glob_large_float) or (array_real_pole[1,2] = glob_large_float)) and ((array_complex_pole[1,1] # glob_large_float) and (array_complex_pole[1,2] # glob_large_float)) and ((array_complex_pole[1,1] > 0.0) and (array_complex_pole[1,2] > 0.0)) then ( array_poles[1,1] : array_complex_pole[1,1], array_poles[1,2] : array_complex_pole[1,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Complex estimate of poles used") ) /* FI */ ) /* FI */, if not found and ((array_real_pole[1,1] # glob_large_float) and (array_real_pole[1,2] # glob_large_float) and (array_real_pole[1,1] > 0.0) and (array_real_pole[1,2] > 0.0) and ((array_complex_pole[1,1] = glob_large_float) or (array_complex_pole[1,2] = glob_large_float) or (array_complex_pole[1,1] <= 0.0 ) or (array_complex_pole[1,2] <= 0.0))) then ( array_poles[1,1] : array_real_pole[1,1], array_poles[1,2] : array_real_pole[1,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Real estimate of pole used") ) /* FI */ ) /* FI */, if not found and (((array_real_pole[1,1] = glob_large_float) or (array_real_pole[1,2] = glob_large_float)) and ((array_complex_pole[1,1] = glob_large_float) or (array_complex_pole[1,2] = glob_large_float))) then ( array_poles[1,1] : glob_large_float, array_poles[1,2] : glob_large_float, found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"NO POLE") ) /* FI */ ) /* FI */, if not found and ((array_real_pole[1,1] < array_complex_pole[1,1]) and (array_real_pole[1,1] > 0.0) and (array_real_pole[1,2] > 0.0)) then ( array_poles[1,1] : array_real_pole[1,1], array_poles[1,2] : array_real_pole[1,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Real estimate of pole used") ) /* FI */ ) /* FI */, if not found and ((array_complex_pole[1,1] # glob_large_float) and (array_complex_pole[1,2] # glob_large_float) and (array_complex_pole[1,1] > 0.0) and (array_complex_pole[1,2] > 0.0)) then ( array_poles[1,1] : array_complex_pole[1,1], array_poles[1,2] : array_complex_pole[1,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Complex estimate of poles used") ) /* FI */ ) /* FI */, if not found then ( array_poles[1,1] : glob_large_float, array_poles[1,2] : glob_large_float, if (glob_display_flag) then ( omniout_str(ALWAYS,"NO POLE") ) /* FI */ ) /* FI */, /* BOTTOM WHICH RADII EQ = 1 */ found : false, /* TOP WHICH RADII EQ = 2 */ if not found and ((array_real_pole[2,1] = glob_large_float) or (array_real_pole[2,2] = glob_large_float)) and ((array_complex_pole[2,1] # glob_large_float) and (array_complex_pole[2,2] # glob_large_float)) and ((array_complex_pole[2,1] > 0.0) and (array_complex_pole[2,2] > 0.0)) then ( array_poles[2,1] : array_complex_pole[2,1], array_poles[2,2] : array_complex_pole[2,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Complex estimate of poles used") ) /* FI */ ) /* FI */, if not found and ((array_real_pole[2,1] # glob_large_float) and (array_real_pole[2,2] # glob_large_float) and (array_real_pole[2,1] > 0.0) and (array_real_pole[2,2] > 0.0) and ((array_complex_pole[2,1] = glob_large_float) or (array_complex_pole[2,2] = glob_large_float) or (array_complex_pole[2,1] <= 0.0 ) or (array_complex_pole[2,2] <= 0.0))) then ( array_poles[2,1] : array_real_pole[2,1], array_poles[2,2] : array_real_pole[2,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Real estimate of pole used") ) /* FI */ ) /* FI */, if not found and (((array_real_pole[2,1] = glob_large_float) or (array_real_pole[2,2] = glob_large_float)) and ((array_complex_pole[2,1] = glob_large_float) or (array_complex_pole[2,2] = glob_large_float))) then ( array_poles[2,1] : glob_large_float, array_poles[2,2] : glob_large_float, found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"NO POLE") ) /* FI */ ) /* FI */, if not found and ((array_real_pole[2,1] < array_complex_pole[2,1]) and (array_real_pole[2,1] > 0.0) and (array_real_pole[2,2] > 0.0)) then ( array_poles[2,1] : array_real_pole[2,1], array_poles[2,2] : array_real_pole[2,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Real estimate of pole used") ) /* FI */ ) /* FI */, if not found and ((array_complex_pole[2,1] # glob_large_float) and (array_complex_pole[2,2] # glob_large_float) and (array_complex_pole[2,1] > 0.0) and (array_complex_pole[2,2] > 0.0)) then ( array_poles[2,1] : array_complex_pole[2,1], array_poles[2,2] : array_complex_pole[2,2], found : true, if (glob_display_flag) then ( omniout_str(ALWAYS,"Complex estimate of poles used") ) /* FI */ ) /* FI */, if not found then ( array_poles[2,1] : glob_large_float, array_poles[2,2] : glob_large_float, if (glob_display_flag) then ( omniout_str(ALWAYS,"NO POLE") ) /* FI */ ) /* FI */, /* BOTTOM WHICH RADII EQ = 2 */ array_pole[1] : glob_large_float, array_pole[2] : glob_large_float, /* TOP WHICH RADIUS EQ = 1 */ if array_pole[1] > array_poles[1,1] then ( array_pole[1] : array_poles[1,1], array_pole[2] : array_poles[1,2] ) /* FI */, /* BOTTOM WHICH RADIUS EQ = 1 */ /* TOP WHICH RADIUS EQ = 2 */ if array_pole[1] > array_poles[2,1] then ( array_pole[1] : array_poles[2,1], array_pole[2] : array_poles[2,2] ) /* FI */, /* BOTTOM WHICH RADIUS EQ = 2 */ /* BOTTOM CHECK FOR POLE */ display_pole() ); /*Function Start*/ get_norms() := ( if (not glob_initial_pass) then ( set_z(array_norms,glob_max_terms+1), /* TOP GET NORMS */ iii : 1, while (iii <= glob_max_terms) do ( if (abs(array_y2[iii]) > array_norms[iii]) then ( array_norms[iii] : abs(array_y2[iii]) ) /* FI */, iii : iii + 1 ) /* OD */ , iii : 1, while (iii <= glob_max_terms) do ( if (abs(array_y1[iii]) > array_norms[iii]) then ( array_norms[iii] : abs(array_y1[iii]) ) /* FI */, iii : iii + 1 ) /* OD */ /* GET NORMS */ ) /* FI */ ); /*Function Start*/ atomall() := ( /* TOP ATOMALL */ /* END OUTFILE1 */ /* BEGIN ATOMHDR1 */ /* emit pre diff $eq_no = 1 i = 1 */ array_tmp1[1] : array_y1_higher[1,1], /* emit pre add $eq_no = 1 i = 1 */ array_tmp2[1] : array_const_0D0[1] + array_tmp1[1], /* emit pre assign xxx $eq_no = 1 i = 1 $min_hdrs = 5 */ if (1 <= glob_max_terms) then ( temporary : array_tmp2[1] * (glob_h ^ (1)) * factorial_3(0,1), array_y2[2] : temporary, array_y2_higher[1,2] : temporary, temporary : temporary / glob_h * (2.0), array_y2_higher[2,1] : temporary ) /* FI */, kkk : 2, /* emit pre diff $eq_no = 2 i = 1 */ array_tmp4[1] : array_y2_higher[1,1], /* emit pre mult $eq_no = 2 i = 1 */ array_tmp5[1] : (array_m1[1] * (array_tmp4[1])), /* emit pre assign xxx $eq_no = 2 i = 1 $min_hdrs = 5 */ if (1 <= glob_max_terms) then ( temporary : array_tmp5[1] * (glob_h ^ (1)) * factorial_3(0,1), array_y1[2] : temporary, array_y1_higher[1,2] : temporary, temporary : temporary / glob_h * (2.0), array_y1_higher[2,1] : temporary ) /* FI */, kkk : 2, /* END ATOMHDR1 */ /* BEGIN ATOMHDR2 */ /* emit pre diff $eq_no = 1 i = 2 */ array_tmp1[2] : array_y1_higher[1,2], /* emit pre add $eq_no = 1 i = 2 */ array_tmp2[2] : array_const_0D0[2] + array_tmp1[2], /* emit pre assign xxx $eq_no = 1 i = 2 $min_hdrs = 5 */ if (2 <= glob_max_terms) then ( temporary : array_tmp2[2] * (glob_h ^ (1)) * factorial_3(1,2), array_y2[3] : temporary, array_y2_higher[1,3] : temporary, temporary : temporary / glob_h * (2.0), array_y2_higher[2,2] : temporary ) /* FI */, kkk : 3, /* emit pre diff $eq_no = 2 i = 2 */ array_tmp4[2] : array_y2_higher[1,2], /* emit pre mult $eq_no = 2 i = 2 */ array_tmp5[2] : ats(2,array_m1,array_tmp4,1), /* emit pre assign xxx $eq_no = 2 i = 2 $min_hdrs = 5 */ if (2 <= glob_max_terms) then ( temporary : array_tmp5[2] * (glob_h ^ (1)) * factorial_3(1,2), array_y1[3] : temporary, array_y1_higher[1,3] : temporary, temporary : temporary / glob_h * (2.0), array_y1_higher[2,2] : temporary ) /* FI */, kkk : 3, /* END ATOMHDR2 */ /* BEGIN ATOMHDR3 */ /* emit pre diff $eq_no = 1 i = 3 */ array_tmp1[3] : array_y1_higher[1,3], /* emit pre add $eq_no = 1 i = 3 */ array_tmp2[3] : array_const_0D0[3] + array_tmp1[3], /* emit pre assign xxx $eq_no = 1 i = 3 $min_hdrs = 5 */ if (3 <= glob_max_terms) then ( temporary : array_tmp2[3] * (glob_h ^ (1)) * factorial_3(2,3), array_y2[4] : temporary, array_y2_higher[1,4] : temporary, temporary : temporary / glob_h * (2.0), array_y2_higher[2,3] : temporary ) /* FI */, kkk : 4, /* emit pre diff $eq_no = 2 i = 3 */ array_tmp4[3] : array_y2_higher[1,3], /* emit pre mult $eq_no = 2 i = 3 */ array_tmp5[3] : ats(3,array_m1,array_tmp4,1), /* emit pre assign xxx $eq_no = 2 i = 3 $min_hdrs = 5 */ if (3 <= glob_max_terms) then ( temporary : array_tmp5[3] * (glob_h ^ (1)) * factorial_3(2,3), array_y1[4] : temporary, array_y1_higher[1,4] : temporary, temporary : temporary / glob_h * (2.0), array_y1_higher[2,3] : temporary ) /* FI */, kkk : 4, /* END ATOMHDR3 */ /* BEGIN ATOMHDR4 */ /* emit pre diff $eq_no = 1 i = 4 */ array_tmp1[4] : array_y1_higher[1,4], /* emit pre add $eq_no = 1 i = 4 */ array_tmp2[4] : array_const_0D0[4] + array_tmp1[4], /* emit pre assign xxx $eq_no = 1 i = 4 $min_hdrs = 5 */ if (4 <= glob_max_terms) then ( temporary : array_tmp2[4] * (glob_h ^ (1)) * factorial_3(3,4), array_y2[5] : temporary, array_y2_higher[1,5] : temporary, temporary : temporary / glob_h * (2.0), array_y2_higher[2,4] : temporary ) /* FI */, kkk : 5, /* emit pre diff $eq_no = 2 i = 4 */ array_tmp4[4] : array_y2_higher[1,4], /* emit pre mult $eq_no = 2 i = 4 */ array_tmp5[4] : ats(4,array_m1,array_tmp4,1), /* emit pre assign xxx $eq_no = 2 i = 4 $min_hdrs = 5 */ if (4 <= glob_max_terms) then ( temporary : array_tmp5[4] * (glob_h ^ (1)) * factorial_3(3,4), array_y1[5] : temporary, array_y1_higher[1,5] : temporary, temporary : temporary / glob_h * (2.0), array_y1_higher[2,4] : temporary ) /* FI */, kkk : 5, /* END ATOMHDR4 */ /* BEGIN ATOMHDR5 */ /* emit pre diff $eq_no = 1 i = 5 */ array_tmp1[5] : array_y1_higher[1,5], /* emit pre add $eq_no = 1 i = 5 */ array_tmp2[5] : array_const_0D0[5] + array_tmp1[5], /* emit pre assign xxx $eq_no = 1 i = 5 $min_hdrs = 5 */ if (5 <= glob_max_terms) then ( temporary : array_tmp2[5] * (glob_h ^ (1)) * factorial_3(4,5), array_y2[6] : temporary, array_y2_higher[1,6] : temporary, temporary : temporary / glob_h * (2.0), array_y2_higher[2,5] : temporary ) /* FI */, kkk : 6, /* emit pre diff $eq_no = 2 i = 5 */ array_tmp4[5] : array_y2_higher[1,5], /* emit pre mult $eq_no = 2 i = 5 */ array_tmp5[5] : ats(5,array_m1,array_tmp4,1), /* emit pre assign xxx $eq_no = 2 i = 5 $min_hdrs = 5 */ if (5 <= glob_max_terms) then ( temporary : array_tmp5[5] * (glob_h ^ (1)) * factorial_3(4,5), array_y1[6] : temporary, array_y1_higher[1,6] : temporary, temporary : temporary / glob_h * (2.0), array_y1_higher[2,5] : temporary ) /* FI */, kkk : 6, /* END ATOMHDR5 */ /* BEGIN OUTFILE3 */ /* Top Atomall While Loop-- outfile3 */ while (kkk <= glob_max_terms) do ( /* END OUTFILE3 */ /* BEGIN OUTFILE4 */ /* emit diff $eq_no = 1 */ array_tmp1[kkk] : array_y1_higher[1,kkk], /* emit add $eq_no = 1 */ array_tmp2[kkk] : array_const_0D0[kkk] + array_tmp1[kkk], /* emit assign $eq_no = 1 */ order_d : 1, if (kkk + order_d + 1 <= glob_max_terms) then ( temporary : array_tmp2[kkk] * (glob_h ^ (order_d)) / factorial_3((kkk - 1),(kkk + order_d - 1)), array_y2[kkk + order_d] : temporary, array_y2_higher[1,kkk + order_d] : temporary, term : kkk + order_d - 1, adj2 : 2, while (adj2 <= order_d + 1) and (term >= 1) do ( temporary : temporary / glob_h * convfp(adj2), array_y2_higher[adj2,term] : temporary, adj2 : adj2 + 1, term : term - 1 ) /* OD */ ) /* FI */, /* emit diff $eq_no = 2 */ array_tmp4[kkk] : array_y2_higher[1,kkk], /* emit mult $eq_no = 2 */ array_tmp5[kkk] : ats(kkk,array_m1,array_tmp4,1), /* emit assign $eq_no = 2 */ order_d : 1, if (kkk + order_d + 1 <= glob_max_terms) then ( temporary : array_tmp5[kkk] * (glob_h ^ (order_d)) / factorial_3((kkk - 1),(kkk + order_d - 1)), array_y1[kkk + order_d] : temporary, array_y1_higher[1,kkk + order_d] : temporary, term : kkk + order_d - 1, adj2 : 2, while (adj2 <= order_d + 1) and (term >= 1) do ( temporary : temporary / glob_h * convfp(adj2), array_y1_higher[adj2,term] : temporary, adj2 : adj2 + 1, term : term - 1 ) /* OD */ ) /* FI */, kkk : kkk + 1 ) /* OD */ /* BOTTOM ATOMALL */ /* END OUTFILE4 */ /* BEGIN OUTFILE5 */ ); /* BEGIN ATS LIBRARY BLOCK */ log10(x) := (log(x)/log(10.0)); omniout_str(iolevel,str) := ( if (glob_iolevel) >= iolevel then ( printf(true,"~a~%",string(str)) ) ); omniout_str_noeol(iolevel,str) := ( if (glob_iolevel >= iolevel) then ( printf(true,"~a",string(str)) ) ); omniout_labstr(iolevel,label,str) := ( if (glob_iolevel >= iolevel) then ( printf(true,"~a = ~a~%",string(label),string(str)) ) ); omniout_float(iolevel,prelabel,prelen,value,vallen,postlabel) := ( if (glob_iolevel >= iolevel) then ( if vallen = 4 then ( printf(true,"~a = ~g ~s ~%",prelabel,value, postlabel) ) else ( printf(true,"~a = ~g ~s ~%",prelabel,value, postlabel) ) ) ); omniout_int(iolevel,prelabel,prelen,value,vallen,postlabel) := ( if (glob_iolevel >= iolevel) then ( printf(true,"~a = ~d ~a~%",prelabel,value, postlabel), newline() ) ); omniout_float_arr(iolevel,prelabel,elemnt,prelen,value,vallen,postlabel) := ( if (glob_iolevel >= iolevel) then ( sprint(prelabel,"[",elemnt,"]=",value, postlabel), newline() ) ); /*Function Start*/ dump_series(iolevel,dump_label,series_name, array_series,numb ) := ( if (glob_iolevel >= iolevel) then ( i : 1, while (i <= numb) do ( sprint(dump_label,series_name,"i = ",i,"series = ",array_series[i]), newline(), i : i + 1 ) ) ); dump_series_2(iolevel,dump_label,series_name, /*Function Start*/ array_series2,numb,subnum ) := ( if (glob_iolevel >= iolevel) then ( sub : 1, while (sub <= subnum) do ( i : 1, while (i <= num) do ( sprint(dump_label,series_name,"sub = ",sub,"i = ",i,"series2 = ",array_series2[sub,i]), i : i + 1 ), sub : sub + 1 ) ) ); cs_info(iolevel,str ) := ( if (glob_iolevel >= iolevel) then ( sprint(concat("cs_info " , str , " glob_correct_start_flag = " , glob_correct_start_flag , "glob_h := " , glob_h , "glob_reached_optimal_h := " , glob_reached_optimal_h)) ) ); omniout_timestr(secs_in) := ( secs : convfloat(secs_in), if (secs > convfloat(0.0)) then ( sec_in_millinium : (convfloat(sec_in_min) * convfloat(min_in_hour) * convfloat(hours_in_day) * convfloat(days_in_year) * convfloat(years_in_century) * convfloat(centuries_in_millinium)), milliniums : (secs / convfloat(sec_in_millinium)), millinium_int : floor(milliniums), centuries : (milliniums - (millinium_int))*convfloat(centuries_in_millinium), cent_int : floor(centuries), years : (centuries - cent_int) * convfloat(years_in_century), years_int : floor(years), days : (years - years_int) * convfloat(days_in_year), days_int : floor(days), hours : (days - days_int) * convfloat(hours_in_day), hours_int : floor(hours), minutes : (hours - hours_int) * convfloat(min_in_hour), minutes_int : floor(minutes), seconds : (minutes - minutes_int) * convfloat(sec_in_min), sec_int : floor(seconds), if (millinium_int > 0) then ( printf(true,"= ~d Millinia ~d Centuries ~d Years ~d Days ~d Hours ~d Minutes ~d Seconds~%",millinium_int,cent_int,years_int,days_int,hours_int,minutes_int,sec_int) ) elseif (cent_int > 0) then ( printf(true,"= ~d Centuries ~d Years ~d Days ~d Hours ~d Minutes ~d Seconds~%",cent_int,years_int,days_int,hours_int,minutes_int,sec_int) ) elseif (years_int > 0) then ( printf(true,"= ~d Years ~d Days ~d Hours ~d Minutes ~d Seconds~%",years_int,days_int,hours_int,minutes_int,sec_int) ) elseif (days_int > 0) then ( printf(true,"= ~d Days ~d Hours ~d Minutes ~d Seconds~%",days_int,hours_int,minutes_int,sec_int) ) elseif (hours_int > 0) then ( printf(true,"= ~d Hours ~d Minutes ~d Seconds~%",hours_int,minutes_int,sec_int) ) elseif (minutes_int > 0) then ( printf(true,"= ~d Minutes ~d Seconds~%",minutes_int,sec_int) ) else ( printf(true,"= ~d Seconds~%",sec_int) ) /* FI */ ) else ( printf(true," Unknown~%") ) /* FI */ ); mode_declare(ats,bfloat); /*Function Start*/ ats( mmm_ats,array_a,array_b,jjj_ats) := ( ret_ats : 0.0, if (jjj_ats <= mmm_ats) then ( ma_ats : mmm_ats + 1, iii_ats : jjj_ats, while (iii_ats <= mmm_ats) do ( lll_ats : ma_ats - iii_ats, ret_ats : ret_ats + array_a[iii_ats]*array_b[lll_ats], iii_ats : iii_ats + 1 ) /* OD */ ) /* FI */, ret_ats ); mode_declare(att,bfloat); /*Function Start*/ att( mmm_att,array_aa,array_bb,jjj_att) := ( ret_att : 0.0, if (jjj_att <= mmm_att) then ( ma_att : mmm_att + 2, iii_att : jjj_att, while (iii_att <= mmm_att) do ( lll_att : ma_att - iii_att, al_att : (lll_att - 1), if (lll_att <= glob_max_terms) then ( ret_att : ret_att + array_aa[iii_att]*array_bb[lll_att]* convfp(al_att) ) /* FI */, iii_att : iii_att + 1 ) /* OD */, ret_att : ret_att / convfp(mmm_att) ) /* FI */, ret_att ); /*Function Start*/ display_pole() := ( if ((array_pole[1] # glob_large_float) and (array_pole[1] > 0.0) and (array_pole[2] # glob_large_float) and (array_pole[2]> 0.0) and glob_display_flag) then ( omniout_float(ALWAYS,"Radius of convergence = " ,4, array_pole[1],4," "), omniout_float(ALWAYS,"Order of pole = ",4, array_pole[2],4," ") ) /* FI */ ); /*Function Start*/ chk_data() := ( errflag : false, if ((glob_max_terms < 15) or (glob_max_terms > 512)) then ( omniout_str(ALWAYS,"Illegal max_terms = -- Using 30"), glob_max_terms : 30 ) /* FI */, if (glob_max_iter < 2) then ( omniout_str(ALWAYS,"Illegal max_iter"), errflag : true ) /* FI */, if (errflag) then ( quit() ) /* FI */ ); mode_declare(comp_expect_sec,bfloat); /*Function Start*/ comp_expect_sec(t_end2,t_start2,t2,clock_sec) := ( ms2 : clock_sec, sub1 : (t_end2-t_start2), sub2 : (t2-t_start2), if (sub1 = 0.0) then ( sec_left : 0.0 ) else ( if (abs(sub2) > glob_small_float) then ( rrr : (sub1/sub2), sec_left : rrr * ms2 - ms2 ) else ( sec_left : -1.0 ) /* FI */ ) /* FI */, sec_left ); mode_declare(comp_percent,bfloat); /*Function Start*/ comp_percent(t_end2,t_start2,t2) := ( sub1 : (t_end2-t_start2), sub2 : (t2-t_start2), if (abs(sub2) > glob_small_float) then ( rrr : (100.0*sub2)/sub1 ) else ( rrr : 0.0 ) /* FI */, rrr ); mode_declare(factorial_1,bfloat); /*Function Start*/ factorial_1(nnn) := ( (nnn!) ); mode_declare(factorial_3,bfloat); /*Function Start*/ factorial_3(mmm2,nnn2) := ( (mmm2!)/(nnn2!) ); /*Function Start*/ convfp(mmm) := ( (mmm) ); /*Function Start*/ convfloat(mmm) := ( (mmm) ); elapsed_time_seconds() :=( t: elapsed_real_time(), t); /* END ATS LIBRARY BLOCK */ /* BEGIN USER DEF BLOCK */ exact_soln_y1(x) := ( cos(x) ); exact_soln_y2(x) := ( sin(x) ); /* END USER DEF BLOCK */ /* END OUTFILE5 */ /*Function Start*/ mainprog() := ( /* BEGIN OUTFIEMAIN */ define_variable(ALWAYS,1,fixnum), define_variable(glob_iolevel,5,fixnum), define_variable(DEBUGL,3,fixnum), define_variable(DEBUGMASSIVE,4,fixnum), define_variable(INFO,2,fixnum), define_variable(glob_max_terms,30,fixnum), /* Top Generate Globals Definition */ define_variable(glob_max_minutes,0.0,float), define_variable(glob_current_iter,0,fixnum), define_variable(glob_optimal_start,0.0,float), define_variable(glob_max_trunc_err,0.1e-10,float), define_variable(glob_hmax,1.0,float), define_variable(glob_not_yet_finished,true,boolean), define_variable(glob_clock_start_sec,0.0,float), define_variable(glob_smallish_float,0.1e-100,float), define_variable(glob_max_order,30,fixnum), define_variable(glob_abserr,0.1e-10,float), define_variable(glob_large_float,9.0e100,float), define_variable(glob_optimal_done,false,boolean), define_variable(glob_display_flag,true,boolean), define_variable(glob_max_opt_iter,10,fixnum), define_variable(glob_last_good_h,0.1,float), define_variable(glob_h,0.1,float), define_variable(glob_clock_sec,0.0,float), define_variable(glob_dump,false,boolean), define_variable(glob_normmax,0.0,float), define_variable(glob_warned,false,boolean), define_variable(glob_log10_abserr,0.1e-10,float), define_variable(MAX_UNCHANGED,10,fixnum), define_variable(glob_max_sec,10000.0,float), define_variable(glob_max_hours,0.0,float), define_variable(glob_log10_relerr,0.1e-10,float), define_variable(glob_reached_optimal_h,false,boolean), define_variable(years_in_century,100.0,float), define_variable(hours_in_day,24.0,float), define_variable(glob_log10normmin,0.1,float), define_variable(glob_log10relerr,0.0,float), define_variable(glob_log10abserr,0.0,float), define_variable(glob_orig_start_sec,0.0,float), define_variable(glob_dump_analytic,false,boolean), define_variable(glob_not_yet_start_msg,true,boolean), define_variable(glob_almost_1,0.9990,float), define_variable(glob_iter,0,fixnum), define_variable(glob_warned2,false,boolean), define_variable(glob_max_rel_trunc_err,0.1e-10,float), define_variable(glob_max_iter,1000,fixnum), define_variable(glob_hmin_init,0.001,float), define_variable(glob_hmin,0.00000000001,float), define_variable(glob_initial_pass,true,boolean), define_variable(centuries_in_millinium,10.0,float), define_variable(days_in_year,365.0,float), define_variable(djd_debug,true,boolean), define_variable(glob_start,0,fixnum), define_variable(glob_optimal_clock_start_sec,0.0,float), define_variable(min_in_hour,60.0,float), define_variable(glob_unchanged_h_cnt,0,fixnum), define_variable(glob_no_eqs,0,fixnum), define_variable(sec_in_min,60.0,float), define_variable(glob_curr_iter_when_opt,0,fixnum), define_variable(glob_relerr,0.1e-10,float), define_variable(glob_look_poles,false,boolean), define_variable(glob_disp_incr,0.1,float), define_variable(djd_debug2,true,boolean), define_variable(glob_small_float,0.1e-50,float), /* Bottom Generate Globals Deninition */ ALWAYS : 1, INFO : 2, DEBUGL : 3, DEBUGMASSIVE : 4, glob_iolevel : INFO, /* Write Set Defaults */ glob_orig_start_sec : elapsed_time_seconds(), MAX_UNCHANGED : 10, glob_curr_iter_when_opt : 0, glob_display_flag : true, glob_max_order : 1, glob_no_eqs : 2, glob_iter : -1, opt_iter : -1, glob_max_iter : 50000, glob_max_hours : 0.0, glob_max_minutes : 15.0, omniout_str(ALWAYS,"##############ECHO OF PROBLEM#################"), omniout_str(ALWAYS,"##############mtest2max.ode#################"), omniout_str(ALWAYS,"diff ( y2 , x , 1 ) = diff( y1 , x , 0 );"), omniout_str(ALWAYS,"diff ( y1 , x , 1 ) = m1 * diff( y2 , x , 0 ) ;"), omniout_str(ALWAYS,"!"), omniout_str(ALWAYS,"max_terms : 30,"), omniout_str(ALWAYS,"!"), omniout_str(ALWAYS,"x_start : 0.1,"), omniout_str(ALWAYS,"x_end : 10.0,"), omniout_str(ALWAYS,"array_y1_init[1] : exact_soln_y1(x_start),"), omniout_str(ALWAYS,"array_y2_init[1] : exact_soln_y2(x_start),"), omniout_str(ALWAYS,"glob_h : 0.00001 ,"), omniout_str(ALWAYS,"glob_look_poles : true,"), omniout_str(ALWAYS,"glob_max_iter : 10,"), omniout_str(ALWAYS,"!"), omniout_str(ALWAYS,"exact_soln_y1(x) := ("), omniout_str(ALWAYS,"cos(x)"), omniout_str(ALWAYS,");"), omniout_str(ALWAYS,"exact_soln_y2(x) := ("), omniout_str(ALWAYS,"sin(x)"), omniout_str(ALWAYS,");"), omniout_str(ALWAYS,""), omniout_str(ALWAYS,""), omniout_str(ALWAYS,"#######END OF ECHO OF PROBLEM#################"), glob_unchanged_h_cnt : 0, glob_warned : false, glob_warned2 : false, glob_small_float : 1.0e-200, glob_smallish_float : 1.0e-64, glob_large_float : 1.0e100, glob_almost_1 : 0.99, glob_log10_abserr : -8.0, glob_log10_relerr : -8.0, glob_hmax : 0.01, /* BEGIN FIRST INPUT BLOCK */ max_terms : 30, /* END FIRST INPUT BLOCK */ /* START OF INITS AFTER INPUT BLOCK */ glob_max_terms : max_terms, /* END OF INITS AFTER INPUT BLOCK */ array(array_tmp0,max_terms+ 1), array(array_tmp1,max_terms+ 1), array(array_tmp2,max_terms+ 1), array(array_tmp3,max_terms+ 1), array(array_tmp4,max_terms+ 1), array(array_tmp5,max_terms+ 1), array(array_pole,max_terms+ 1), array(array_m1,max_terms+ 1), array(array_y2,max_terms+ 1), array(array_x,max_terms+ 1), array(array_y1,max_terms+ 1), array(array_y1_init,max_terms+ 1), array(array_y2_init,max_terms+ 1), array(array_norms,max_terms+ 1), array(array_complex_pole,2+ 1,3+ 1), array(array_y2_higher,2+ 1,max_terms+ 1), array(array_y2_higher_work2,2+ 1,max_terms+ 1), array(array_real_pole,2+ 1,3+ 1), array(array_y1_higher,2+ 1,max_terms+ 1), array(array_y1_higher_work2,2+ 1,max_terms+ 1), array(array_poles,2+ 1,3+ 1), array(array_y2_higher_work,2+ 1,max_terms+ 1), array(array_y1_higher_work,2+ 1,max_terms+ 1), term : 1, while term <= max_terms do ( array_tmp0[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_tmp1[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_tmp2[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_tmp3[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_tmp4[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_tmp5[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_pole[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_m1[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_y2[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_x[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_y1[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_y1_init[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_y2_init[term] : 0.0, term : term + 1 ) /* OD */, term : 1, while term <= max_terms do ( array_norms[term] : 0.0, term : term + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= 3 do ( array_complex_pole[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= max_terms do ( array_y2_higher[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= max_terms do ( array_y2_higher_work2[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= 3 do ( array_real_pole[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= max_terms do ( array_y1_higher[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= max_terms do ( array_y1_higher_work2[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= 3 do ( array_poles[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= max_terms do ( array_y2_higher_work[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, ord : 1, while ord <=2 do ( term : 1, while term <= max_terms do ( array_y1_higher_work[ord,term] : 0.0, term : term + 1 ) /* OD */, ord : ord + 1 ) /* OD */, /* BEGIN ARRAYS DEFINED AND INITIALIZATED */ array(array_tmp5,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_tmp5[term] : 0.0, term : term + 1 ) /* OD */, array(array_tmp4,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_tmp4[term] : 0.0, term : term + 1 ) /* OD */, array(array_tmp3,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_tmp3[term] : 0.0, term : term + 1 ) /* OD */, array(array_tmp2,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_tmp2[term] : 0.0, term : term + 1 ) /* OD */, array(array_tmp1,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_tmp1[term] : 0.0, term : term + 1 ) /* OD */, array(array_tmp0,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_tmp0[term] : 0.0, term : term + 1 ) /* OD */, array(array_m1,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_m1[term] : 0.0, term : term + 1 ) /* OD */, array(array_y1,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_y1[term] : 0.0, term : term + 1 ) /* OD */, array(array_x,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_x[term] : 0.0, term : term + 1 ) /* OD */, array(array_y2,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_y2[term] : 0.0, term : term + 1 ) /* OD */, array(array_const_0D0,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_const_0D0[term] : 0.0, term : term + 1 ) /* OD */, array_const_0D0[1] : 0.0, array(array_const_0,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_const_0[term] : 0.0, term : term + 1 ) /* OD */, array_const_0[1] : 0, array(array_const_1,max_terms+1 + 1), term : 1, while term <= max_terms + 1 do ( array_const_1[term] : 0.0, term : term + 1 ) /* OD */, array_const_1[1] : 1, array(array_m1,max_terms+1 + 1), term : 1, while term <= max_terms do ( array_m1[term] : 0.0, term : term + 1 ) /* OD */, array_m1[1] : -1.0, /* END ARRAYS DEFINED AND INITIALIZATED */ /* TOP SECOND INPUT BLOCK */ /* BEGIN SECOND INPUT BLOCK */ x_start : 0.1, x_end : 10.0, array_y1_init[1] : exact_soln_y1(x_start), array_y2_init[1] : exact_soln_y2(x_start), glob_h : 0.00001 , glob_look_poles : true, glob_max_iter : 10, /* END SECOND INPUT BLOCK */ /* BEGIN INITS AFTER SECOND INPUT BLOCK */ glob_last_good_h : glob_h, glob_max_terms : max_terms, glob_max_sec : convfloat(60.0) * convfloat(glob_max_minutes) + convfloat(3600.0) * convfloat(glob_max_hours), glob_abserr : 10.0 ^ (glob_log10_abserr), glob_relerr : 10.0 ^ (glob_log10_relerr), chk_data(), /* AFTER INITS AFTER SECOND INPUT BLOCK */ /* BEGIN SOLUTION CODE */ omniout_str(ALWAYS,"START of Soultion"), /* Start Series -- INITIALIZE FOR SOLUTION */ array_x[1] : x_start, array_x[2] : glob_h, order_diff : 1, /* Start Series array_y2 */ term_no : 1, while (term_no <= order_diff) do ( array_y2[term_no] : array_y2_init[term_no] * glob_h ^ (term_no - 1) / factorial_1(term_no - 1), term_no : term_no + 1 ) /* OD */, rows : order_diff, r_order : 1, while (r_order <= rows) do ( term_no : 1, while (term_no <= (rows - r_order + 1)) do ( it : term_no + r_order - 1, array_y2_higher[r_order,term_no] : array_y2_init[it]* (glob_h ^ (term_no - 1)) / ((factorial_1(term_no - 1))), term_no : term_no + 1 ) /* OD */, r_order : r_order + 1 ) /* OD */ , order_diff : 1, /* Start Series array_y1 */ term_no : 1, while (term_no <= order_diff) do ( array_y1[term_no] : array_y1_init[term_no] * glob_h ^ (term_no - 1) / factorial_1(term_no - 1), term_no : term_no + 1 ) /* OD */, rows : order_diff, r_order : 1, while (r_order <= rows) do ( term_no : 1, while (term_no <= (rows - r_order + 1)) do ( it : term_no + r_order - 1, array_y1_higher[r_order,term_no] : array_y1_init[it]* (glob_h ^ (term_no - 1)) / ((factorial_1(term_no - 1))), term_no : term_no + 1 ) /* OD */, r_order : r_order + 1 ) /* OD */ , current_iter : 1, glob_clock_start_sec : elapsed_time_seconds(), start_array_y2(), if (abs(array_y2_higher[1,1]) > glob_small_float) then ( tmp : abs(array_y2_higher[1,1]), log10norm : (log10(tmp)), if (log10norm < glob_log10normmin) then ( glob_log10normmin : log10norm ) /* FI */ ) /* FI */, display_alot(current_iter) , start_array_y1(), if (abs(array_y1_higher[1,1]) > glob_small_float) then ( tmp : abs(array_y1_higher[1,1]), log10norm : (log10(tmp)), if (log10norm < glob_log10normmin) then ( glob_log10normmin : log10norm ) /* FI */ ) /* FI */, display_alot(current_iter) , glob_clock_sec : elapsed_time_seconds(), glob_current_iter : 0, glob_iter : 0, omniout_str(DEBUGL," "), glob_reached_optimal_h : true, glob_optimal_clock_start_sec : elapsed_time_seconds(), while ((glob_current_iter < glob_max_iter) and (array_x[1] <= x_end ) and ((convfloat(glob_clock_sec) - convfloat(glob_orig_start_sec)) < convfloat(glob_max_sec))) do (/* left paren 0001C */ omniout_str(INFO," "), omniout_str(INFO,"TOP MAIN SOLVE Loop"), glob_iter : glob_iter + 1, glob_clock_sec : elapsed_time_seconds(), glob_current_iter : glob_current_iter + 1, sub_iter : 1, while sub_iter <= 2 do ( atomall() , sub_iter : sub_iter + 1 ) /* OD */, if (glob_look_poles) then (/* left paren 0004C */ check_for_pole() ) /* FI */,/* was right paren 0004C */ array_x[1] : array_x[1] + glob_h, array_x[2] : glob_h, order_diff : 1, /* Jump Series array_y2 */ /* START PART 1 SUM AND ADJUST */ /* START SUM AND ADJUST EQ =1 */ /* sum_and_adjust array_y2 */ order_diff : 1, /* BEFORE ADJUST SUBSERIES EQ =1 */ order_diff : 1, ord : 2, calc_term : 1, /* adjust_subseriesarray_y2 */ iii : glob_max_terms, while (iii >= calc_term) do ( array_y2_higher_work[2,iii] : array_y2_higher[2,iii] / (glob_h ^ (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1), iii : iii - 1 ) /* OD */, /* AFTER ADJUST SUBSERIES EQ =1 */ /* BEFORE SUM SUBSERIES EQ =1 */ order_diff : 1, temp_sum : 0.0, ord : 2, calc_term : 1, /* sum_subseriesarray_y2 */ iii : glob_max_terms, while (iii >= calc_term) do ( temp_sum : temp_sum + array_y2_higher_work[ord,iii], iii : iii - 1 ) /* OD */, array_y2_higher_work2[ord,calc_term] : temp_sum * (glob_h ^ (calc_term - 1)) / (convfp(calc_term - 1)!), /* AFTER SUM SUBSERIES EQ =1 */ /* BEFORE ADJUST SUBSERIES EQ =1 */ order_diff : 1, ord : 1, calc_term : 2, /* adjust_subseriesarray_y2 */ iii : glob_max_terms, while (iii >= calc_term) do ( array_y2_higher_work[1,iii] : array_y2_higher[1,iii] / (glob_h ^ (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1), iii : iii - 1 ) /* OD */, /* AFTER ADJUST SUBSERIES EQ =1 */ /* BEFORE SUM SUBSERIES EQ =1 */ order_diff : 1, temp_sum : 0.0, ord : 1, calc_term : 2, /* sum_subseriesarray_y2 */ iii : glob_max_terms, while (iii >= calc_term) do ( temp_sum : temp_sum + array_y2_higher_work[ord,iii], iii : iii - 1 ) /* OD */, array_y2_higher_work2[ord,calc_term] : temp_sum * (glob_h ^ (calc_term - 1)) / (convfp(calc_term - 1)!), /* AFTER SUM SUBSERIES EQ =1 */ /* BEFORE ADJUST SUBSERIES EQ =1 */ order_diff : 1, ord : 1, calc_term : 1, /* adjust_subseriesarray_y2 */ iii : glob_max_terms, while (iii >= calc_term) do ( array_y2_higher_work[1,iii] : array_y2_higher[1,iii] / (glob_h ^ (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1), iii : iii - 1 ) /* OD */, /* AFTER ADJUST SUBSERIES EQ =1 */ /* BEFORE SUM SUBSERIES EQ =1 */ order_diff : 1, temp_sum : 0.0, ord : 1, calc_term : 1, /* sum_subseriesarray_y2 */ iii : glob_max_terms, while (iii >= calc_term) do ( temp_sum : temp_sum + array_y2_higher_work[ord,iii], iii : iii - 1 ) /* OD */, array_y2_higher_work2[ord,calc_term] : temp_sum * (glob_h ^ (calc_term - 1)) / (convfp(calc_term - 1)!), /* AFTER SUM SUBSERIES EQ =1 */ /* END SUM AND ADJUST EQ =1 */ /* END PART 1 */ /* START PART 2 MOVE TERMS to REGULAR Array */ term_no : glob_max_terms, while (term_no >= 1) do ( array_y2[term_no] : array_y2_higher_work2[1,term_no], ord : 1, while ord <= order_diff do ( array_y2_higher[ord,term_no] : array_y2_higher_work2[ord,term_no], ord : ord + 1 ) /* OD */, term_no : term_no - 1 ) /* OD */, /* END PART 2 HEVE MOVED TERMS to REGULAR Array */ order_diff : 1, /* Jump Series array_y1 */ /* START PART 1 SUM AND ADJUST */ /* START SUM AND ADJUST EQ =2 */ /* sum_and_adjust array_y1 */ order_diff : 1, /* BEFORE ADJUST SUBSERIES EQ =2 */ order_diff : 1, ord : 2, calc_term : 1, /* adjust_subseriesarray_y1 */ iii : glob_max_terms, while (iii >= calc_term) do ( array_y1_higher_work[2,iii] : array_y1_higher[2,iii] / (glob_h ^ (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1), iii : iii - 1 ) /* OD */, /* AFTER ADJUST SUBSERIES EQ =2 */ /* BEFORE SUM SUBSERIES EQ =2 */ order_diff : 1, temp_sum : 0.0, ord : 2, calc_term : 1, /* sum_subseriesarray_y1 */ iii : glob_max_terms, while (iii >= calc_term) do ( temp_sum : temp_sum + array_y1_higher_work[ord,iii], iii : iii - 1 ) /* OD */, array_y1_higher_work2[ord,calc_term] : temp_sum * (glob_h ^ (calc_term - 1)) / (convfp(calc_term - 1)!), /* AFTER SUM SUBSERIES EQ =2 */ /* BEFORE ADJUST SUBSERIES EQ =2 */ order_diff : 1, ord : 1, calc_term : 2, /* adjust_subseriesarray_y1 */ iii : glob_max_terms, while (iii >= calc_term) do ( array_y1_higher_work[1,iii] : array_y1_higher[1,iii] / (glob_h ^ (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1), iii : iii - 1 ) /* OD */, /* AFTER ADJUST SUBSERIES EQ =2 */ /* BEFORE SUM SUBSERIES EQ =2 */ order_diff : 1, temp_sum : 0.0, ord : 1, calc_term : 2, /* sum_subseriesarray_y1 */ iii : glob_max_terms, while (iii >= calc_term) do ( temp_sum : temp_sum + array_y1_higher_work[ord,iii], iii : iii - 1 ) /* OD */, array_y1_higher_work2[ord,calc_term] : temp_sum * (glob_h ^ (calc_term - 1)) / (convfp(calc_term - 1)!), /* AFTER SUM SUBSERIES EQ =2 */ /* BEFORE ADJUST SUBSERIES EQ =2 */ order_diff : 1, ord : 1, calc_term : 1, /* adjust_subseriesarray_y1 */ iii : glob_max_terms, while (iii >= calc_term) do ( array_y1_higher_work[1,iii] : array_y1_higher[1,iii] / (glob_h ^ (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1), iii : iii - 1 ) /* OD */, /* AFTER ADJUST SUBSERIES EQ =2 */ /* BEFORE SUM SUBSERIES EQ =2 */ order_diff : 1, temp_sum : 0.0, ord : 1, calc_term : 1, /* sum_subseriesarray_y1 */ iii : glob_max_terms, while (iii >= calc_term) do ( temp_sum : temp_sum + array_y1_higher_work[ord,iii], iii : iii - 1 ) /* OD */, array_y1_higher_work2[ord,calc_term] : temp_sum * (glob_h ^ (calc_term - 1)) / (convfp(calc_term - 1)!), /* AFTER SUM SUBSERIES EQ =2 */ /* END SUM AND ADJUST EQ =2 */ /* END PART 1 */ /* START PART 2 MOVE TERMS to REGULAR Array */ term_no : glob_max_terms, while (term_no >= 1) do ( array_y1[term_no] : array_y1_higher_work2[1,term_no], ord : 1, while ord <= order_diff do ( array_y1_higher[ord,term_no] : array_y1_higher_work2[ord,term_no], ord : ord + 1 ) /* OD */, term_no : term_no - 1 ) /* OD */, /* END PART 2 HEVE MOVED TERMS to REGULAR Array */ display_alot(current_iter) ) /* OD */,/* right paren 0001C */ omniout_str(ALWAYS,"Finished!"), if (glob_iter >= glob_max_iter) then ( omniout_str(ALWAYS,"Maximum Iterations Reached before Solution Completed!") ) /* FI */, if (elapsed_time_seconds() - convfloat(glob_orig_start_sec) >= convfloat(glob_max_sec )) then ( omniout_str(ALWAYS,"Maximum Time Reached before Solution Completed!") ) /* FI */, glob_clock_sec : elapsed_time_seconds(), omniout_int(INFO,"Iterations ",32,glob_iter,4," ") , prog_report(x_start,x_end) /* END OUTFILEMAIN */ ); mainprog();