|\^/| Maple 12 (IBM INTEL LINUX) ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2008 \ MAPLE / All rights reserved. Maple is a trademark of <____ ____> Waterloo Maple Inc. | Type ? for help. #BEGIN OUTFILE1 > > display_alot := proc(iter) > global > ALWAYS, > glob_max_terms, > INFO, > DEBUGL, > DEBUGMASSIVE, > glob_iolevel, #Top Generate Globals Decl > MAX_UNCHANGED, > glob_start, > glob_no_eqs, > glob_max_iter, > glob_log10normmin, > glob_iter, > glob_current_iter, > hours_in_day, > sec_in_min, > glob_log10abserr, > glob_orig_start_sec, > glob_max_trunc_err, > glob_relerr, > glob_large_float, > glob_hmin, > glob_optimal_done, > glob_initial_pass, > glob_clock_sec, > min_in_hour, > glob_small_float, > glob_log10_relerr, > glob_log10_abserr, > glob_dump_analytic, > centuries_in_millinium, > glob_dump, > glob_normmax, > glob_max_order, > glob_curr_iter_when_opt, > glob_max_sec, > glob_warned2, > glob_abserr, > glob_hmax, > glob_reached_optimal_h, > years_in_century, > djd_debug2, > glob_display_flag, > glob_max_hours, > glob_disp_incr, > glob_not_yet_start_msg, > glob_smallish_float, > glob_optimal_clock_start_sec, > glob_max_rel_trunc_err, > glob_look_poles, > glob_hmin_init, > glob_not_yet_finished, > days_in_year, > glob_unchanged_h_cnt, > glob_last_good_h, > glob_almost_1, > glob_max_opt_iter, > glob_optimal_expect_sec, > glob_max_minutes, > glob_log10relerr, > glob_warned, > glob_h, > glob_html_log, > glob_optimal_start, > glob_clock_start_sec, > djd_debug, > glob_percent_done, #Bottom Generate Globals Decl #BEGIN CONST > array_const_0D0, > array_const_1, #END CONST > array_x, > array_last_rel_error, > array_pole, > array_y1_init, > array_y2_init, > array_norms, > array_m1, > array_type_pole, > array_y2, > array_y1, > array_tmp0, > array_tmp1, > array_tmp2, > array_tmp3, > array_1st_rel_error, > array_complex_pole, > array_poles, > array_y1_higher_work2, > array_real_pole, > array_y2_higher_work2, > array_y2_higher_work, > array_y2_higher, > array_y1_higher, > array_y1_higher_work, > glob_last; > > local abserr, analytic_val_y, ind_var, numeric_val, relerr, term_no; #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;; > if glob_iter = 1 then > array_1st_rel_error[1] := relerr; > else > array_last_rel_error[1] := relerr; > 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;; > if glob_iter = 1 then > array_1st_rel_error[2] := relerr; > else > array_last_rel_error[2] := relerr; > 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;; > end; display_alot := proc(iter) local abserr, analytic_val_y, ind_var, numeric_val, relerr, term_no; global ALWAYS, glob_max_terms, INFO, DEBUGL, DEBUGMASSIVE, glob_iolevel, MAX_UNCHANGED, glob_start, glob_no_eqs, glob_max_iter, glob_log10normmin, glob_iter, glob_current_iter, hours_in_day, sec_in_min, glob_log10abserr, glob_orig_start_sec, glob_max_trunc_err, glob_relerr, glob_large_float, glob_hmin, glob_optimal_done, glob_initial_pass, glob_clock_sec, min_in_hour, glob_small_float, glob_log10_relerr, glob_log10_abserr, glob_dump_analytic, centuries_in_millinium, glob_dump, glob_normmax, glob_max_order, glob_curr_iter_when_opt, glob_max_sec, glob_warned2, glob_abserr, glob_hmax, glob_reached_optimal_h, years_in_century, djd_debug2, glob_display_flag, glob_max_hours, glob_disp_incr, glob_not_yet_start_msg, glob_smallish_float, glob_optimal_clock_start_sec, glob_max_rel_trunc_err, glob_look_poles, glob_hmin_init, glob_not_yet_finished, days_in_year, glob_unchanged_h_cnt, glob_last_good_h, glob_almost_1, glob_max_opt_iter, glob_optimal_expect_sec, glob_max_minutes, glob_log10relerr, glob_warned, glob_h, glob_html_log, glob_optimal_start, glob_clock_start_sec, djd_debug, glob_percent_done, array_const_0D0, array_const_1, array_x, array_last_rel_error, array_pole, array_y1_init, array_y2_init, array_norms, array_m1, array_type_pole, array_y2, array_y1, array_tmp0, array_tmp1, array_tmp2, array_tmp3, array_1st_rel_error, array_complex_pole, array_poles, array_y1_higher_work2, array_real_pole, array_y2_higher_work2, array_y2_higher_work, array_y2_higher, array_y1_higher, array_y1_higher_work, glob_last; if 0 <= iter 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. then relerr := abserr*100.0/abs(analytic_val_y) else relerr := -1.0 end if; if glob_iter = 1 then array_1st_rel_error[1] := relerr else array_last_rel_error[1] := relerr end if; 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. then relerr := abserr*100.0/abs(analytic_val_y) else relerr := -1.0 end if; if glob_iter = 1 then array_1st_rel_error[2] := relerr else array_last_rel_error[2] := relerr end if; omniout_float(ALWAYS, "absolute error ", 4, abserr, 20, " "); omniout_float(ALWAYS, "relative error ", 4, relerr, 20, "%"); omniout_float(ALWAYS, "h ", 4, glob_h, 20, " ") end if end proc > adjust_for_pole := proc(h_param) > global > ALWAYS, > glob_max_terms, > INFO, > DEBUGL, > DEBUGMASSIVE, > glob_iolevel, #Top Generate Globals Decl > MAX_UNCHANGED, > glob_start, > glob_no_eqs, > glob_max_iter, > glob_log10normmin, > glob_iter, > glob_current_iter, > hours_in_day, > sec_in_min, > glob_log10abserr, > glob_orig_start_sec, > glob_max_trunc_err, > glob_relerr, > glob_large_float, > glob_hmin, > glob_optimal_done, > glob_initial_pass, > glob_clock_sec, > min_in_hour, > glob_small_float, > glob_log10_relerr, > glob_log10_abserr, > glob_dump_analytic, > centuries_in_millinium, > glob_dump, > glob_normmax, > glob_max_order, > glob_curr_iter_when_opt, > glob_max_sec, > glob_warned2, > glob_abserr, > glob_hmax, > glob_reached_optimal_h, > years_in_century, > djd_debug2, > glob_display_flag, > glob_max_hours, > glob_disp_incr, > glob_not_yet_start_msg, > glob_smallish_float, > glob_optimal_clock_start_sec, > glob_max_rel_trunc_err, > glob_look_poles, > glob_hmin_init, > glob_not_yet_finished, > days_in_year, > glob_unchanged_h_cnt, > glob_last_good_h, > glob_almost_1, > glob_max_opt_iter, > glob_optimal_expect_sec, > glob_max_minutes, > glob_log10relerr, > glob_warned, > glob_h, > glob_html_log, > glob_optimal_start, > glob_clock_start_sec, > djd_debug, > glob_percent_done, #Bottom Generate Globals Decl #BEGIN CONST > array_const_0D0, > array_const_1, #END CONST > array_x, > array_last_rel_error, > array_pole, > array_y1_init, > array_y2_init, > array_norms, > array_m1, > array_type_pole, > array_y2, > array_y1, > array_tmp0, > array_tmp1, > array_tmp2, > array_tmp3, > array_1st_rel_error, > array_complex_pole, > array_poles, > array_y1_higher_work2, > array_real_pole, > array_y2_higher_work2, > array_y2_higher_work, > array_y2_higher, > array_y1_higher, > array_y1_higher_work, > glob_last; > > local hnew, sz2, tmp; #TOP ADJUST FOR POLE > > 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 > end; adjust_for_pole := proc(h_param) local hnew, sz2, tmp; global ALWAYS, glob_max_terms, INFO, DEBUGL, DEBUGMASSIVE, glob_iolevel, MAX_UNCHANGED, glob_start, glob_no_eqs, glob_max_iter, glob_log10normmin, glob_iter, glob_current_iter, hours_in_day, sec_in_min, glob_log10abserr, glob_orig_start_sec, glob_max_trunc_err, glob_relerr, glob_large_float, glob_hmin, glob_optimal_done, glob_initial_pass, glob_clock_sec, min_in_hour, glob_small_float, glob_log10_relerr, glob_log10_abserr, glob_dump_analytic, centuries_in_millinium, glob_dump, glob_normmax, glob_max_order, glob_curr_iter_when_opt, glob_max_sec, glob_warned2, glob_abserr, glob_hmax, glob_reached_optimal_h, years_in_century, djd_debug2, glob_display_flag, glob_max_hours, glob_disp_incr, glob_not_yet_start_msg, glob_smallish_float, glob_optimal_clock_start_sec, glob_max_rel_trunc_err, glob_look_poles, glob_hmin_init, glob_not_yet_finished, days_in_year, glob_unchanged_h_cnt, glob_last_good_h, glob_almost_1, glob_max_opt_iter, glob_optimal_expect_sec, glob_max_minutes, glob_log10relerr, glob_warned, glob_h, glob_html_log, glob_optimal_start, glob_clock_start_sec, djd_debug, glob_percent_done, array_const_0D0, array_const_1, array_x, array_last_rel_error, array_pole, array_y1_init, array_y2_init, array_norms, array_m1, array_type_pole, array_y2, array_y1, array_tmp0, array_tmp1, array_tmp2, array_tmp3, array_1st_rel_error, array_complex_pole, array_poles, array_y1_higher_work2, array_real_pole, array_y2_higher_work2, array_y2_higher_work, array_y2_higher, array_y1_higher, array_y1_higher_work, glob_last; hnew := h_param; glob_normmax := glob_small_float; if glob_small_float < abs(array_y2_higher[1, 1]) then tmp := abs(array_y2_higher[1, 1]); if tmp < glob_normmax then glob_normmax := tmp end if end if; if glob_small_float < abs(array_y1_higher[1, 1]) then tmp := abs(array_y1_higher[1, 1]); if tmp < glob_normmax then glob_normmax := tmp end if end if; if glob_look_poles and glob_small_float < abs(array_pole[1]) 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 end if end if; 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] end if; hnew := sz2 end proc > prog_report := proc(x_start,x_end) > global > ALWAYS, > glob_max_terms, > INFO, > DEBUGL, > DEBUGMASSIVE, > glob_iolevel, #Top Generate Globals Decl > MAX_UNCHANGED, > glob_start, > glob_no_eqs, > glob_max_iter, > glob_log10normmin, > glob_iter, > glob_current_iter, > hours_in_day, > sec_in_min, > glob_log10abserr, > glob_orig_start_sec, > glob_max_trunc_err, > glob_relerr, > glob_large_float, > glob_hmin, > glob_optimal_done, > glob_initial_pass, > glob_clock_sec, > min_in_hour, > glob_small_float, > glob_log10_relerr, > glob_log10_abserr, > glob_dump_analytic, > centuries_in_millinium, > glob_dump, > glob_normmax, > glob_max_order, > glob_curr_iter_when_opt, > glob_max_sec, > glob_warned2, > glob_abserr, > glob_hmax, > glob_reached_optimal_h, > years_in_century, > djd_debug2, > glob_display_flag, > glob_max_hours, > glob_disp_incr, > glob_not_yet_start_msg, > glob_smallish_float, > glob_optimal_clock_start_sec, > glob_max_rel_trunc_err, > glob_look_poles, > glob_hmin_init, > glob_not_yet_finished, > days_in_year, > glob_unchanged_h_cnt, > glob_last_good_h, > glob_almost_1, > glob_max_opt_iter, > glob_optimal_expect_sec, > glob_max_minutes, > glob_log10relerr, > glob_warned, > glob_h, > glob_html_log, > glob_optimal_start, > glob_clock_start_sec, > djd_debug, > glob_percent_done, #Bottom Generate Globals Decl #BEGIN CONST > array_const_0D0, > array_const_1, #END CONST > array_x, > array_last_rel_error, > array_pole, > array_y1_init, > array_y2_init, > array_norms, > array_m1, > array_type_pole, > array_y2, > array_y1, > array_tmp0, > array_tmp1, > array_tmp2, > array_tmp3, > array_1st_rel_error, > array_complex_pole, > array_poles, > array_y1_higher_work2, > array_real_pole, > array_y2_higher_work2, > array_y2_higher_work, > array_y2_higher, > array_y1_higher, > array_y1_higher_work, > glob_last; > > local clock_sec, opt_clock_sec, clock_sec1, expect_sec, left_sec, percent_done, total_clock_sec; #TOP PROGRESS REPORT > clock_sec1 := elapsed_time_seconds(); > total_clock_sec := convfloat(clock_sec1) - convfloat(glob_orig_start_sec); > glob_clock_sec := convfloat(clock_sec1) - convfloat(glob_clock_start_sec); > left_sec := convfloat(glob_max_sec) + convfloat(glob_orig_start_sec) - convfloat(clock_sec1); > 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); > glob_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)); > glob_percent_done := percent_done; > omniout_str_noeol(INFO,"Total Elapsed Time "); > omniout_timestr(convfloat(total_clock_sec)); > omniout_str_noeol(INFO,"Elapsed Time(since restart) "); > omniout_timestr(convfloat(glob_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(glob_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 > end; prog_report := proc(x_start, x_end) local clock_sec, opt_clock_sec, clock_sec1, expect_sec, left_sec, percent_done, total_clock_sec; global ALWAYS, glob_max_terms, INFO, DEBUGL, DEBUGMASSIVE, glob_iolevel, MAX_UNCHANGED, glob_start, glob_no_eqs, glob_max_iter, glob_log10normmin, glob_iter, glob_current_iter, hours_in_day, sec_in_min, glob_log10abserr, glob_orig_start_sec, glob_max_trunc_err, glob_relerr, glob_large_float, glob_hmin, glob_optimal_done, glob_initial_pass, glob_clock_sec, min_in_hour, glob_small_float, glob_log10_relerr, glob_log10_abserr, glob_dump_analytic, centuries_in_millinium, glob_dump, glob_normmax, glob_max_order, glob_curr_iter_when_opt, glob_max_sec, glob_warned2, glob_abserr, glob_hmax, glob_reached_optimal_h, years_in_century, djd_debug2, glob_display_flag, glob_max_hours, glob_disp_incr, glob_not_yet_start_msg, glob_smallish_float, glob_optimal_clock_start_sec, glob_max_rel_trunc_err, glob_look_poles, glob_hmin_init, glob_not_yet_finished, days_in_year, glob_unchanged_h_cnt, glob_last_good_h, glob_almost_1, glob_max_opt_iter, glob_optimal_expect_sec, glob_max_minutes, glob_log10relerr, glob_warned, glob_h, glob_html_log, glob_optimal_start, glob_clock_start_sec, djd_debug, glob_percent_done, array_const_0D0, array_const_1, array_x, array_last_rel_error, array_pole, array_y1_init, array_y2_init, array_norms, array_m1, array_type_pole, array_y2, array_y1, array_tmp0, array_tmp1, array_tmp2, array_tmp3, array_1st_rel_error, array_complex_pole, array_poles, array_y1_higher_work2, array_real_pole, array_y2_higher_work2, array_y2_higher_work, array_y2_higher, array_y1_higher, array_y1_higher_work, glob_last; clock_sec1 := elapsed_time_seconds(); total_clock_sec := convfloat(clock_sec1) - convfloat(glob_orig_start_sec); glob_clock_sec := convfloat(clock_sec1) - convfloat(glob_clock_start_sec); left_sec := convfloat(glob_max_sec) + convfloat(glob_orig_start_sec) - convfloat(clock_sec1); 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); glob_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)); glob_percent_done := percent_done; omniout_str_noeol(INFO, "Total Elapsed Time "); omniout_timestr(convfloat(total_clock_sec)); omniout_str_noeol(INFO, "Elapsed Time(since restart) "); omniout_timestr(convfloat(glob_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(glob_optimal_expect_sec)) end if; omniout_str_noeol(INFO, "Time to Timeout "); omniout_timestr(convfloat(left_sec)); omniout_float(INFO, "Percent Done ", 33, percent_done, 4, "%") end proc > check_for_pole := proc() > global > ALWAYS, > glob_max_terms, > INFO, > DEBUGL, > DEBUGMASSIVE, > glob_iolevel, #Top Generate Globals Decl > MAX_UNCHANGED, > glob_start, > glob_no_eqs, > glob_max_iter, > glob_log10normmin, > glob_iter, > glob_current_iter, > hours_in_day, > sec_in_min, > glob_log10abserr, > glob_orig_start_sec, > glob_max_trunc_err, > glob_relerr, > glob_large_float, > glob_hmin, > glob_optimal_done, > glob_initial_pass, > glob_clock_sec, > min_in_hour, > glob_small_float, > glob_log10_relerr, > glob_log10_abserr, > glob_dump_analytic, > centuries_in_millinium, > glob_dump, > glob_normmax, > glob_max_order, > glob_curr_iter_when_opt, > glob_max_sec, > glob_warned2, > glob_abserr, > glob_hmax, > glob_reached_optimal_h, > years_in_century, > djd_debug2, > glob_display_flag, > glob_max_hours, > glob_disp_incr, > glob_not_yet_start_msg, > glob_smallish_float, > glob_optimal_clock_start_sec, > glob_max_rel_trunc_err, > glob_look_poles, > glob_hmin_init, > glob_not_yet_finished, > days_in_year, > glob_unchanged_h_cnt, > glob_last_good_h, > glob_almost_1, > glob_max_opt_iter, > glob_optimal_expect_sec, > glob_max_minutes, > glob_log10relerr, > glob_warned, > glob_h, > glob_html_log, > glob_optimal_start, > glob_clock_start_sec, > djd_debug, > glob_percent_done, #Bottom Generate Globals Decl #BEGIN CONST > array_const_0D0, > array_const_1, #END CONST > array_x, > array_last_rel_error, > array_pole, > array_y1_init, > array_y2_init, > array_norms, > array_m1, > array_type_pole, > array_y2, > array_y1, > array_tmp0, > array_tmp1, > array_tmp2, > array_tmp3, > array_1st_rel_error, > array_complex_pole, > array_poles, > array_y1_higher_work2, > array_real_pole, > array_y2_higher_work2, > array_y2_higher_work, > array_y2_higher, > array_y1_higher, > array_y1_higher_work, > glob_last; > > local cnt, dr1, dr2, ds1, ds2, hdrc, m, n, nr1, nr2, ord_no, rad_c, rcs, rm0, rm1, rm2, rm3, rm4, found; #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 >= 10) 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 > 10) 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 >= 10) 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 > 10) 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 >= 10)) 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 <= 10) then > array_complex_pole[1,1] := glob_large_float; > array_complex_pole[1,2] := glob_large_float; > elif (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 >= 10)) 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 <= 10) then > array_complex_pole[2,1] := glob_large_float; > array_complex_pole[2,2] := glob_large_float; > elif (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; > array_type_pole[1] := 2; > 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; > array_type_pole[1] := 1; > 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; > array_type_pole[1] := 3; > 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; > array_type_pole[1] := 1; > 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]; > array_type_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; > array_type_pole[1] := 3; > 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; > array_type_pole[2] := 2; > 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; > array_type_pole[2] := 1; > 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; > array_type_pole[2] := 3; > 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; > array_type_pole[2] := 1; > 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]; > array_type_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; > array_type_pole[2] := 3; > 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(); > end; check_for_pole := proc() local cnt, dr1, dr2, ds1, ds2, hdrc, m, n, nr1, nr2, ord_no, rad_c, rcs, rm0, rm1, rm2, rm3, rm4, found; global ALWAYS, glob_max_terms, INFO, DEBUGL, DEBUGMASSIVE, glob_iolevel, MAX_UNCHANGED, glob_start, glob_no_eqs, glob_max_iter, glob_log10normmin, glob_iter, glob_current_iter, hours_in_day, sec_in_min, glob_log10abserr, glob_orig_start_sec, glob_max_trunc_err, glob_relerr, glob_large_float, glob_hmin, glob_optimal_done, glob_initial_pass, glob_clock_sec, min_in_hour, glob_small_float, glob_log10_relerr, glob_log10_abserr, glob_dump_analytic, centuries_in_millinium, glob_dump, glob_normmax, glob_max_order, glob_curr_iter_when_opt, glob_max_sec, glob_warned2, glob_abserr, glob_hmax, glob_reached_optimal_h, years_in_century, djd_debug2, glob_display_flag, glob_max_hours, glob_disp_incr, glob_not_yet_start_msg, glob_smallish_float, glob_optimal_clock_start_sec, glob_max_rel_trunc_err, glob_look_poles, glob_hmin_init, glob_not_yet_finished, days_in_year, glob_unchanged_h_cnt, glob_last_good_h, glob_almost_1, glob_max_opt_iter, glob_optimal_expect_sec, glob_max_minutes, glob_log10relerr, glob_warned, glob_h, glob_html_log, glob_optimal_start, glob_clock_start_sec, djd_debug, glob_percent_done, array_const_0D0, array_const_1, array_x, array_last_rel_error, array_pole, array_y1_init, array_y2_init, array_norms, array_m1, array_type_pole, array_y2, array_y1, array_tmp0, array_tmp1, array_tmp2, array_tmp3, array_1st_rel_error, array_complex_pole, array_poles, array_y1_higher_work2, array_real_pole, array_y2_higher_work2, array_y2_higher_work, array_y2_higher, array_y1_higher, array_y1_higher_work, glob_last; n := glob_max_terms; m := n - 2; while 10 <= m 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 end do; if 10 < m 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 glob_small_float < abs(hdrc) 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 end if else array_real_pole[1, 1] := glob_large_float; array_real_pole[1, 2] := glob_large_float end if; n := glob_max_terms; m := n - 2; while 10 <= m 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 end do; if 10 < m 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 glob_small_float < abs(hdrc) 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 end if else array_real_pole[2, 1] := glob_large_float; array_real_pole[2, 2] := glob_large_float end if; n := glob_max_terms - 2; cnt := 0; while cnt < 5 and 10 <= n do if glob_small_float < abs(array_y2_higher[1, n]) then cnt := cnt + 1 else cnt := 0 end if; n := n - 1 end do; m := n + cnt; if m <= 10 then array_complex_pole[1, 1] := glob_large_float; array_complex_pole[1, 2] := glob_large_float elif glob_large_float <= abs(array_y2_higher[1, m]) or glob_large_float <= abs(array_y2_higher[1, m - 1]) or glob_large_float <= abs(array_y2_higher[1, m - 2]) or glob_large_float <= abs(array_y2_higher[1, m - 3]) or glob_large_float <= abs(array_y2_higher[1, m - 4]) or glob_large_float <= abs(array_y2_higher[1, m - 5]) 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)*(1.0)/rm1 + 2.0/rm2 - 1.0/rm3; dr2 := (-1)*(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 glob_small_float < abs(nr1*dr2 - nr2*dr1) then rcs := (ds1*dr2 - ds2*dr1 + dr1*dr2)/(nr1*dr2 - nr2*dr1); ord_no := (rcs*nr1 - ds1)/(2.0*dr1) - convfloat(m)/2.0; if glob_small_float < abs(rcs) then if 0. < rcs then rad_c := sqrt(rcs)*glob_h else rad_c := glob_large_float end if else rad_c := glob_large_float; ord_no := glob_large_float end if else rad_c := glob_large_float; ord_no := glob_large_float end if end if; array_complex_pole[1, 1] := rad_c; array_complex_pole[1, 2] := ord_no end if; n := glob_max_terms - 2; cnt := 0; while cnt < 5 and 10 <= n do if glob_small_float < abs(array_y1_higher[1, n]) then cnt := cnt + 1 else cnt := 0 end if; n := n - 1 end do; m := n + cnt; if m <= 10 then array_complex_pole[2, 1] := glob_large_float; array_complex_pole[2, 2] := glob_large_float elif glob_large_float <= abs(array_y1_higher[1, m]) or glob_large_float <= abs(array_y1_higher[1, m - 1]) or glob_large_float <= abs(array_y1_higher[1, m - 2]) or glob_large_float <= abs(array_y1_higher[1, m - 3]) or glob_large_float <= abs(array_y1_higher[1, m - 4]) or glob_large_float <= abs(array_y1_higher[1, m - 5]) 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)*(1.0)/rm1 + 2.0/rm2 - 1.0/rm3; dr2 := (-1)*(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 glob_small_float < abs(nr1*dr2 - nr2*dr1) then rcs := (ds1*dr2 - ds2*dr1 + dr1*dr2)/(nr1*dr2 - nr2*dr1); ord_no := (rcs*nr1 - ds1)/(2.0*dr1) - convfloat(m)/2.0; if glob_small_float < abs(rcs) then if 0. < rcs then rad_c := sqrt(rcs)*glob_h else rad_c := glob_large_float end if else rad_c := glob_large_float; ord_no := glob_large_float end if else rad_c := glob_large_float; ord_no := glob_large_float end if end if; array_complex_pole[2, 1] := rad_c; array_complex_pole[2, 2] := ord_no end if; found := false; 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 0. < array_complex_pole[1, 1] and 0. < array_complex_pole[1, 2] then array_poles[1, 1] := array_complex_pole[1, 1]; array_poles[1, 2] := array_complex_pole[1, 2]; found := true; array_type_pole[1] := 2; if glob_display_flag then omniout_str(ALWAYS, "Complex estimate of poles used") end if end if; if not found and array_real_pole[1, 1] <> glob_large_float and array_real_pole[1, 2] <> glob_large_float and 0. < array_real_pole[1, 1] and 0. < array_real_pole[1, 2] 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. or array_complex_pole[1, 2] <= 0.) then array_poles[1, 1] := array_real_pole[1, 1]; array_poles[1, 2] := array_real_pole[1, 2]; found := true; array_type_pole[1] := 1; if glob_display_flag then omniout_str(ALWAYS, "Real estimate of pole used") end if end if; 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; array_type_pole[1] := 3; if glob_display_flag then omniout_str(ALWAYS, "NO POLE") end if end if; if not found and array_real_pole[1, 1] < array_complex_pole[1, 1] and 0. < array_real_pole[1, 1] and 0. < array_real_pole[1, 2] then array_poles[1, 1] := array_real_pole[1, 1]; array_poles[1, 2] := array_real_pole[1, 2]; found := true; array_type_pole[1] := 1; if glob_display_flag then omniout_str(ALWAYS, "Real estimate of pole used") end if end if; if not found and array_complex_pole[1, 1] <> glob_large_float and array_complex_pole[1, 2] <> glob_large_float and 0. < array_complex_pole[1, 1] and 0. < array_complex_pole[1, 2] then array_poles[1, 1] := array_complex_pole[1, 1]; array_poles[1, 2] := array_complex_pole[1, 2]; array_type_pole[1] := 2; found := true; if glob_display_flag then omniout_str(ALWAYS, "Complex estimate of poles used") end if end if; if not found then array_poles[1, 1] := glob_large_float; array_poles[1, 2] := glob_large_float; array_type_pole[1] := 3; if glob_display_flag then omniout_str(ALWAYS, "NO POLE") end if end if; found := false; 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 0. < array_complex_pole[2, 1] and 0. < array_complex_pole[2, 2] then array_poles[2, 1] := array_complex_pole[2, 1]; array_poles[2, 2] := array_complex_pole[2, 2]; found := true; array_type_pole[2] := 2; if glob_display_flag then omniout_str(ALWAYS, "Complex estimate of poles used") end if end if; if not found and array_real_pole[2, 1] <> glob_large_float and array_real_pole[2, 2] <> glob_large_float and 0. < array_real_pole[2, 1] and 0. < array_real_pole[2, 2] 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. or array_complex_pole[2, 2] <= 0.) then array_poles[2, 1] := array_real_pole[2, 1]; array_poles[2, 2] := array_real_pole[2, 2]; found := true; array_type_pole[2] := 1; if glob_display_flag then omniout_str(ALWAYS, "Real estimate of pole used") end if end if; 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; array_type_pole[2] := 3; if glob_display_flag then omniout_str(ALWAYS, "NO POLE") end if end if; if not found and array_real_pole[2, 1] < array_complex_pole[2, 1] and 0. < array_real_pole[2, 1] and 0. < array_real_pole[2, 2] then array_poles[2, 1] := array_real_pole[2, 1]; array_poles[2, 2] := array_real_pole[2, 2]; found := true; array_type_pole[2] := 1; if glob_display_flag then omniout_str(ALWAYS, "Real estimate of pole used") end if end if; if not found and array_complex_pole[2, 1] <> glob_large_float and array_complex_pole[2, 2] <> glob_large_float and 0. < array_complex_pole[2, 1] and 0. < array_complex_pole[2, 2] then array_poles[2, 1] := array_complex_pole[2, 1]; array_poles[2, 2] := array_complex_pole[2, 2]; array_type_pole[2] := 2; found := true; if glob_display_flag then omniout_str(ALWAYS, "Complex estimate of poles used") end if end if; if not found then array_poles[2, 1] := glob_large_float; array_poles[2, 2] := glob_large_float; array_type_pole[2] := 3; if glob_display_flag then omniout_str(ALWAYS, "NO POLE") end if end if; array_pole[1] := glob_large_float; array_pole[2] := glob_large_float; if array_poles[1, 1] < array_pole[1] then array_pole[1] := array_poles[1, 1]; array_pole[2] := array_poles[1, 2] end if; if array_poles[2, 1] < array_pole[1] then array_pole[1] := array_poles[2, 1]; array_pole[2] := array_poles[2, 2] end if; display_pole() end proc > get_norms := proc() > global > ALWAYS, > glob_max_terms, > INFO, > DEBUGL, > DEBUGMASSIVE, > glob_iolevel, #Top Generate Globals Decl > MAX_UNCHANGED, > glob_start, > glob_no_eqs, > glob_max_iter, > glob_log10normmin, > glob_iter, > glob_current_iter, > hours_in_day, > sec_in_min, > glob_log10abserr, > glob_orig_start_sec, > glob_max_trunc_err, > glob_relerr, > glob_large_float, > glob_hmin, > glob_optimal_done, > glob_initial_pass, > glob_clock_sec, > min_in_hour, > glob_small_float, > glob_log10_relerr, > glob_log10_abserr, > glob_dump_analytic, > centuries_in_millinium, > glob_dump, > glob_normmax, > glob_max_order, > glob_curr_iter_when_opt, > glob_max_sec, > glob_warned2, > glob_abserr, > glob_hmax, > glob_reached_optimal_h, > years_in_century, > djd_debug2, > glob_display_flag, > glob_max_hours, > glob_disp_incr, > glob_not_yet_start_msg, > glob_smallish_float, > glob_optimal_clock_start_sec, > glob_max_rel_trunc_err, > glob_look_poles, > glob_hmin_init, > glob_not_yet_finished, > days_in_year, > glob_unchanged_h_cnt, > glob_last_good_h, > glob_almost_1, > glob_max_opt_iter, > glob_optimal_expect_sec, > glob_max_minutes, > glob_log10relerr, > glob_warned, > glob_h, > glob_html_log, > glob_optimal_start, > glob_clock_start_sec, > djd_debug, > glob_percent_done, #Bottom Generate Globals Decl #BEGIN CONST > array_const_0D0, > array_const_1, #END CONST > array_x, > array_last_rel_error, > array_pole, > array_y1_init, > array_y2_init, > array_norms, > array_m1, > array_type_pole, > array_y2, > array_y1, > array_tmp0, > array_tmp1, > array_tmp2, > array_tmp3, > array_1st_rel_error, > array_complex_pole, > array_poles, > array_y1_higher_work2, > array_real_pole, > array_y2_higher_work2, > array_y2_higher_work, > array_y2_higher, > array_y1_higher, > array_y1_higher_work, > glob_last; > > local iii; > 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;; > end; get_norms := proc() local iii; global ALWAYS, glob_max_terms, INFO, DEBUGL, DEBUGMASSIVE, glob_iolevel, MAX_UNCHANGED, glob_start, glob_no_eqs, glob_max_iter, glob_log10normmin, glob_iter, glob_current_iter, hours_in_day, sec_in_min, glob_log10abserr, glob_orig_start_sec, glob_max_trunc_err, glob_relerr, glob_large_float, glob_hmin, glob_optimal_done, glob_initial_pass, glob_clock_sec, min_in_hour, glob_small_float, glob_log10_relerr, glob_log10_abserr, glob_dump_analytic, centuries_in_millinium, glob_dump, glob_normmax, glob_max_order, glob_curr_iter_when_opt, glob_max_sec, glob_warned2, glob_abserr, glob_hmax, glob_reached_optimal_h, years_in_century, djd_debug2, glob_display_flag, glob_max_hours, glob_disp_incr, glob_not_yet_start_msg, glob_smallish_float, glob_optimal_clock_start_sec, glob_max_rel_trunc_err, glob_look_poles, glob_hmin_init, glob_not_yet_finished, days_in_year, glob_unchanged_h_cnt, glob_last_good_h, glob_almost_1, glob_max_opt_iter, glob_optimal_expect_sec, glob_max_minutes, glob_log10relerr, glob_warned, glob_h, glob_html_log, glob_optimal_start, glob_clock_start_sec, djd_debug, glob_percent_done, array_const_0D0, array_const_1, array_x, array_last_rel_error, array_pole, array_y1_init, array_y2_init, array_norms, array_m1, array_type_pole, array_y2, array_y1, array_tmp0, array_tmp1, array_tmp2, array_tmp3, array_1st_rel_error, array_complex_pole, array_poles, array_y1_higher_work2, array_real_pole, array_y2_higher_work2, array_y2_higher_work, array_y2_higher, array_y1_higher, array_y1_higher_work, glob_last; if not glob_initial_pass then set_z(array_norms, glob_max_terms + 1); iii := 1; while iii <= glob_max_terms do if array_norms[iii] < abs(array_y2[iii]) then array_norms[iii] := abs(array_y2[iii]) end if; iii := iii + 1 end do; iii := 1; while iii <= glob_max_terms do if array_norms[iii] < abs(array_y1[iii]) then array_norms[iii] := abs(array_y1[iii]) end if; iii := iii + 1 end do end if end proc > atomall := proc() > global > ALWAYS, > glob_max_terms, > INFO, > DEBUGL, > DEBUGMASSIVE, > glob_iolevel, #Top Generate Globals Decl > MAX_UNCHANGED, > glob_start, > glob_no_eqs, > glob_max_iter, > glob_log10normmin, > glob_iter, > glob_current_iter, > hours_in_day, > sec_in_min, > glob_log10abserr, > glob_orig_start_sec, > glob_max_trunc_err, > glob_relerr, > glob_large_float, > glob_hmin, > glob_optimal_done, > glob_initial_pass, > glob_clock_sec, > min_in_hour, > glob_small_float, > glob_log10_relerr, > glob_log10_abserr, > glob_dump_analytic, > centuries_in_millinium, > glob_dump, > glob_normmax, > glob_max_order, > glob_curr_iter_when_opt, > glob_max_sec, > glob_warned2, > glob_abserr, > glob_hmax, > glob_reached_optimal_h, > years_in_century, > djd_debug2, > glob_display_flag, > glob_max_hours, > glob_disp_incr, > glob_not_yet_start_msg, > glob_smallish_float, > glob_optimal_clock_start_sec, > glob_max_rel_trunc_err, > glob_look_poles, > glob_hmin_init, > glob_not_yet_finished, > days_in_year, > glob_unchanged_h_cnt, > glob_last_good_h, > glob_almost_1, > glob_max_opt_iter, > glob_optimal_expect_sec, > glob_max_minutes, > glob_log10relerr, > glob_warned, > glob_h, > glob_html_log, > glob_optimal_start, > glob_clock_start_sec, > djd_debug, > glob_percent_done, #Bottom Generate Globals Decl #BEGIN CONST > array_const_0D0, > array_const_1, #END CONST > array_x, > array_last_rel_error, > array_pole, > array_y1_init, > array_y2_init, > array_norms, > array_m1, > array_type_pole, > array_y2, > array_y1, > array_tmp0, > array_tmp1, > array_tmp2, > array_tmp3, > array_1st_rel_error, > array_complex_pole, > array_poles, > array_y1_higher_work2, > array_real_pole, > array_y2_higher_work2, > array_y2_higher_work, > array_y2_higher, > array_y1_higher, > array_y1_higher_work, > glob_last; > > local kkk, order_d, adj2, temporary, term; #TOP ATOMALL #END OUTFILE1 #BEGIN ATOMHDR1 #emit pre add $eq_no = 1 i = 1 > array_tmp1[1] := array_const_0D0[1] + array_y1[1]; #emit pre assign xxx $eq_no = 1 i = 1 $min_hdrs = 5 > if (1 <= glob_max_terms) then > temporary := array_tmp1[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 mult $eq_no = 2 i = 1 > array_tmp3[1] := (array_m1[1] * (array_y2[1])); #emit pre assign xxx $eq_no = 2 i = 1 $min_hdrs = 5 > if (1 <= glob_max_terms) then > temporary := array_tmp3[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 add $eq_no = 1 i = 2 > array_tmp1[2] := array_const_0D0[2] + array_y1[2]; #emit pre assign xxx $eq_no = 1 i = 2 $min_hdrs = 5 > if (2 <= glob_max_terms) then > temporary := array_tmp1[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 mult $eq_no = 2 i = 2 > array_tmp3[2] := ats(2,array_m1,array_y2,1); #emit pre assign xxx $eq_no = 2 i = 2 $min_hdrs = 5 > if (2 <= glob_max_terms) then > temporary := array_tmp3[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 add $eq_no = 1 i = 3 > array_tmp1[3] := array_const_0D0[3] + array_y1[3]; #emit pre assign xxx $eq_no = 1 i = 3 $min_hdrs = 5 > if (3 <= glob_max_terms) then > temporary := array_tmp1[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 mult $eq_no = 2 i = 3 > array_tmp3[3] := ats(3,array_m1,array_y2,1); #emit pre assign xxx $eq_no = 2 i = 3 $min_hdrs = 5 > if (3 <= glob_max_terms) then > temporary := array_tmp3[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 add $eq_no = 1 i = 4 > array_tmp1[4] := array_const_0D0[4] + array_y1[4]; #emit pre assign xxx $eq_no = 1 i = 4 $min_hdrs = 5 > if (4 <= glob_max_terms) then > temporary := array_tmp1[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 mult $eq_no = 2 i = 4 > array_tmp3[4] := ats(4,array_m1,array_y2,1); #emit pre assign xxx $eq_no = 2 i = 4 $min_hdrs = 5 > if (4 <= glob_max_terms) then > temporary := array_tmp3[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 add $eq_no = 1 i = 5 > array_tmp1[5] := array_const_0D0[5] + array_y1[5]; #emit pre assign xxx $eq_no = 1 i = 5 $min_hdrs = 5 > if (5 <= glob_max_terms) then > temporary := array_tmp1[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 mult $eq_no = 2 i = 5 > array_tmp3[5] := ats(5,array_m1,array_y2,1); #emit pre assign xxx $eq_no = 2 i = 5 $min_hdrs = 5 > if (5 <= glob_max_terms) then > temporary := array_tmp3[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 add $eq_no = 1 > array_tmp1[kkk] := array_const_0D0[kkk] + array_y1[kkk]; #emit assign $eq_no = 1 > order_d := 1; > if (kkk + order_d + 1 <= glob_max_terms) then > temporary := array_tmp1[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 mult $eq_no = 2 > array_tmp3[kkk] := ats(kkk,array_m1,array_y2,1); #emit assign $eq_no = 2 > order_d := 1; > if (kkk + order_d + 1 <= glob_max_terms) then > temporary := array_tmp3[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 > end; atomall := proc() local kkk, order_d, adj2, temporary, term; global ALWAYS, glob_max_terms, INFO, DEBUGL, DEBUGMASSIVE, glob_iolevel, MAX_UNCHANGED, glob_start, glob_no_eqs, glob_max_iter, glob_log10normmin, glob_iter, glob_current_iter, hours_in_day, sec_in_min, glob_log10abserr, glob_orig_start_sec, glob_max_trunc_err, glob_relerr, glob_large_float, glob_hmin, glob_optimal_done, glob_initial_pass, glob_clock_sec, min_in_hour, glob_small_float, glob_log10_relerr, glob_log10_abserr, glob_dump_analytic, centuries_in_millinium, glob_dump, glob_normmax, glob_max_order, glob_curr_iter_when_opt, glob_max_sec, glob_warned2, glob_abserr, glob_hmax, glob_reached_optimal_h, years_in_century, djd_debug2, glob_display_flag, glob_max_hours, glob_disp_incr, glob_not_yet_start_msg, glob_smallish_float, glob_optimal_clock_start_sec, glob_max_rel_trunc_err, glob_look_poles, glob_hmin_init, glob_not_yet_finished, days_in_year, glob_unchanged_h_cnt, glob_last_good_h, glob_almost_1, glob_max_opt_iter, glob_optimal_expect_sec, glob_max_minutes, glob_log10relerr, glob_warned, glob_h, glob_html_log, glob_optimal_start, glob_clock_start_sec, djd_debug, glob_percent_done, array_const_0D0, array_const_1, array_x, array_last_rel_error, array_pole, array_y1_init, array_y2_init, array_norms, array_m1, array_type_pole, array_y2, array_y1, array_tmp0, array_tmp1, array_tmp2, array_tmp3, array_1st_rel_error, array_complex_pole, array_poles, array_y1_higher_work2, array_real_pole, array_y2_higher_work2, array_y2_higher_work, array_y2_higher, array_y1_higher, array_y1_higher_work, glob_last; array_tmp1[1] := array_const_0D0[1] + array_y1[1]; if 1 <= glob_max_terms then temporary := array_tmp1[1]*glob_h*factorial_3(0, 1); array_y2[2] := temporary; array_y2_higher[1, 2] := temporary; temporary := temporary*2.0/glob_h; array_y2_higher[2, 1] := temporary end if; kkk := 2; array_tmp3[1] := array_m1[1]*array_y2[1]; if 1 <= glob_max_terms then temporary := array_tmp3[1]*glob_h*factorial_3(0, 1); array_y1[2] := temporary; array_y1_higher[1, 2] := temporary; temporary := temporary*2.0/glob_h; array_y1_higher[2, 1] := temporary end if; kkk := 2; array_tmp1[2] := array_const_0D0[2] + array_y1[2]; if 2 <= glob_max_terms then temporary := array_tmp1[2]*glob_h*factorial_3(1, 2); array_y2[3] := temporary; array_y2_higher[1, 3] := temporary; temporary := temporary*2.0/glob_h; array_y2_higher[2, 2] := temporary end if; kkk := 3; array_tmp3[2] := ats(2, array_m1, array_y2, 1); if 2 <= glob_max_terms then temporary := array_tmp3[2]*glob_h*factorial_3(1, 2); array_y1[3] := temporary; array_y1_higher[1, 3] := temporary; temporary := temporary*2.0/glob_h; array_y1_higher[2, 2] := temporary end if; kkk := 3; array_tmp1[3] := array_const_0D0[3] + array_y1[3]; if 3 <= glob_max_terms then temporary := array_tmp1[3]*glob_h*factorial_3(2, 3); array_y2[4] := temporary; array_y2_higher[1, 4] := temporary; temporary := temporary*2.0/glob_h; array_y2_higher[2, 3] := temporary end if; kkk := 4; array_tmp3[3] := ats(3, array_m1, array_y2, 1); if 3 <= glob_max_terms then temporary := array_tmp3[3]*glob_h*factorial_3(2, 3); array_y1[4] := temporary; array_y1_higher[1, 4] := temporary; temporary := temporary*2.0/glob_h; array_y1_higher[2, 3] := temporary end if; kkk := 4; array_tmp1[4] := array_const_0D0[4] + array_y1[4]; if 4 <= glob_max_terms then temporary := array_tmp1[4]*glob_h*factorial_3(3, 4); array_y2[5] := temporary; array_y2_higher[1, 5] := temporary; temporary := temporary*2.0/glob_h; array_y2_higher[2, 4] := temporary end if; kkk := 5; array_tmp3[4] := ats(4, array_m1, array_y2, 1); if 4 <= glob_max_terms then temporary := array_tmp3[4]*glob_h*factorial_3(3, 4); array_y1[5] := temporary; array_y1_higher[1, 5] := temporary; temporary := temporary*2.0/glob_h; array_y1_higher[2, 4] := temporary end if; kkk := 5; array_tmp1[5] := array_const_0D0[5] + array_y1[5]; if 5 <= glob_max_terms then temporary := array_tmp1[5]*glob_h*factorial_3(4, 5); array_y2[6] := temporary; array_y2_higher[1, 6] := temporary; temporary := temporary*2.0/glob_h; array_y2_higher[2, 5] := temporary end if; kkk := 6; array_tmp3[5] := ats(5, array_m1, array_y2, 1); if 5 <= glob_max_terms then temporary := array_tmp3[5]*glob_h*factorial_3(4, 5); array_y1[6] := temporary; array_y1_higher[1, 6] := temporary; temporary := temporary*2.0/glob_h; array_y1_higher[2, 5] := temporary end if; kkk := 6; while kkk <= glob_max_terms do array_tmp1[kkk] := array_const_0D0[kkk] + array_y1[kkk]; order_d := 1; if kkk + order_d + 1 <= glob_max_terms then temporary := array_tmp1[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 1 <= term do temporary := temporary*convfp(adj2)/glob_h; array_y2_higher[adj2, term] := temporary; adj2 := adj2 + 1; term := term - 1 end do end if; array_tmp3[kkk] := ats(kkk, array_m1, array_y2, 1); order_d := 1; if kkk + order_d + 1 <= glob_max_terms then temporary := array_tmp3[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 1 <= term do temporary := temporary*convfp(adj2)/glob_h; array_y1_higher[adj2, term] := temporary; adj2 := adj2 + 1; term := term - 1 end do end if; kkk := kkk + 1 end do end proc #BEGIN ATS LIBRARY BLOCK > omniout_str := proc(iolevel,str) > global glob_iolevel; > if (glob_iolevel >= iolevel) then > printf("%s\n",str); > fi; > end; omniout_str := proc(iolevel, str) global glob_iolevel; if iolevel <= glob_iolevel then printf("%s\n", str) end if end proc > omniout_str_noeol := proc(iolevel,str) > global glob_iolevel; > if (glob_iolevel >= iolevel) then > printf("%s",str); > fi; > end; omniout_str_noeol := proc(iolevel, str) global glob_iolevel; if iolevel <= glob_iolevel then printf("%s", str) end if end proc > omniout_labstr := proc(iolevel,label,str) > global glob_iolevel; > if (glob_iolevel >= iolevel) then > print(label,str); > fi; > end; omniout_labstr := proc(iolevel, label, str) global glob_iolevel; if iolevel <= glob_iolevel then print(label, str) end if end proc > omniout_float := proc(iolevel,prelabel,prelen,value,vallen,postlabel) > global glob_iolevel; > if (glob_iolevel >= iolevel) then > if vallen = 4 then > printf("%-30s = %-42.4g %s \n",prelabel,value, postlabel); > else > printf("%-30s = %-42.32g %s \n",prelabel,value, postlabel); > fi; > fi; > end; omniout_float := proc(iolevel, prelabel, prelen, value, vallen, postlabel) global glob_iolevel; if iolevel <= glob_iolevel then if vallen = 4 then printf("%-30s = %-42.4g %s \n", prelabel, value, postlabel) else printf("%-30s = %-42.32g %s \n", prelabel, value, postlabel) end if end if end proc > omniout_int := proc(iolevel,prelabel,prelen,value,vallen,postlabel) > global glob_iolevel; > if (glob_iolevel >= iolevel) then > if vallen = 5 then > printf("%-30s = %-32d %s\n",prelabel,value, postlabel); > else > printf("%-30s = %-32d %s \n",prelabel,value, postlabel); > fi; > fi; > end; omniout_int := proc(iolevel, prelabel, prelen, value, vallen, postlabel) global glob_iolevel; if iolevel <= glob_iolevel then if vallen = 5 then printf("%-30s = %-32d %s\n", prelabel, value, postlabel) else printf("%-30s = %-32d %s \n", prelabel, value, postlabel) end if end if end proc > omniout_float_arr := proc(iolevel,prelabel,elemnt,prelen,value,vallen,postlabel) > global glob_iolevel; > if (glob_iolevel >= iolevel) then > print(prelabel,"[",elemnt,"]",value, postlabel); > fi; > end; omniout_float_arr := proc( iolevel, prelabel, elemnt, prelen, value, vallen, postlabel) global glob_iolevel; if iolevel <= glob_iolevel then print(prelabel, "[", elemnt, "]", value, postlabel) end if end proc > dump_series := proc(iolevel,dump_label,series_name, > array_series,numb) > global glob_iolevel; > local i; > if (glob_iolevel >= iolevel) then > i := 1; > while (i <= numb) do > print(dump_label,series_name > ,i,array_series[i]); > i := i + 1; > od; > fi; > end; dump_series := proc(iolevel, dump_label, series_name, array_series, numb) local i; global glob_iolevel; if iolevel <= glob_iolevel then i := 1; while i <= numb do print(dump_label, series_name, i, array_series[i]); i := i + 1 end do end if end proc > dump_series_2 := proc(iolevel,dump_label,series_name2, > array_series2,numb,subnum,array_x) > global glob_iolevel; > local i,sub,ts_term; > if (glob_iolevel >= iolevel) then > sub := 1; > while (sub <= subnum) do > i := 1; > while (i <= numb) do > print(dump_label,series_name2,sub,i,array_series2[sub,i]); > od; > sub := sub + 1; > od; > fi; > end; dump_series_2 := proc( iolevel, dump_label, series_name2, array_series2, numb, subnum, array_x) local i, sub, ts_term; global glob_iolevel; if iolevel <= glob_iolevel then sub := 1; while sub <= subnum do i := 1; while i <= numb do print(dump_label, series_name2, sub, i, array_series2[sub, i]) end do; sub := sub + 1 end do end if end proc > cs_info := proc(iolevel,str) > global glob_iolevel,glob_correct_start_flag,glob_h,glob_reached_optimal_h; > if (glob_iolevel >= iolevel) then > print("cs_info " , str , " glob_correct_start_flag = " , glob_correct_start_flag , "glob_h := " , glob_h , "glob_reached_optimal_h := " , glob_reached_optimal_h) > fi; > end; cs_info := proc(iolevel, str) global glob_iolevel, glob_correct_start_flag, glob_h, glob_reached_optimal_h; if iolevel <= glob_iolevel then print("cs_info ", str, " glob_correct_start_flag = ", glob_correct_start_flag, "glob_h := ", glob_h, "glob_reached_optimal_h := ", glob_reached_optimal_h) end if end proc > logitem_time := proc(fd,secs_in) > global centuries_in_millinium, days_in_year, hours_in_day, min_in_hour, sec_in_min, years_in_century; > local cent_int, centuries, days, days_int, hours, hours_int, millinium_int, milliniums, minutes, minutes_int, sec_in_millinium, sec_int, seconds, secs, years, years_int; > secs := (secs_in); > if (secs > 0.0) then > sec_in_millinium := convfloat(sec_in_min * min_in_hour * hours_in_day * days_in_year * years_in_century * centuries_in_millinium); > milliniums := convfloat(secs / sec_in_millinium); > millinium_int := floor(milliniums); > centuries := (milliniums - millinium_int)*centuries_in_millinium; > cent_int := floor(centuries); > years := (centuries - cent_int) * years_in_century; > years_int := floor(years); > days := (years - years_int) * days_in_year; > days_int := floor(days); > hours := (days - days_int) * hours_in_day; > hours_int := floor(hours); > minutes := (hours - hours_int) * min_in_hour; > minutes_int := floor(minutes); > seconds := (minutes - minutes_int) * sec_in_min; > sec_int := floor(seconds); > fprintf(fd,""); > if (millinium_int > 0) then > fprintf(fd,"%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); > elif (cent_int > 0) then > fprintf(fd,"%d Centuries %d Years %d Days %d Hours %d Minutes %d Seconds",cent_int,years_int,days_int,hours_int,minutes_int,sec_int); > elif (years_int > 0) then > fprintf(fd,"%d Years %d Days %d Hours %d Minutes %d Seconds",years_int,days_int,hours_int,minutes_int,sec_int); > elif (days_int > 0) then > fprintf(fd,"%d Days %d Hours %d Minutes %d Seconds",days_int,hours_int,minutes_int,sec_int); > elif (hours_int > 0) then > fprintf(fd,"%d Hours %d Minutes %d Seconds",hours_int,minutes_int,sec_int); > elif (minutes_int > 0) then > fprintf(fd,"%d Minutes %d Seconds",minutes_int,sec_int); > else > fprintf(fd,"%d Seconds",sec_int); > fi; > else > fprintf(fd,"Unknown"); > fi; > fprintf(fd,""); > end; logitem_time := proc(fd, secs_in) local cent_int, centuries, days, days_int, hours, hours_int, millinium_int, milliniums, minutes, minutes_int, sec_in_millinium, sec_int, seconds, secs, years, years_int; global centuries_in_millinium, days_in_year, hours_in_day, min_in_hour, sec_in_min, years_in_century; secs := secs_in; if 0. < secs then sec_in_millinium := convfloat(sec_in_min*min_in_hour*hours_in_day* days_in_year*years_in_century*centuries_in_millinium); milliniums := convfloat(secs/sec_in_millinium); millinium_int := floor(milliniums); centuries := (milliniums - millinium_int)*centuries_in_millinium; cent_int := floor(centuries); years := (centuries - cent_int)*years_in_century; years_int := floor(years); days := (years - years_int)*days_in_year; days_int := floor(days); hours := (days - days_int)*hours_in_day; hours_int := floor(hours); minutes := (hours - hours_int)*min_in_hour; minutes_int := floor(minutes); seconds := (minutes - minutes_int)*sec_in_min; sec_int := floor(seconds); fprintf(fd, ""); if 0 < millinium_int then fprintf(fd, "%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) elif 0 < cent_int then fprintf(fd, "%d Centuries %d Years %d Days %d Hours %d Minutes %d Seconds", cent_int, years_int, days_int, hours_int, minutes_int, sec_int) elif 0 < years_int then fprintf(fd, "%d Years %d Days %d Hours %d Minutes %d Seconds", years_int, days_int, hours_int, minutes_int, sec_int) elif 0 < days_int then fprintf(fd, "%d Days %d Hours %d Minutes %d Seconds", days_int, hours_int, minutes_int, sec_int) elif 0 < hours_int then fprintf(fd, "%d Hours %d Minutes %d Seconds", hours_int, minutes_int, sec_int) elif 0 < minutes_int then fprintf(fd, "%d Minutes %d Seconds", minutes_int, sec_int) else fprintf(fd, "%d Seconds", sec_int) end if else fprintf(fd, "Unknown") end if; fprintf(fd, "") end proc > omniout_timestr := proc (secs_in) > global centuries_in_millinium, days_in_year, hours_in_day, min_in_hour, sec_in_min, years_in_century; > local cent_int, centuries, days, days_int, hours, hours_int, millinium_int, milliniums, minutes, minutes_int, sec_in_millinium, sec_int, seconds, secs, years, years_int; > secs := convfloat(secs_in); > if (secs > 0.0) then > sec_in_millinium := convfloat(sec_in_min * min_in_hour * hours_in_day * days_in_year * years_in_century * centuries_in_millinium); > milliniums := convfloat(secs / sec_in_millinium); > millinium_int := floor(milliniums); > centuries := (milliniums - millinium_int)*centuries_in_millinium; > cent_int := floor(centuries); > years := (centuries - cent_int) * years_in_century; > years_int := floor(years); > days := (years - years_int) * days_in_year; > days_int := floor(days); > hours := (days - days_int) * hours_in_day; > hours_int := floor(hours); > minutes := (hours - hours_int) * min_in_hour; > minutes_int := floor(minutes); > seconds := (minutes - minutes_int) * sec_in_min; > sec_int := floor(seconds); > > if (millinium_int > 0) then > printf(" = %d Millinia %d Centuries %d Years %d Days %d Hours %d Minutes %d Seconds\n",millinium_int,cent_int,years_int,days_int,hours_int,minutes_int,sec_int); > elif (cent_int > 0) then > printf(" = %d Centuries %d Years %d Days %d Hours %d Minutes %d Seconds\n",cent_int,years_int,days_int,hours_int,minutes_int,sec_int); > elif (years_int > 0) then > printf(" = %d Years %d Days %d Hours %d Minutes %d Seconds\n",years_int,days_int,hours_int,minutes_int,sec_int); > elif (days_int > 0) then > printf(" = %d Days %d Hours %d Minutes %d Seconds\n",days_int,hours_int,minutes_int,sec_int); > elif (hours_int > 0) then > printf(" = %d Hours %d Minutes %d Seconds\n",hours_int,minutes_int,sec_int); > elif (minutes_int > 0) then > printf(" = %d Minutes %d Seconds\n",minutes_int,sec_int); > else > printf(" = %d Seconds\n",sec_int); > fi; > else > printf(" Unknown\n"); > fi; > end; omniout_timestr := proc(secs_in) local cent_int, centuries, days, days_int, hours, hours_int, millinium_int, milliniums, minutes, minutes_int, sec_in_millinium, sec_int, seconds, secs, years, years_int; global centuries_in_millinium, days_in_year, hours_in_day, min_in_hour, sec_in_min, years_in_century; secs := convfloat(secs_in); if 0. < secs then sec_in_millinium := convfloat(sec_in_min*min_in_hour*hours_in_day* days_in_year*years_in_century*centuries_in_millinium); milliniums := convfloat(secs/sec_in_millinium); millinium_int := floor(milliniums); centuries := (milliniums - millinium_int)*centuries_in_millinium; cent_int := floor(centuries); years := (centuries - cent_int)*years_in_century; years_int := floor(years); days := (years - years_int)*days_in_year; days_int := floor(days); hours := (days - days_int)*hours_in_day; hours_int := floor(hours); minutes := (hours - hours_int)*min_in_hour; minutes_int := floor(minutes); seconds := (minutes - minutes_int)*sec_in_min; sec_int := floor(seconds); if 0 < millinium_int then printf(" = %d Millinia %d Centuries %d\ Years %d Days %d Hours %d Minutes %d Seconds\n", millinium_int, cent_int, years_int, days_int, hours_int, minutes_int, sec_int) elif 0 < cent_int then printf(" = %d Centuries %d Years %d Days \ %d Hours %d Minutes %d Seconds\n", cent_int, years_int, days_int, hours_int, minutes_int, sec_int) elif 0 < years_int then printf( " = %d Years %d Days %d Hours %d Minutes %d Seconds\n", years_int, days_int, hours_int, minutes_int, sec_int) elif 0 < days_int then printf( " = %d Days %d Hours %d Minutes %d Seconds\n", days_int, hours_int, minutes_int, sec_int) elif 0 < hours_int then printf( " = %d Hours %d Minutes %d Seconds\n", hours_int, minutes_int, sec_int) elif 0 < minutes_int then printf(" = %d Minutes %d Seconds\n", minutes_int, sec_int) else printf(" = %d Seconds\n", sec_int) end if else printf(" Unknown\n") end if end proc > > ats := proc( > mmm_ats,array_a,array_b,jjj_ats) > local iii_ats, lll_ats,ma_ats, ret_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 > end; ats := proc(mmm_ats, array_a, array_b, jjj_ats) local iii_ats, lll_ats, ma_ats, ret_ats; ret_ats := 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 end do end if; ret_ats end proc > > att := proc( > mmm_att,array_aa,array_bb,jjj_att) > global glob_max_terms; > local al_att, iii_att,lll_att, ma_att, ret_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; > end; att := proc(mmm_att, array_aa, array_bb, jjj_att) local al_att, iii_att, lll_att, ma_att, ret_att; global glob_max_terms; ret_att := 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) end if; iii_att := iii_att + 1 end do; ret_att := ret_att/convfp(mmm_att) end if; ret_att end proc > display_pole := proc() > global ALWAYS,glob_display_flag, glob_large_float, array_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; > end; display_pole := proc() global ALWAYS, glob_display_flag, glob_large_float, array_pole; if array_pole[1] <> glob_large_float and 0. < array_pole[1] and array_pole[2] <> glob_large_float and 0. < array_pole[2] 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, " ") end if end proc > logditto := proc(file) > fprintf(file,""); > fprintf(file,"ditto"); > fprintf(file,""); > end; logditto := proc(file) fprintf(file, ""); fprintf(file, "ditto"); fprintf(file, "") end proc > logitem_integer := proc(file,n) > fprintf(file,""); > fprintf(file,"%d",n); > fprintf(file,""); > end; logitem_integer := proc(file, n) fprintf(file, ""); fprintf(file, "%d", n); fprintf(file, "") end proc > logitem_str := proc(file,str) > fprintf(file,""); > fprintf(file,str); > fprintf(file,""); > end; logitem_str := proc(file, str) fprintf(file, ""); fprintf(file, str); fprintf(file, "") end proc > log_revs := proc(file,revs) > fprintf(file,revs); > end; log_revs := proc(file, revs) fprintf(file, revs) end proc > logitem_float := proc(file,x) > fprintf(file,""); > fprintf(file,"%g",x); > fprintf(file,""); > end; logitem_float := proc(file, x) fprintf(file, ""); fprintf(file, "%g", x); fprintf(file, "") end proc > logitem_pole := proc(file,pole) > fprintf(file,""); > if pole = 0 then > fprintf(file,"NA"); > elif pole = 1 then > fprintf(file,"Real"); > elif pole = 2 then > fprintf(file,"Complex"); > else > fprintf(file,"No Pole"); > fi; > fprintf(file,""); > end; logitem_pole := proc(file, pole) fprintf(file, ""); if pole = 0 then fprintf(file, "NA") elif pole = 1 then fprintf(file, "Real") elif pole = 2 then fprintf(file, "Complex") else fprintf(file, "No Pole") end if; fprintf(file, "") end proc > logstart := proc(file) > fprintf(file,""); > end; logstart := proc(file) fprintf(file, "") end proc > logend := proc(file) > fprintf(file,"\n"); > end; logend := proc(file) fprintf(file, "\n") end proc > chk_data := proc() > global glob_max_iter,ALWAYS, glob_max_terms; > local errflag; > 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; > end; chk_data := proc() local errflag; global glob_max_iter, ALWAYS, glob_max_terms; errflag := false; if glob_max_terms < 15 or 512 < glob_max_terms then omniout_str(ALWAYS, "Illegal max_terms = -- Using 30"); glob_max_terms := 30 end if; if glob_max_iter < 2 then omniout_str(ALWAYS, "Illegal max_iter"); errflag := true end if; if errflag then quit end if end proc > > comp_expect_sec := proc(t_end2,t_start2,t2,clock_sec) > global glob_small_float; > local ms2, rrr, sec_left, sub1, sub2; > ; > 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) > 0.0) then > rrr := (sub1/sub2); > sec_left := rrr * ms2 - ms2; > else > sec_left := 0.0; > fi; > fi;; > sec_left; > end; comp_expect_sec := proc(t_end2, t_start2, t2, clock_sec) local ms2, rrr, sec_left, sub1, sub2; global glob_small_float; ms2 := clock_sec; sub1 := t_end2 - t_start2; sub2 := t2 - t_start2; if sub1 = 0. then sec_left := 0. else if 0. < abs(sub2) then rrr := sub1/sub2; sec_left := rrr*ms2 - ms2 else sec_left := 0. end if end if; sec_left end proc > > comp_percent := proc(t_end2,t_start2,t2) > global glob_small_float; > local rrr, sub1, sub2; > 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 > end; comp_percent := proc(t_end2, t_start2, t2) local rrr, sub1, sub2; global glob_small_float; sub1 := t_end2 - t_start2; sub2 := t2 - t_start2; if glob_small_float < abs(sub2) then rrr := 100.0*sub2/sub1 else rrr := 0. end if; rrr end proc > > factorial_1 := proc(nnn) > nnn!; > > end; factorial_1 := proc(nnn) nnn! end proc > > factorial_3 := proc(mmm2,nnn2) > (mmm2!)/(nnn2!); > > end; factorial_3 := proc(mmm2, nnn2) mmm2!/nnn2! end proc > convfp := proc(mmm) > (mmm); > > end; convfp := proc(mmm) mmm end proc > convfloat := proc(mmm) > (mmm); > > end; convfloat := proc(mmm) mmm end proc > elapsed_time_seconds := proc() > time(); > end; elapsed_time_seconds := proc() time() end proc > > > #END ATS LIBRARY BLOCK #BEGIN USER DEF BLOCK > exact_soln_y1 := proc(x) > cos(x); > end; exact_soln_y1 := proc(x) cos(x) end proc > exact_soln_y2 := proc(x) > -sin(x); > end; exact_soln_y2 := proc(x) -sin(x) end proc > #END USER DEF BLOCK #END OUTFILE5 > mainprog := proc() #BEGIN OUTFIEMAIN > local d1,d2,d3,d4,est_err_2,niii,done_once, > term,ord,order_diff,term_no,html_log_file, > rows,r_order,sub_iter,calc_term,iii,temp_sum,current_iter, > x_start,x_end > ,it, log10norm, max_terms, opt_iter, tmp; #Top Generate Globals Definition #Bottom Generate Globals Deninition > global > ALWAYS, > glob_max_terms, > INFO, > DEBUGL, > DEBUGMASSIVE, > glob_iolevel, #Top Generate Globals Decl > MAX_UNCHANGED, > glob_start, > glob_no_eqs, > glob_max_iter, > glob_log10normmin, > glob_iter, > glob_current_iter, > hours_in_day, > sec_in_min, > glob_log10abserr, > glob_orig_start_sec, > glob_max_trunc_err, > glob_relerr, > glob_large_float, > glob_hmin, > glob_optimal_done, > glob_initial_pass, > glob_clock_sec, > min_in_hour, > glob_small_float, > glob_log10_relerr, > glob_log10_abserr, > glob_dump_analytic, > centuries_in_millinium, > glob_dump, > glob_normmax, > glob_max_order, > glob_curr_iter_when_opt, > glob_max_sec, > glob_warned2, > glob_abserr, > glob_hmax, > glob_reached_optimal_h, > years_in_century, > djd_debug2, > glob_display_flag, > glob_max_hours, > glob_disp_incr, > glob_not_yet_start_msg, > glob_smallish_float, > glob_optimal_clock_start_sec, > glob_max_rel_trunc_err, > glob_look_poles, > glob_hmin_init, > glob_not_yet_finished, > days_in_year, > glob_unchanged_h_cnt, > glob_last_good_h, > glob_almost_1, > glob_max_opt_iter, > glob_optimal_expect_sec, > glob_max_minutes, > glob_log10relerr, > glob_warned, > glob_h, > glob_html_log, > glob_optimal_start, > glob_clock_start_sec, > djd_debug, > glob_percent_done, #Bottom Generate Globals Decl #BEGIN CONST > array_const_0D0, > array_const_1, #END CONST > array_x, > array_last_rel_error, > array_pole, > array_y1_init, > array_y2_init, > array_norms, > array_m1, > array_type_pole, > array_y2, > array_y1, > array_tmp0, > array_tmp1, > array_tmp2, > array_tmp3, > array_1st_rel_error, > array_complex_pole, > array_poles, > array_y1_higher_work2, > array_real_pole, > array_y2_higher_work2, > array_y2_higher_work, > array_y2_higher, > array_y1_higher, > array_y1_higher_work, > glob_last; > glob_last; > ALWAYS := 1; > INFO := 2; > DEBUGL := 3; > DEBUGMASSIVE := 4; > glob_iolevel := INFO; > ALWAYS := 1; > glob_max_terms := 30; > INFO := 2; > DEBUGL := 3; > DEBUGMASSIVE := 4; > glob_iolevel := 5; > MAX_UNCHANGED := 10; > glob_start := 0; > glob_no_eqs := 0; > glob_max_iter := 1000; > glob_log10normmin := 0.1; > glob_iter := 0; > glob_current_iter := 0; > hours_in_day := 24.0; > sec_in_min := 60.0; > glob_log10abserr := 0.0; > glob_orig_start_sec := 0.0; > glob_max_trunc_err := 0.1e-10; > glob_relerr := 0.1e-10; > glob_large_float := 9.0e100; > glob_hmin := 0.00000000001; > glob_optimal_done := false; > glob_initial_pass := true; > glob_clock_sec := 0.0; > min_in_hour := 60.0; > glob_small_float := 0.1e-50; > glob_log10_relerr := 0.1e-10; > glob_log10_abserr := 0.1e-10; > glob_dump_analytic := false; > centuries_in_millinium := 10.0; > glob_dump := false; > glob_normmax := 0.0; > glob_max_order := 30; > glob_curr_iter_when_opt := 0; > glob_max_sec := 10000.0; > glob_warned2 := false; > glob_abserr := 0.1e-10; > glob_hmax := 1.0; > glob_reached_optimal_h := false; > years_in_century := 100.0; > djd_debug2 := true; > glob_display_flag := true; > glob_max_hours := 0.0; > glob_disp_incr := 0.1; > glob_not_yet_start_msg := true; > glob_smallish_float := 0.1e-100; > glob_optimal_clock_start_sec := 0.0; > glob_max_rel_trunc_err := 0.1e-10; > glob_look_poles := false; > glob_hmin_init := 0.001; > glob_not_yet_finished := true; > days_in_year := 365.0; > glob_unchanged_h_cnt := 0; > glob_last_good_h := 0.1; > glob_almost_1 := 0.9990; > glob_max_opt_iter := 10; > glob_optimal_expect_sec := 0.1; > glob_max_minutes := 0.0; > glob_log10relerr := 0.0; > glob_warned := false; > glob_h := 0.1; > glob_html_log := true; > glob_optimal_start := 0.0; > glob_clock_start_sec := 0.0; > djd_debug := true; > glob_percent_done := 0.0; #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,"##############temp/mtest3.ode#################"); > omniout_str(ALWAYS,"diff ( y2 , x , 1 ) = y1 ;"); > omniout_str(ALWAYS,"diff ( y1 , x , 1 ) = m1 * y2 ;"); > omniout_str(ALWAYS,"!"); > omniout_str(ALWAYS,"Digits := 32;"); > omniout_str(ALWAYS,"max_terms := 30;"); > omniout_str(ALWAYS,"!"); > omniout_str(ALWAYS,"x_start := 0.1;"); > omniout_str(ALWAYS,"x_end := 0.5;"); > omniout_str(ALWAYS,"glob_h := 0.00001;"); > 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_max_iter := 20;"); > omniout_str(ALWAYS,"!"); > omniout_str(ALWAYS,"exact_soln_y1 := proc(x)"); > omniout_str(ALWAYS," cos(x);"); > omniout_str(ALWAYS,"end;"); > omniout_str(ALWAYS,"exact_soln_y2 := proc(x)"); > omniout_str(ALWAYS,"-sin(x);"); > omniout_str(ALWAYS,"end;"); > 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 > Digits := 32; > max_terms := 30; #END FIRST INPUT BLOCK #START OF INITS AFTER INPUT BLOCK > glob_max_terms := max_terms; > glob_html_log := true; #END OF INITS AFTER INPUT BLOCK > array_x:= Array(1..(max_terms + 1),[]); > array_last_rel_error:= Array(1..(max_terms + 1),[]); > array_pole:= Array(1..(max_terms + 1),[]); > array_y1_init:= Array(1..(max_terms + 1),[]); > array_y2_init:= Array(1..(max_terms + 1),[]); > array_norms:= Array(1..(max_terms + 1),[]); > array_m1:= Array(1..(max_terms + 1),[]); > array_type_pole:= Array(1..(max_terms + 1),[]); > array_y2:= Array(1..(max_terms + 1),[]); > array_y1:= Array(1..(max_terms + 1),[]); > array_tmp0:= Array(1..(max_terms + 1),[]); > array_tmp1:= Array(1..(max_terms + 1),[]); > array_tmp2:= Array(1..(max_terms + 1),[]); > array_tmp3:= Array(1..(max_terms + 1),[]); > array_1st_rel_error:= Array(1..(max_terms + 1),[]); > array_complex_pole := Array(1..(2+ 1) ,(1..3+ 1),[]); > array_poles := Array(1..(2+ 1) ,(1..3+ 1),[]); > array_y1_higher_work2 := Array(1..(2+ 1) ,(1..max_terms+ 1),[]); > array_real_pole := Array(1..(2+ 1) ,(1..3+ 1),[]); > array_y2_higher_work2 := Array(1..(2+ 1) ,(1..max_terms+ 1),[]); > array_y2_higher_work := Array(1..(2+ 1) ,(1..max_terms+ 1),[]); > array_y2_higher := Array(1..(2+ 1) ,(1..max_terms+ 1),[]); > array_y1_higher := Array(1..(2+ 1) ,(1..max_terms+ 1),[]); > array_y1_higher_work := Array(1..(2+ 1) ,(1..max_terms+ 1),[]); > term := 1; > while term <= max_terms do > array_x[term] := 0.0; > term := term + 1; > od;; > term := 1; > while term <= max_terms do > array_last_rel_error[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_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;; > term := 1; > while term <= max_terms do > array_m1[term] := 0.0; > term := term + 1; > od;; > term := 1; > while term <= max_terms do > array_type_pole[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_y1[term] := 0.0; > term := term + 1; > od;; > 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_1st_rel_error[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 <= 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_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_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_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 <= 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_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_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_work[ord,term] := 0.0; > term := term + 1; > od;; > ord := ord + 1; > od;; #BEGIN ARRAYS DEFINED AND INITIALIZATED > array_x := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_x[term] := 0.0; > term := term + 1; > od;; > array_m1 := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_m1[term] := 0.0; > term := term + 1; > od;; > array_tmp3 := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_tmp3[term] := 0.0; > term := term + 1; > od;; > array_tmp2 := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_tmp2[term] := 0.0; > term := term + 1; > od;; > array_tmp1 := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_tmp1[term] := 0.0; > term := term + 1; > od;; > array_tmp0 := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_tmp0[term] := 0.0; > term := term + 1; > od;; > array_y1 := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_y1[term] := 0.0; > term := term + 1; > od;; > array_y2 := Array(1..(max_terms+1 + 1),[]); > term := 1; > while term <= max_terms + 1 do > array_y2[term] := 0.0; > term := term + 1; > od;; > array_const_0D0 := Array(1..(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_const_1 := Array(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_m1 := Array(1..(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 := 0.5; > glob_h := 0.00001; > array_y1_init[1] := exact_soln_y1(x_start); > array_y2_init[1] := exact_soln_y2(x_start); > glob_max_iter := 20; #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 > if glob_html_log then > html_log_file := fopen("html/entry.html",WRITE,TEXT); > fi;; #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); > if glob_html_log then > logstart(html_log_file); > logitem_str(html_log_file,"2012-05-26T17:34:48-05:00") > ; > logitem_str(html_log_file,"Maple") > ; > logitem_str(html_log_file,"mtest3") > ; > logitem_str(html_log_file,"diff ( y2 , x , 1 ) = y1 ;") > ; > logitem_float(html_log_file,x_start) > ; > logitem_float(html_log_file,x_end) > ; > logitem_float(html_log_file,array_x[1]) > ; > logitem_float(html_log_file,glob_h) > ; > logitem_integer(html_log_file,Digits) > ; > ; > logitem_integer(html_log_file,glob_max_terms) > ; > logitem_float(html_log_file,array_1st_rel_error[1]) > ; > logitem_float(html_log_file,array_last_rel_error[1]) > ; > logitem_integer(html_log_file,glob_iter) > ; > logitem_pole(html_log_file,array_type_pole[1]) > ; > if array_type_pole[1] = 1 or array_type_pole[1] = 2 then > logitem_float(html_log_file,array_pole[1]) > ; > logitem_float(html_log_file,array_pole[2]) > ; > 0; > else > logitem_str(html_log_file,"NA") > ; > logitem_str(html_log_file,"NA") > ; > 0; > fi;; > logitem_time(html_log_file,convfloat(glob_clock_sec)) > ; > if glob_percent_done < 100.0 then > logitem_time(html_log_file,convfloat(glob_optimal_expect_sec)) > ; > 0 > else > logitem_str(html_log_file,"Done") > ; > 0 > fi;; > log_revs(html_log_file," 067 ") > ; > logitem_str(html_log_file,"Testing Systems of Equations") > ; > logend(html_log_file) > ; > logditto(html_log_file) > ; > logditto(html_log_file) > ; > logditto(html_log_file) > ; > logitem_str(html_log_file,"diff ( y1 , x , 1 ) = m1 * y2 ;") > ; > logditto(html_log_file) > ; > logditto(html_log_file) > ; > logditto(html_log_file) > ; > logditto(html_log_file) > ; > logditto(html_log_file) > ; > ; > logditto(html_log_file) > ; > logitem_float(html_log_file,array_1st_rel_error[2]) > ; > logitem_float(html_log_file,array_last_rel_error[2]) > ; > logditto(html_log_file) > ; > logitem_pole(html_log_file,array_type_pole[2]) > ; > if array_type_pole[2] = 1 or array_type_pole[2] = 2 then > logitem_float(html_log_file,array_pole[1]) > ; > logitem_float(html_log_file,array_pole[2]) > ; > 0; > else > logitem_str(html_log_file,"NA") > ; > logitem_str(html_log_file,"NA") > ; > 0; > fi;; > logditto(html_log_file) > ; > if glob_percent_done < 100.0 then > logditto(html_log_file) > ; > 0 > else > logditto(html_log_file) > ; > 0 > fi;; > logditto(html_log_file); > ; > logditto(html_log_file) > ; > logend(html_log_file) > ; > ; > fi;; > if glob_html_log then > fclose(html_log_file); > fi; > ; > ;; #END OUTFILEMAIN > end; mainprog := proc() local d1, d2, d3, d4, est_err_2, niii, done_once, term, ord, order_diff, term_no, html_log_file, rows, r_order, sub_iter, calc_term, iii, temp_sum, current_iter, x_start, x_end, it, log10norm, max_terms, opt_iter, tmp; global ALWAYS, glob_max_terms, INFO, DEBUGL, DEBUGMASSIVE, glob_iolevel, MAX_UNCHANGED, glob_start, glob_no_eqs, glob_max_iter, glob_log10normmin, glob_iter, glob_current_iter, hours_in_day, sec_in_min, glob_log10abserr, glob_orig_start_sec, glob_max_trunc_err, glob_relerr, glob_large_float, glob_hmin, glob_optimal_done, glob_initial_pass, glob_clock_sec, min_in_hour, glob_small_float, glob_log10_relerr, glob_log10_abserr, glob_dump_analytic, centuries_in_millinium, glob_dump, glob_normmax, glob_max_order, glob_curr_iter_when_opt, glob_max_sec, glob_warned2, glob_abserr, glob_hmax, glob_reached_optimal_h, years_in_century, djd_debug2, glob_display_flag, glob_max_hours, glob_disp_incr, glob_not_yet_start_msg, glob_smallish_float, glob_optimal_clock_start_sec, glob_max_rel_trunc_err, glob_look_poles, glob_hmin_init, glob_not_yet_finished, days_in_year, glob_unchanged_h_cnt, glob_last_good_h, glob_almost_1, glob_max_opt_iter, glob_optimal_expect_sec, glob_max_minutes, glob_log10relerr, glob_warned, glob_h, glob_html_log, glob_optimal_start, glob_clock_start_sec, djd_debug, glob_percent_done, array_const_0D0, array_const_1, array_x, array_last_rel_error, array_pole, array_y1_init, array_y2_init, array_norms, array_m1, array_type_pole, array_y2, array_y1, array_tmp0, array_tmp1, array_tmp2, array_tmp3, array_1st_rel_error, array_complex_pole, array_poles, array_y1_higher_work2, array_real_pole, array_y2_higher_work2, array_y2_higher_work, array_y2_higher, array_y1_higher, array_y1_higher_work, glob_last; glob_last; ALWAYS := 1; INFO := 2; DEBUGL := 3; DEBUGMASSIVE := 4; glob_iolevel := INFO; ALWAYS := 1; glob_max_terms := 30; INFO := 2; DEBUGL := 3; DEBUGMASSIVE := 4; glob_iolevel := 5; MAX_UNCHANGED := 10; glob_start := 0; glob_no_eqs := 0; glob_max_iter := 1000; glob_log10normmin := 0.1; glob_iter := 0; glob_current_iter := 0; hours_in_day := 24.0; sec_in_min := 60.0; glob_log10abserr := 0.; glob_orig_start_sec := 0.; glob_max_trunc_err := 0.1*10^(-10); glob_relerr := 0.1*10^(-10); glob_large_float := 0.90*10^101; glob_hmin := 0.1*10^(-10); glob_optimal_done := false; glob_initial_pass := true; glob_clock_sec := 0.; min_in_hour := 60.0; glob_small_float := 0.1*10^(-50); glob_log10_relerr := 0.1*10^(-10); glob_log10_abserr := 0.1*10^(-10); glob_dump_analytic := false; centuries_in_millinium := 10.0; glob_dump := false; glob_normmax := 0.; glob_max_order := 30; glob_curr_iter_when_opt := 0; glob_max_sec := 10000.0; glob_warned2 := false; glob_abserr := 0.1*10^(-10); glob_hmax := 1.0; glob_reached_optimal_h := false; years_in_century := 100.0; djd_debug2 := true; glob_display_flag := true; glob_max_hours := 0.; glob_disp_incr := 0.1; glob_not_yet_start_msg := true; glob_smallish_float := 0.1*10^(-100); glob_optimal_clock_start_sec := 0.; glob_max_rel_trunc_err := 0.1*10^(-10); glob_look_poles := false; glob_hmin_init := 0.001; glob_not_yet_finished := true; days_in_year := 365.0; glob_unchanged_h_cnt := 0; glob_last_good_h := 0.1; glob_almost_1 := 0.9990; glob_max_opt_iter := 10; glob_optimal_expect_sec := 0.1; glob_max_minutes := 0.; glob_log10relerr := 0.; glob_warned := false; glob_h := 0.1; glob_html_log := true; glob_optimal_start := 0.; glob_clock_start_sec := 0.; djd_debug := true; glob_percent_done := 0.; 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.; glob_max_minutes := 15.0; omniout_str(ALWAYS, "##############ECHO OF PROBLEM#################"); omniout_str(ALWAYS, "##############temp/mtest3.ode#################"); omniout_str(ALWAYS, "diff ( y2 , x , 1 ) = y1 ;"); omniout_str(ALWAYS, "diff ( y1 , x , 1 ) = m1 * y2 ;"); omniout_str(ALWAYS, "!"); omniout_str(ALWAYS, "Digits := 32;"); omniout_str(ALWAYS, "max_terms := 30;"); omniout_str(ALWAYS, "!"); omniout_str(ALWAYS, "x_start := 0.1;"); omniout_str(ALWAYS, "x_end := 0.5;"); omniout_str(ALWAYS, "glob_h := 0.00001;"); 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_max_iter := 20;"); omniout_str(ALWAYS, "!"); omniout_str(ALWAYS, "exact_soln_y1 := proc(x)"); omniout_str(ALWAYS, " cos(x);"); omniout_str(ALWAYS, "end;"); omniout_str(ALWAYS, "exact_soln_y2 := proc(x)"); omniout_str(ALWAYS, "-sin(x);"); omniout_str(ALWAYS, "end;"); 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 := 0.10*10^(-199); glob_smallish_float := 0.10*10^(-63); glob_large_float := 0.10*10^101; glob_almost_1 := 0.99; glob_log10_abserr := -8.0; glob_log10_relerr := -8.0; glob_hmax := 0.01; Digits := 32; max_terms := 30; glob_max_terms := max_terms; glob_html_log := true; array_x := Array(1 .. max_terms + 1, []); array_last_rel_error := Array(1 .. max_terms + 1, []); array_pole := Array(1 .. max_terms + 1, []); array_y1_init := Array(1 .. max_terms + 1, []); array_y2_init := Array(1 .. max_terms + 1, []); array_norms := Array(1 .. max_terms + 1, []); array_m1 := Array(1 .. max_terms + 1, []); array_type_pole := Array(1 .. max_terms + 1, []); array_y2 := Array(1 .. max_terms + 1, []); array_y1 := Array(1 .. max_terms + 1, []); array_tmp0 := Array(1 .. max_terms + 1, []); array_tmp1 := Array(1 .. max_terms + 1, []); array_tmp2 := Array(1 .. max_terms + 1, []); array_tmp3 := Array(1 .. max_terms + 1, []); array_1st_rel_error := Array(1 .. max_terms + 1, []); array_complex_pole := Array(1 .. 3, 1 .. 4, []); array_poles := Array(1 .. 3, 1 .. 4, []); array_y1_higher_work2 := Array(1 .. 3, 1 .. max_terms + 1, []); array_real_pole := Array(1 .. 3, 1 .. 4, []); array_y2_higher_work2 := Array(1 .. 3, 1 .. max_terms + 1, []); array_y2_higher_work := Array(1 .. 3, 1 .. max_terms + 1, []); array_y2_higher := Array(1 .. 3, 1 .. max_terms + 1, []); array_y1_higher := Array(1 .. 3, 1 .. max_terms + 1, []); array_y1_higher_work := Array(1 .. 3, 1 .. max_terms + 1, []); term := 1; while term <= max_terms do array_x[term] := 0.; term := term + 1 end do ; term := 1; while term <= max_terms do array_last_rel_error[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_pole[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_y1_init[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_y2_init[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_norms[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_m1[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_type_pole[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_y2[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_y1[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_tmp0[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_tmp1[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_tmp2[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_tmp3[term] := 0.; term := term + 1 end do; term := 1; while term <= max_terms do array_1st_rel_error[term] := 0.; term := term + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= 3 do array_complex_pole[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= 3 do array_poles[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= max_terms do array_y1_higher_work2[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= 3 do array_real_pole[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= max_terms do array_y2_higher_work2[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= max_terms do array_y2_higher_work[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= max_terms do array_y2_higher[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= max_terms do array_y1_higher[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; ord := 1; while ord <= 2 do term := 1; while term <= max_terms do array_y1_higher_work[ord, term] := 0.; term := term + 1 end do; ord := ord + 1 end do; array_x := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_x[term] := 0.; term := term + 1 end do; array_m1 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_m1[term] := 0.; term := term + 1 end do; array_tmp3 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_tmp3[term] := 0.; term := term + 1 end do; array_tmp2 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_tmp2[term] := 0.; term := term + 1 end do; array_tmp1 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_tmp1[term] := 0.; term := term + 1 end do; array_tmp0 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_tmp0[term] := 0.; term := term + 1 end do; array_y1 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_y1[term] := 0.; term := term + 1 end do; array_y2 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_y2[term] := 0.; term := term + 1 end do; array_const_0D0 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_const_0D0[term] := 0.; term := term + 1 end do; array_const_0D0[1] := 0.; array_const_1 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms + 1 do array_const_1[term] := 0.; term := term + 1 end do; array_const_1[1] := 1; array_m1 := Array(1 .. max_terms + 2, []); term := 1; while term <= max_terms do array_m1[term] := 0.; term := term + 1 end do; array_m1[1] := -1.0; x_start := 0.1; x_end := 0.5; glob_h := 0.00001; array_y1_init[1] := exact_soln_y1(x_start); array_y2_init[1] := exact_soln_y2(x_start); glob_max_iter := 20; 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(); if glob_html_log then html_log_file := fopen("html/entry.html", WRITE, TEXT) end if; omniout_str(ALWAYS, "START of Soultion"); array_x[1] := x_start; array_x[2] := glob_h; order_diff := 1; 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 end do; 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 end do; r_order := r_order + 1 end do; order_diff := 1; 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 end do; 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 end do; r_order := r_order + 1 end do; current_iter := 1; glob_clock_start_sec := elapsed_time_seconds(); start_array_y2(); if glob_small_float < abs(array_y2_higher[1, 1]) then tmp := abs(array_y2_higher[1, 1]); log10norm := log10(tmp); if log10norm < glob_log10normmin then glob_log10normmin := log10norm end if end if; display_alot(current_iter); start_array_y1(); if glob_small_float < abs(array_y1_higher[1, 1]) then tmp := abs(array_y1_higher[1, 1]); log10norm := log10(tmp); if log10norm < glob_log10normmin then glob_log10normmin := log10norm end if end if; 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 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 end do; if glob_look_poles then check_for_pole() end if; array_x[1] := array_x[1] + glob_h; array_x[2] := glob_h; order_diff := 1; order_diff := 1; order_diff := 1; ord := 2; calc_term := 1; iii := glob_max_terms; while calc_term <= iii 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 end do; order_diff := 1; temp_sum := 0.; ord := 2; calc_term := 1; iii := glob_max_terms; while calc_term <= iii do temp_sum := temp_sum + array_y2_higher_work[ord, iii]; iii := iii - 1 end do; array_y2_higher_work2[ord, calc_term] := temp_sum*glob_h^(calc_term - 1)/convfp(calc_term - 1)!; order_diff := 1; ord := 1; calc_term := 2; iii := glob_max_terms; while calc_term <= iii 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 end do; order_diff := 1; temp_sum := 0.; ord := 1; calc_term := 2; iii := glob_max_terms; while calc_term <= iii do temp_sum := temp_sum + array_y2_higher_work[ord, iii]; iii := iii - 1 end do; array_y2_higher_work2[ord, calc_term] := temp_sum*glob_h^(calc_term - 1)/convfp(calc_term - 1)!; order_diff := 1; ord := 1; calc_term := 1; iii := glob_max_terms; while calc_term <= iii 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 end do; order_diff := 1; temp_sum := 0.; ord := 1; calc_term := 1; iii := glob_max_terms; while calc_term <= iii do temp_sum := temp_sum + array_y2_higher_work[ord, iii]; iii := iii - 1 end do; array_y2_higher_work2[ord, calc_term] := temp_sum*glob_h^(calc_term - 1)/convfp(calc_term - 1)!; term_no := glob_max_terms; while 1 <= term_no 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 end do; term_no := term_no - 1 end do; order_diff := 1; order_diff := 1; order_diff := 1; ord := 2; calc_term := 1; iii := glob_max_terms; while calc_term <= iii 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 end do; order_diff := 1; temp_sum := 0.; ord := 2; calc_term := 1; iii := glob_max_terms; while calc_term <= iii do temp_sum := temp_sum + array_y1_higher_work[ord, iii]; iii := iii - 1 end do; array_y1_higher_work2[ord, calc_term] := temp_sum*glob_h^(calc_term - 1)/convfp(calc_term - 1)!; order_diff := 1; ord := 1; calc_term := 2; iii := glob_max_terms; while calc_term <= iii 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 end do; order_diff := 1; temp_sum := 0.; ord := 1; calc_term := 2; iii := glob_max_terms; while calc_term <= iii do temp_sum := temp_sum + array_y1_higher_work[ord, iii]; iii := iii - 1 end do; array_y1_higher_work2[ord, calc_term] := temp_sum*glob_h^(calc_term - 1)/convfp(calc_term - 1)!; order_diff := 1; ord := 1; calc_term := 1; iii := glob_max_terms; while calc_term <= iii 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 end do; order_diff := 1; temp_sum := 0.; ord := 1; calc_term := 1; iii := glob_max_terms; while calc_term <= iii do temp_sum := temp_sum + array_y1_higher_work[ord, iii]; iii := iii - 1 end do; array_y1_higher_work2[ord, calc_term] := temp_sum*glob_h^(calc_term - 1)/convfp(calc_term - 1)!; term_no := glob_max_terms; while 1 <= term_no 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 end do; term_no := term_no - 1 end do; display_alot(current_iter) end do; omniout_str(ALWAYS, "Finished!"); if glob_max_iter <= glob_iter then omniout_str(ALWAYS, "Maximum Iterations Reached before Solution Completed!") end if; if convfloat(glob_max_sec) <= elapsed_time_seconds() - convfloat(glob_orig_start_sec) then omniout_str(ALWAYS, "Maximum Time Reached before Solution Completed!") end if; glob_clock_sec := elapsed_time_seconds(); omniout_int(INFO, "Iterations ", 32, glob_iter, 4, " "); prog_report(x_start, x_end); if glob_html_log then logstart(html_log_file); logitem_str(html_log_file, "2012-05-26T17:34:48-05:00"); logitem_str(html_log_file, "Maple"); logitem_str(html_log_file, "mtest3"); logitem_str(html_log_file, "diff ( y2 , x , 1 ) = y1 ;"); logitem_float(html_log_file, x_start); logitem_float(html_log_file, x_end); logitem_float(html_log_file, array_x[1]); logitem_float(html_log_file, glob_h); logitem_integer(html_log_file, Digits); logitem_integer(html_log_file, glob_max_terms); logitem_float(html_log_file, array_1st_rel_error[1]); logitem_float(html_log_file, array_last_rel_error[1]); logitem_integer(html_log_file, glob_iter); logitem_pole(html_log_file, array_type_pole[1]); if array_type_pole[1] = 1 or array_type_pole[1] = 2 then logitem_float(html_log_file, array_pole[1]); logitem_float(html_log_file, array_pole[2]); 0 else logitem_str(html_log_file, "NA"); logitem_str(html_log_file, "NA"); 0 end if; logitem_time(html_log_file, convfloat(glob_clock_sec)); if glob_percent_done < 100.0 then logitem_time(html_log_file, convfloat(glob_optimal_expect_sec)) ; 0 else logitem_str(html_log_file, "Done"); 0 end if; log_revs(html_log_file, " 067 "); logitem_str(html_log_file, "Testing Systems of Equations"); logend(html_log_file); logditto(html_log_file); logditto(html_log_file); logditto(html_log_file); logitem_str(html_log_file, "diff ( y1 , x , 1 ) = m1 * y2 ;"); logditto(html_log_file); logditto(html_log_file); logditto(html_log_file); logditto(html_log_file); logditto(html_log_file); logditto(html_log_file); logitem_float(html_log_file, array_1st_rel_error[2]); logitem_float(html_log_file, array_last_rel_error[2]); logditto(html_log_file); logitem_pole(html_log_file, array_type_pole[2]); if array_type_pole[2] = 1 or array_type_pole[2] = 2 then logitem_float(html_log_file, array_pole[1]); logitem_float(html_log_file, array_pole[2]); 0 else logitem_str(html_log_file, "NA"); logitem_str(html_log_file, "NA"); 0 end if; logditto(html_log_file); if glob_percent_done < 100.0 then logditto(html_log_file); 0 else logditto(html_log_file); 0 end if; logditto(html_log_file); logditto(html_log_file); logend(html_log_file) end if; if glob_html_log then fclose(html_log_file) end if end proc > mainprog(); ##############ECHO OF PROBLEM################# ##############temp/mtest3.ode################# diff ( y2 , x , 1 ) = y1 ; diff ( y1 , x , 1 ) = m1 * y2 ; ! Digits := 32; max_terms := 30; ! x_start := 0.1; x_end := 0.5; glob_h := 0.00001; array_y1_init[1] := exact_soln_y1(x_start); array_y2_init[1] := exact_soln_y2(x_start); glob_max_iter := 20; ! exact_soln_y1 := proc(x) cos(x); end; exact_soln_y2 := proc(x) -sin(x); end; #######END OF ECHO OF PROBLEM################# START of Soultion x[1] = 0.1 y2[1] (analytic) = -0.099833416646828152306814198410622 y2[1] (numeric) = -0.099833416646828152306814198410622 absolute error = 0 relative error = 0 % h = 1e-05 y1[1] (analytic) = 0.99500416527802576609556198780387 y1[1] (numeric) = 0.99500416527802576609556198780387 absolute error = 0 relative error = 0 % h = 1e-05 x[1] = 0.1 y2[1] (analytic) = -0.099833416646828152306814198410622 y2[1] (numeric) = -0.099833416646828152306814198410622 absolute error = 0 relative error = 0 % h = 1e-05 y1[1] (analytic) = 0.99500416527802576609556198780387 y1[1] (numeric) = 0.99500416527802576609556198780387 absolute error = 0 relative error = 0 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10001 y2[1] (analytic) = -0.099843366683489095898147798163638 y2[1] (numeric) = -0.099823466600183867050880977940792 absolute error = 1.9900083305228847266820222846e-05 relative error = 0.019931302365147193585750625285358 % h = 1e-05 y1[1] (analytic) = 0.99500316689410910618945499081414 y1[1] (numeric) = 0.99500516356244200947469557832173 absolute error = 1.99666833290328524058750759e-06 relative error = 0.00020066954551872054653900807584692 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10002 y2[1] (analytic) = -0.099853316710165702821215691132408 y2[1] (numeric) = -0.09981351654355723513501255698804 absolute error = 3.9800166608467686203134144368e-05 relative error = 0.039858632561992581332335121541088 % h = 1e-05 y1[1] (analytic) = 0.9950021684106921295947662525112 y1[1] (numeric) = 0.99500616174735773649841413886175 absolute error = 3.99333666560690364788635055e-06 relative error = 0.00040133949376064414103426426867695 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10003 y2[1] (analytic) = -0.099863266726856978073350224916315 y2[1] (numeric) = -0.09980356647694925156487159045224 absolute error = 5.9700249907726508478634464075e-05 relative error = 0.059781991781839910564405446059843 % h = 1e-05 y1[1] (analytic) = 0.99500116982777493615983746972246 y1[1] (numeric) = 0.99500715983277284734822609755338 absolute error = 5.99000499791118838862783092e-06 relative error = 0.00060200984476711723144024664005643 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10004 y2[1] (analytic) = -0.099873216733561926652882280281826 y2[1] (numeric) = -0.099793616400360911347118868398683 absolute error = 7.9600333201015305763411883143e-05 relative error = 0.079701381215516598714424011005918 % h = 1e-05 y1[1] (analytic) = 0.99500017114535762574296036095926 y1[1] (numeric) = 0.99500815781868724221558994414338 absolute error = 7.98667332961647262958318412e-06 relative error = 0.0008026805985794865927906116911582 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10005 y2[1] (analytic) = -0.099883166730279553559141370662659 y2[1] (numeric) = -0.099783666313793209489413216557414 absolute error = 9.9500416486344069728154105245e-05 relative error = 0.09961680205337397136858987159515 % h = 1e-05 y1[1] (analytic) = 0.99499917236344029821237665643104 y1[1] (numeric) = 0.99500915570510082130191423997667 absolute error = 9.98334166052308953758354563e-06 relative error = 0.0010033517552390993272327514572615 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10006 y2[1] (analytic) = -0.099893116717008863792455741659854 y2[1] (numeric) = -0.099773716217247141000411396822465 absolute error = 0.000119400499761722792044344837389 relative error = 0.1195282554852875001700230040274 % h = 1e-05 y1[1] (analytic) = 0.99499817348202305344627808805855 y1[1] (numeric) = 0.99501015349201348481855762797619 absolute error = 1.198000999043137227953991764e-05 relative error = 0.0012040233147873028640623511666768 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10007 y2[1] (analytic) = -0.099903066693748862354152470541733 y2[1] (numeric) = -0.099763766110723700889768007750989 absolute error = 0.000139300583025161464384462790744 relative error = 0.1394357427006570405793065225942 % h = 1e-05 y1[1] (analytic) = 0.99499717450110599133280637948601 y1[1] (numeric) = 0.99501115117942513298682884262176 absolute error = 1.397667831914165402246313575e-05 relative error = 0.0014046952772654449597579474721973 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10008 y2[1] (analytic) = -0.099913016660498554246557565743775 y2[1] (numeric) = -0.099753815994223884168135385062295 absolute error = 0.00015920066627467007842218068148 relative error = 0.1593392648884070694924866056145 % h = 1e-05 y1[1] (analytic) = 0.99499617542068921177005323609226 y1[1] (numeric) = 0.99501214876733566603798671992796 absolute error = 1.597334664645426793348383570e-05 relative error = 0.0016053676427148736980154872531312 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10009 y2[1] (analytic) = -0.099922966617256944472996066368378 y2[1] (numeric) = -0.099743865867748685847163502136782 absolute error = 0.000179100749508258625832564231596 relative error = 0.17923882323698692271662982005535 % h = 1e-05 y1[1] (analytic) = 0.99499517624077281466606033500102 y1[1] (numeric) = 0.995013146255744984213240207421 absolute error = 1.797001497216954717987241998e-05 relative error = 0.0018060404111769374897828869729002 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.1001 y2[1] (analytic) = -0.099932916564023038037792141684529 y2[1] (numeric) = -0.099733915731299100939499870514776 absolute error = 0.000199000832723937098292271169753 relative error = 0.19913441893437103230303745506546 % h = 1e-05 y1[1] (analytic) = 0.99499417696135689993881931509004 y1[1] (numeric) = 0.99501414364465298776374837411459 absolute error = 1.996668329608782492905902455e-05 relative error = 0.0020067135826929850732945926153828 % h = 1e-05 TOP MAIN SOLVE Loop memory used=3.8MB, alloc=3.0MB, time=0.18 x[1] = 0.10011 y2[1] (analytic) = -0.09994286650079583994626919062737 y2[1] (numeric) = -0.099723965584876124458789440395262 absolute error = 0.000218900915919715487479750232108 relative error = 0.21902605316805916373821639502748 % h = 1e-05 y1[1] (analytic) = 0.99499317758244156751627176699931 y1[1] (numeric) = 0.99501514093405957695062042048484 absolute error = 2.196335161800943434865348553e-05 relative error = 0.0022073871573043655141061401859946 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10012 y2[1] (analytic) = -0.099952816427574355204749941297668 y2[1] (numeric) = -0.099714015428480751419674501134523 absolute error = 0.000238800999093603785075440163145 relative error = 0.2389137271250766529927059832063 % h = 1e-05 y1[1] (analytic) = 0.99499217810402691733630922313827 y1[1] (numeric) = 0.99501613812396465204491568844413 absolute error = 2.396001993773470860646530586e-05 relative error = 0.0024080611350524282051287167775681 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10013 y2[1] (analytic) = -0.099962766344357588820556550461181 y2[1] (numeric) = -0.099704065262113976837794581744674 absolute error = 0.000258701082243611982761968716507 relative error = 0.2587974419919746434278602476207 % h = 1e-05 y1[1] (analytic) = 0.99499117852611304934677314769202 y1[1] (numeric) = 0.99501713521436811332764367131403 absolute error = 2.595668825506398087052362201e-05 relative error = 0.0026087355159785228666637222091345 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10014 y2[1] (analytic) = -0.099972716251144545802010703047924 y2[1] (numeric) = -0.099694115085776795729786351392097 absolute error = 0.000278601165367750072224351655827 relative error = 0.27867719895483032256068478137379 % h = 1e-05 y1[1] (analytic) = 0.99499017884870006350545492662652 y1[1] (numeric) = 0.99501813220526986108976402379718 absolute error = 2.795335656979758430909717066e-05 relative error = 0.0028094103001239995464373312296292 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10015 y2[1] (analytic) = -0.099982666147934231158433711651342 y2[1] (numeric) = -0.099684164899470203113283519895779 absolute error = 0.000298501248464028045150191755563 relative error = 0.2985529991992471586868274903697 % h = 1e-05 y1[1] (analytic) = 0.99498917907178805978009585769285 y1[1] (numeric) = 0.99501912909666979563218657194819 absolute error = 2.995002488173585209071425534e-05 relative error = 0.0030100854875302086196350562855796 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10016 y2[1] (analytic) = -0.099992616034725649900146616027373 y2[1] (numeric) = -0.099674214703195194006916738225548 absolute error = 0.000318401331530455893229877801825 relative error = 0.3184248439103551373618223420835 % h = 1e-05 y1[1] (analytic) = 0.99498817919537713814838714043039 y1[1] (numeric) = 0.99502012588856781726577132314356 absolute error = 3.194669319067911738418271317e-05 relative error = 0.0032107610782385007889363108669072 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10017 y2[1] (analytic) = -0.10000256591151780703847028259342 y2[1] (numeric) = -0.099664264496952763430313499000212 absolute error = 0.000338301414565043608156783593208 relative error = 0.33829273427281099774068516990492 % h = 1e-05 y1[1] (analytic) = 0.99498717921946739859796986616909 y1[1] (numeric) = 0.99502112258096382631132847605059 absolute error = 3.394336149642771335860988150e-05 relative error = 0.0034114370722902270845489734108054 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10018 y2[1] (analytic) = -0.10001251577830970758572550392721 y2[1] (numeric) = -0.099654314280743906404098036985591 absolute error = 0.000358201497565801181627466941619 relative error = 0.35815667147079846877596050844945 % h = 1e-05 y1[1] (analytic) = 0.99498617914405894112643500803067 y1[1] (numeric) = 0.9950221191738577230996184305953 absolute error = 3.594002979878197318342256463e-05 relative error = 0.0036121134697267388642439517818477 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.10019 y2[1] (analytic) = -0.10002246563510035655523309826558 y2[1] (numeric) = -0.099644364054569617949891229592461 absolute error = 0.000378101580530738605341868673119 relative error = 0.3780166566880285052743183562327 % h = 1e-05 y1[1] (analytic) = 0.99498517896915186574132341092889 y1[1] (numeric) = 0.99502311566724940797135179792936 absolute error = 3.793669809754223002838700047e-05 relative error = 0.0038127902705893878133897483143163 % h = 1e-05 TOP MAIN SOLVE Loop x[1] = 0.1002 y2[1] (analytic) = -0.10003241548188875896131400900311 y2[1] (numeric) = -0.099634413818430893090310497374387 absolute error = 0.000398001663457865871003511628723 relative error = 0.39787269110773952381179968306757 % h = 1e-05 y1[1] (analytic) = 0.99498417869474627246012578156879 y1[1] (numeric) = 0.995024112061138781277189410396 absolute error = 3.993336639250881706362882721e-05 relative error = 0.0040134674749195259449870254238502 % h = 1e-05 Finished! Maximum Iterations Reached before Solution Completed! Iterations = 20 Total Elapsed Time = 0 Seconds Elapsed Time(since restart) = 0 Seconds Expected Time Remaining = 8 Minutes 26 Seconds Optimized Time Remaining = 8 Minutes 9 Seconds Time to Timeout = 14 Minutes 59 Seconds Percent Done = 0.0525 % > quit memory used=6.2MB, alloc=3.0MB, time=0.31