/* BEGIN OUTFILE1 */
load("stringproc");
/* Begin Function number 3*/
check_sign( x0 ,xf) := (
block( [ret],
if (xf > x0) then ( /* if number 1*/
ret : 1.0
) else (
ret : -1.0
)/* end if 1*/
,
ret
)
); /* End Function number3 */
/* Begin Function number 4*/
est_size_answer()
:= (
block( [ min_size],
min_size : glob_large_float,
if (omniabs(array_y[1]) < min_size) then ( /* if number 1*/
min_size : omniabs(array_y[1]),
omniout_float(ALWAYS,"min_size",32,min_size,32,"")
)/* end if 1*/
,
if (min_size < 1.0) then ( /* if number 1*/
min_size : 1.0,
omniout_float(ALWAYS,"min_size",32,min_size,32,"")
)/* end if 1*/
,
min_size
)
); /* End Function number4 */
/* Begin Function number 5*/
test_suggested_h()
:= (
block ([max_value3,hn_div_ho,hn_div_ho_2,hn_div_ho_3,value3,no_terms],
max_value3 : 0.0,
no_terms : glob_max_terms,
hn_div_ho : 0.5,
hn_div_ho_2 : 0.25,
hn_div_ho_3 : 0.125,
omniout_float(ALWAYS,"hn_div_ho",32,hn_div_ho,32,""),
omniout_float(ALWAYS,"hn_div_ho_2",32,hn_div_ho_2,32,""),
omniout_float(ALWAYS,"hn_div_ho_3",32,hn_div_ho_3,32,""),
value3 : omniabs(array_y[no_terms-3] + array_y[no_terms - 2] * hn_div_ho + array_y[no_terms - 1] * hn_div_ho_2 + array_y[no_terms] * hn_div_ho_3),
if (value3 > max_value3) then ( /* if number 1*/
max_value3 : value3,
omniout_float(ALWAYS,"value3",32,value3,32,"")
)/* end if 1*/
,
omniout_float(ALWAYS,"max_value3",32,max_value3,32,""),
max_value3
)
); /* End Function number5 */
/* Begin Function number 6*/
reached_interval()
:= (
block([ret],
if (glob_check_sign * (array_x[1]) >= glob_check_sign * glob_next_display) then ( /* if number 1*/
ret : true
) else (
ret : false
)/* end if 1*/
,
return(ret)
)
); /* End Function number6 */
/* Begin Function number 7*/
display_alot(iter)
:= (
block([abserr, analytic_val_y, ind_var, numeric_val, relerr, term_no],
/* TOP DISPLAY ALOT */
if (reached_interval()) then ( /* if number 1*/
if (iter >= 0) then ( /* if number 2*/
ind_var : array_x[1],
omniout_float(ALWAYS,"x[1] ",33,ind_var,20," "),
analytic_val_y : exact_soln_y(ind_var),
omniout_float(ALWAYS,"y[1] (analytic) ",33,analytic_val_y,20," "),
term_no : 1,
numeric_val : array_y[term_no],
abserr : omniabs(numeric_val - analytic_val_y),
omniout_float(ALWAYS,"y[1] (numeric) ",33,numeric_val,20," "),
if (omniabs(analytic_val_y) # 0.0) then ( /* if number 3*/
relerr : abserr*100.0/omniabs(analytic_val_y),
if (relerr > 0.0000000000000000000000000000000001) then ( /* if number 4*/
glob_good_digits : -floor(log10(relerr)) + 2
) else (
glob_good_digits : 16
)/* end if 4*/
) else (
relerr : -1.0 ,
glob_good_digits : -1
)/* end if 3*/
,
if (glob_iter = 1) then ( /* if number 3*/
array_1st_rel_error[1] : relerr
) else (
array_last_rel_error[1] : relerr
)/* end if 3*/
,
omniout_float(ALWAYS,"absolute error ",4,abserr,20," "),
omniout_float(ALWAYS,"relative error ",4,relerr,20,"%"),
omniout_int(INFO,"Correct digits ",32,glob_good_digits,4," ")
,
omniout_float(ALWAYS,"h ",4,glob_h,20," ")
)/* end if 2*/
/* BOTTOM DISPLAY ALOT */
)/* end if 1*/
)
); /* End Function number7 */
/* Begin Function number 8*/
adjust_for_pole(h_param)
:= (
block([hnew, sz2, tmp],
/* TOP ADJUST FOR POLE */
block(
hnew : h_param,
glob_normmax : glob_small_float,
if (omniabs(array_y_higher[1,1]) > glob_small_float) then ( /* if number 1*/
tmp : omniabs(array_y_higher[1,1]),
if (tmp < glob_normmax) then ( /* if number 2*/
glob_normmax : tmp
)/* end if 2*/
)/* end if 1*/
,
if (glob_look_poles and (omniabs(array_pole[1]) > glob_small_float) and (array_pole[1] # glob_large_float)) then ( /* if number 1*/
sz2 : array_pole[1]/10.0,
if (sz2 < hnew) then ( /* if number 2*/
omniout_float(INFO,"glob_h adjusted to ",20,h_param,12,"due to singularity."),
omniout_str(INFO,"Reached Optimal"),
return(hnew)
)/* end if 2*/
)/* end if 1*/
,
if ( not glob_reached_optimal_h) then ( /* if number 1*/
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 1*/
,
hnew : sz2
),/* END block */
return(hnew)
/* BOTTOM ADJUST FOR POLE */
)
); /* End Function number8 */
/* Begin Function number 9*/
prog_report(x_start,x_end)
:= (
block([ 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)),
glob_total_exp_sec : glob_optimal_expect_sec + total_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 ( /* if number 1*/
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)),
omniout_str_noeol(INFO,"Expected Total Time "),
omniout_timestr(convfloat(glob_total_exp_sec))
)/* end if 1*/
,
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 Function number9 */
/* Begin Function number 10*/
check_for_pole()
:= (
block([cnt, dr1, dr2, ds1, ds2, hdrc, m, n, nr1, nr2, ord_no, rad_c, rcs, rm0, rm1, rm2, rm3, rm4, found, h_new, ratio, term],
/* 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 - 3 - 1,
while ((m >= 10) and ((omniabs(array_y_higher[1,m]) < glob_small_float) or (omniabs(array_y_higher[1,m-1]) < glob_small_float) or (omniabs(array_y_higher[1,m-2]) < glob_small_float ))) do ( /* do number 2*/
m : m - 1
)/* end do number 2*/
,
if (m > 10) then ( /* if number 1*/
rm0 : array_y_higher[1,m]/array_y_higher[1,m-1],
rm1 : array_y_higher[1,m-1]/array_y_higher[1,m-2],
hdrc : convfloat(m-1)*rm0-convfloat(m-2)*rm1,
if (omniabs(hdrc) > glob_small_float) then ( /* if number 2*/
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 2*/
) else (
array_real_pole[1,1] : glob_large_float,
array_real_pole[1,2] : glob_large_float
)/* end if 1*/
,
/* BOTTOM RADII REAL EQ = 1 */
/* 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 - 3 - 1,
cnt : 0,
while ((cnt < 5) and (n >= 10)) do ( /* do number 2*/
if (omniabs(array_y_higher[1,n]) > glob_small_float) then ( /* if number 1*/
cnt : cnt + 1
) else (
cnt : 0
)/* end if 1*/
,
n : n - 1
)/* end do number 2*/
,
m : n + cnt,
if (m <= 10) then ( /* if number 1*/
rad_c : glob_large_float,
ord_no : glob_large_float
) elseif
(((omniabs(array_y_higher[1,m]) >= (glob_large_float)) or (omniabs(array_y_higher[1,m-1]) >=(glob_large_float)) or (omniabs(array_y_higher[1,m-2]) >= (glob_large_float)) or (omniabs(array_y_higher[1,m-3]) >= (glob_large_float)) or (omniabs(array_y_higher[1,m-4]) >= (glob_large_float)) or (omniabs(array_y_higher[1,m-5]) >= (glob_large_float))) or ((omniabs(array_y_higher[1,m]) <= (glob_small_float)) or (omniabs(array_y_higher[1,m-1]) <=(glob_small_float)) or (omniabs(array_y_higher[1,m-2]) <= (glob_small_float)) or (omniabs(array_y_higher[1,m-3]) <= (glob_small_float)) or (omniabs(array_y_higher[1,m-4]) <= (glob_small_float)) or (omniabs(array_y_higher[1,m-5]) <= (glob_small_float)))) then ( /* if number 2*/
rad_c : glob_large_float,
ord_no : glob_large_float
) else (
rm0 : (array_y_higher[1,m])/(array_y_higher[1,m-1]),
rm1 : (array_y_higher[1,m-1])/(array_y_higher[1,m-2]),
rm2 : (array_y_higher[1,m-2])/(array_y_higher[1,m-3]),
rm3 : (array_y_higher[1,m-3])/(array_y_higher[1,m-4]),
rm4 : (array_y_higher[1,m-4])/(array_y_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 ((omniabs(nr1 * dr2 - nr2 * dr1) <= glob_small_float) or (omniabs(dr1) <= glob_small_float)) then ( /* if number 3*/
rad_c : glob_large_float,
ord_no : glob_large_float
) else (
if (omniabs(nr1*dr2 - nr2 * dr1) > glob_small_float) then ( /* if number 4*/
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 (omniabs(rcs) > glob_small_float) then ( /* if number 5*/
if (rcs > 0.0) then ( /* if number 6*/
rad_c : sqrt(rcs) * omniabs(glob_h)
) else (
rad_c : glob_large_float
)/* end if 6*/
) else (
rad_c : glob_large_float,
ord_no : glob_large_float
)/* end if 5*/
) else (
rad_c : glob_large_float,
ord_no : glob_large_float
)/* end if 4*/
)/* end if 3*/
,
array_complex_pole[1,1] : rad_c,
array_complex_pole[1,2] : ord_no
)/* end if 2*/
,
/* BOTTOM RADII COMPLEX EQ = 1 */
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 ( /* if number 2*/
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 ( /* if number 3*/
if (reached_interval()) then ( /* if number 4*/
omniout_str(ALWAYS,"Complex estimate of poles used")
)/* end if 4*/
)/* end if 3*/
)/* end if 2*/
,
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 ( /* if number 2*/
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 ( /* if number 3*/
if (reached_interval()) then ( /* if number 4*/
omniout_str(ALWAYS,"Real estimate of pole used")
)/* end if 4*/
)/* end if 3*/
)/* end if 2*/
,
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 ( /* if number 2*/
array_poles[1,1] : glob_large_float,
array_poles[1,2] : glob_large_float,
found : true,
array_type_pole[1] : 3,
if (reached_interval()) then ( /* if number 3*/
omniout_str(ALWAYS,"NO POLE")
)/* end if 3*/
)/* end if 2*/
,
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 ( /* if number 2*/
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 ( /* if number 3*/
if (reached_interval()) then ( /* if number 4*/
omniout_str(ALWAYS,"Real estimate of pole used")
)/* end if 4*/
)/* end if 3*/
)/* end if 2*/
,
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 ( /* if number 2*/
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 ( /* if number 3*/
if (reached_interval()) then ( /* if number 4*/
omniout_str(ALWAYS,"Complex estimate of poles used")
)/* end if 4*/
)/* end if 3*/
)/* end if 2*/
,
if ( not found ) then ( /* if number 2*/
array_poles[1,1] : glob_large_float,
array_poles[1,2] : glob_large_float,
array_type_pole[1] : 3,
if (reached_interval()) then ( /* if number 3*/
omniout_str(ALWAYS,"NO POLE")
)/* end if 3*/
)/* end if 2*/
,
/* BOTTOM WHICH RADII EQ = 1 */
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 ( /* if number 2*/
array_pole[1] : array_poles[1,1],
array_pole[2] : array_poles[1,2]
)/* end if 2*/
,
/* BOTTOM WHICH RADIUS EQ = 1 */
/* START ADJUST ALL SERIES */
if (array_pole[1] * glob_ratio_of_radius < omniabs(glob_h)) then ( /* if number 2*/
h_new : array_pole[1] * glob_ratio_of_radius,
term : 1,
ratio : 1.0,
while (term <= glob_max_terms) do ( /* do number 2*/
array_y[term] : array_y[term]* ratio,
array_y_higher[1,term] : array_y_higher[1,term]* ratio,
array_x[term] : array_x[term]* ratio,
ratio : ratio * h_new / omniabs(glob_h),
term : term + 1
)/* end do number 2*/
,
glob_h : h_new
)/* end if 2*/
,
/* BOTTOM ADJUST ALL SERIES */
if (reached_interval()) then ( /* if number 2*/
display_pole()
)/* end if 2*/
)
); /* End Function number10 */
/* Begin Function number 11*/
get_norms()
:= (
block([ iii],
if ( not glob_initial_pass) then ( /* if number 2*/
iii : 1,
while (iii <= glob_max_terms) do ( /* do number 2*/
array_norms[iii] : 0.0,
iii : iii + 1
)/* end do number 2*/
,
/* TOP GET NORMS */
iii : 1,
while (iii <= glob_max_terms) do ( /* do number 2*/
if (omniabs(array_y[iii]) > array_norms[iii]) then ( /* if number 3*/
array_norms[iii] : omniabs(array_y[iii])
)/* end if 3*/
,
iii : iii + 1
)/* end do number 2*/
/* BOTTOM GET NORMS */
)/* end if 2*/
)
); /* End Function number11 */
/* Begin Function number 12*/
atomall()
:= (
block([ kkk, order_d, adj2, adj3, temporary, term,temp,temp2],
/* TOP ATOMALL */
/* END OUTFILE1 */
/* BEGIN ATOMHDR1 */
/* emit pre sin 1 $eq_no = 1 */
array_tmp1[1] : sin(array_x[1]),
array_tmp1_g[1] : cos(array_x[1]),
/* emit pre add CONST FULL $eq_no = 1 i = 1 */
array_tmp2[1] : array_const_0D0[1] + array_tmp1[1],
/* emit pre assign xxx $eq_no = 1 i = 1 $min_hdrs = 5 */
if ( not array_y_set_initial[1,4]) then ( /* if number 1*/
if (1 <= glob_max_terms) then ( /* if number 2*/
temporary : array_tmp2[1] * expt(glob_h , (3)) * factorial_3(0,3),
array_y[4] : temporary,
array_y_higher[1,4] : temporary,
temporary : temporary / glob_h * (3.0),
array_y_higher[2,3] : temporary,
temporary : temporary / glob_h * (2.0),
array_y_higher[3,2] : temporary,
temporary : temporary / glob_h * (1.0),
array_y_higher[4,1] : temporary,
0
)/* end if 2*/
)/* end if 1*/
,
kkk : 2,
/* END ATOMHDR1 */
/* BEGIN ATOMHDR2 */
/* emit pre sin ID_LINEAR iii = 2 $eq_no = 1 */
array_tmp1[2] : array_tmp1_g[1] * array_x[2] / 1,
array_tmp1_g[2] : -array_tmp1[1] * array_x[2] / 1,
/* emit pre add CONST FULL $eq_no = 1 i = 2 */
array_tmp2[2] : array_tmp1[2],
/* emit pre assign xxx $eq_no = 1 i = 2 $min_hdrs = 5 */
if ( not array_y_set_initial[1,5]) then ( /* if number 1*/
if (2 <= glob_max_terms) then ( /* if number 2*/
temporary : array_tmp2[2] * expt(glob_h , (3)) * factorial_3(1,4),
array_y[5] : temporary,
array_y_higher[1,5] : temporary,
temporary : temporary / glob_h * (4.0),
array_y_higher[2,4] : temporary,
temporary : temporary / glob_h * (3.0),
array_y_higher[3,3] : temporary,
temporary : temporary / glob_h * (2.0),
array_y_higher[4,2] : temporary,
0
)/* end if 2*/
)/* end if 1*/
,
kkk : 3,
/* END ATOMHDR2 */
/* BEGIN ATOMHDR3 */
/* emit pre sin ID_LINEAR iii = 3 $eq_no = 1 */
array_tmp1[3] : array_tmp1_g[2] * array_x[2] / 2,
array_tmp1_g[3] : -array_tmp1[2] * array_x[2] / 2,
/* emit pre add CONST FULL $eq_no = 1 i = 3 */
array_tmp2[3] : array_tmp1[3],
/* emit pre assign xxx $eq_no = 1 i = 3 $min_hdrs = 5 */
if ( not array_y_set_initial[1,6]) then ( /* if number 1*/
if (3 <= glob_max_terms) then ( /* if number 2*/
temporary : array_tmp2[3] * expt(glob_h , (3)) * factorial_3(2,5),
array_y[6] : temporary,
array_y_higher[1,6] : temporary,
temporary : temporary / glob_h * (5.0),
array_y_higher[2,5] : temporary,
temporary : temporary / glob_h * (4.0),
array_y_higher[3,4] : temporary,
temporary : temporary / glob_h * (3.0),
array_y_higher[4,3] : temporary,
0
)/* end if 2*/
)/* end if 1*/
,
kkk : 4,
/* END ATOMHDR3 */
/* BEGIN ATOMHDR4 */
/* emit pre sin ID_LINEAR iii = 4 $eq_no = 1 */
array_tmp1[4] : array_tmp1_g[3] * array_x[2] / 3,
array_tmp1_g[4] : -array_tmp1[3] * array_x[2] / 3,
/* emit pre add CONST FULL $eq_no = 1 i = 4 */
array_tmp2[4] : array_tmp1[4],
/* emit pre assign xxx $eq_no = 1 i = 4 $min_hdrs = 5 */
if ( not array_y_set_initial[1,7]) then ( /* if number 1*/
if (4 <= glob_max_terms) then ( /* if number 2*/
temporary : array_tmp2[4] * expt(glob_h , (3)) * factorial_3(3,6),
array_y[7] : temporary,
array_y_higher[1,7] : temporary,
temporary : temporary / glob_h * (6.0),
array_y_higher[2,6] : temporary,
temporary : temporary / glob_h * (5.0),
array_y_higher[3,5] : temporary,
temporary : temporary / glob_h * (4.0),
array_y_higher[4,4] : temporary,
0
)/* end if 2*/
)/* end if 1*/
,
kkk : 5,
/* END ATOMHDR4 */
/* BEGIN ATOMHDR5 */
/* emit pre sin ID_LINEAR iii = 5 $eq_no = 1 */
array_tmp1[5] : array_tmp1_g[4] * array_x[2] / 4,
array_tmp1_g[5] : -array_tmp1[4] * array_x[2] / 4,
/* emit pre add CONST FULL $eq_no = 1 i = 5 */
array_tmp2[5] : array_tmp1[5],
/* emit pre assign xxx $eq_no = 1 i = 5 $min_hdrs = 5 */
if ( not array_y_set_initial[1,8]) then ( /* if number 1*/
if (5 <= glob_max_terms) then ( /* if number 2*/
temporary : array_tmp2[5] * expt(glob_h , (3)) * factorial_3(4,7),
array_y[8] : temporary,
array_y_higher[1,8] : temporary,
temporary : temporary / glob_h * (7.0),
array_y_higher[2,7] : temporary,
temporary : temporary / glob_h * (6.0),
array_y_higher[3,6] : temporary,
temporary : temporary / glob_h * (5.0),
array_y_higher[4,5] : temporary,
0
)/* end if 2*/
)/* end if 1*/
,
kkk : 6,
/* END ATOMHDR5 */
/* BEGIN OUTFILE3 */
/* Top Atomall While Loop-- outfile3 */
while (kkk <= glob_max_terms) do ( /* do number 1*/
/* END OUTFILE3 */
/* BEGIN OUTFILE4 */
/* emit sin LINEAR $eq_no = 1 */
array_tmp1[kkk] : array_tmp1_g[kkk - 1] * array_x[2] / (kkk - 1),
array_tmp1_g[kkk] : -array_tmp1[kkk - 1] * array_x[2] / (kkk - 1),
/* emit NOT FULL - FULL add $eq_no = 1 */
array_tmp2[kkk] : array_tmp1[kkk],
/* emit assign $eq_no = 1 */
order_d : 3,
if (kkk + order_d + 1 <= glob_max_terms) then ( /* if number 1*/
if ( not array_y_set_initial[1,kkk + order_d]) then ( /* if number 2*/
temporary : array_tmp2[kkk] * expt(glob_h , (order_d)) * factorial_3((kkk - 1),(kkk + order_d - 1)),
array_y[kkk + order_d] : temporary,
array_y_higher[1,kkk + order_d] : temporary,
term : kkk + order_d - 1,
adj2 : kkk + order_d - 1,
adj3 : 2,
while (term >= 1) do ( /* do number 2*/
if (adj3 <= order_d + 1) then ( /* if number 3*/
if (adj2 > 0) then ( /* if number 4*/
temporary : temporary / glob_h * convfp(adj2)
) else (
temporary : temporary
)/* end if 4*/
,
array_y_higher[adj3,term] : temporary
)/* end if 3*/
,
term : term - 1,
adj2 : adj2 - 1,
adj3 : adj3 + 1
)/* end do number 2*/
)/* end if 2*/
)/* end if 1*/
,
kkk : kkk + 1
)/* end do number 1*/
/* BOTTOM ATOMALL */
/* END OUTFILE4 */
/* BEGIN OUTFILE5 */
)
/* BOTTOM ATOMALL ??? */
); /* End Function number12 */
/* BEGIN ATS LIBRARY BLOCK */
log10(x) := (log(x)/log(10.0));
/* Begin Function number 2*/
omniout_str(iolevel,str) := (
if (glob_iolevel) >= iolevel then ( /* if number 1*/
printf(true,"~a~%",string(str))
)/* end if 1*/
); /* End Function number2 */
/* Begin Function number 3*/
omniout_str_noeol(iolevel,str) := (
if (glob_iolevel >= iolevel) then ( /* if number 1*/
printf(true,"~a",string(str))
)/* end if 1*/
); /* End Function number3 */
/* Begin Function number 4*/
omniout_labstr(iolevel,label,str) := (
if (glob_iolevel >= iolevel) then ( /* if number 1*/
printf(true,"~a = ~a~%",string(label),string(str))
)/* end if 1*/
); /* End Function number4 */
/* Begin Function number 5*/
omniout_float(iolevel,prelabel,prelen,value,vallen,postlabel) := (
if (glob_iolevel >= iolevel) then ( /* if number 1*/
if vallen = 4 then (
printf(true,"~a = ~g ~s ~%",prelabel,value, postlabel)
) else (
printf(true,"~a = ~g ~s ~%",prelabel,value, postlabel)
)/* end if 1*/
)/* end if 0*/
); /* End Function number5 */
omniout_int(iolevel,prelabel,prelen,value,vallen,postlabel) := (
if (glob_iolevel >= iolevel) then ( /* if number 0*/
printf(true,"~a = ~d ~a~%",prelabel,value, postlabel),
newline()
)/* end if 0*/
); /* End Function number5 */
/* Begin Function number 6*/
omniout_float_arr(iolevel,prelabel,elemnt,prelen,value,vallen,postlabel) := (
if (glob_iolevel >= iolevel) then ( /* if number 0*/
sprint(prelabel,"[",elemnt,"]=",value, postlabel),
newline()
)/* end if 0*/
); /* End Function number6 */
/*Function Start*/
/* Begin Function number 7*/
dump_series(iolevel,dump_label,series_name,arr_series,numb) := (
block([i],
if (glob_iolevel >= iolevel) then ( /* if number 0*/
i : 1,
while (i <= numb) do (
sprint(dump_label,series_name,"i = ",i,"series = ",array_series[i]),
newline(),
i : i + 1
)
)
)/* end if 0*/
); /* End Function number7 */
/* Begin Function number 8*/
dump_series_2(iolevel,dump_label,series_name2,arr_series2,numb,subnum,arr_x) := (
/*Function Start*/
array_series2,numb,subnum
) := (
block([i,sub,ts_term],
if (glob_iolevel >= iolevel) then ( /* if number 0*/
sub : 1,
while (sub <= subnum) do ( /* do number 1*/
i : 1,
while (i <= num) do ( /* do number 2*/
sprint(dump_label,series_name,"sub = ",sub,"i = ",i,"series2 = ",array_series2[sub,i]),
i : i + 1
)/* end do number 2*/
,
sub : sub + 1
)/* end do number 1*/
)/* end if 0*/
)
); /* End Function number8 */
/* Begin Function number 9*/
cs_info(iolevel,str) := (
if (glob_iolevel >= iolevel) then ( /* if number 0*/
sprint(concat("cs_info " , str , " glob_correct_start_flag = " , glob_correct_start_flag , "glob_h := " , glob_h , "glob_reached_optimal_h := " , glob_reached_optimal_h))
)/* end if 0*/
); /* End Function number9 */
logitem_time(fd,secs_in) := (
block([days, days_int, hours, hours_int, minutes, minutes_int, sec_int, seconds, secs, years, years_int],
secs : convfloat(secs_in),
printf(fd,"
~%"),
if (secs >= 0) then ( /* if number 0*/
years_int : trunc(secs / glob_sec_in_year),
sec_temp : mod(trunc(secs) , trunc(glob_sec_in_year)),
days_int : trunc(sec_temp / glob_sec_in_day) ,
sec_temp : mod(sec_temp , trunc(glob_sec_in_day)) ,
hours_int : trunc(sec_temp / glob_sec_in_hour),
sec_temp : mod(sec_temp , trunc(glob_sec_in_hour)),
minutes_int : trunc(sec_temp / glob_sec_in_minute),
sec_int : mod(sec_temp , trunc(glob_sec_in_minute)),
if (years_int > 0) then ( /* if number 1*/
printf(fd,"= ~d Years ~d Days ~d Hours ~d Minutes ~d Seconds~%",years_int,days_int,hours_int,minutes_int,sec_int)
) elseif
(days_int > 0) then ( /* if number 2*/
printf(fd,"= ~d Days ~d Hours ~d Minutes ~d Seconds~%",days_int,hours_int,minutes_int,sec_int)
) elseif
(hours_int > 0) then ( /* if number 3*/
printf(fd,"= ~d Hours ~d Minutes ~d Seconds~%",hours_int,minutes_int,sec_int)
) elseif
(minutes_int > 0) then ( /* if number 4*/
printf(fd,"= ~d Minutes ~d Seconds~%",minutes_int,sec_int)
) else (
printf(fd,"= ~d Seconds~%",sec_int)
)/* end if 4*/
) else (
printf(fd," Unknown~%")
)/* end if 3*/
,
printf(fd," | ~%")
)
); /* End Function number9 */
/* Begin Function number 10*/
omniout_timestr(secs_in) := (
block([days, days_int, hours, hours_int, minutes, minutes_int, sec_int, seconds, secs, years, years_int],
secs : convfloat(secs_in),
if (secs >= 0) then ( /* if number 3*/
years_int : trunc(secs / glob_sec_in_year),
sec_temp : mod(trunc(secs) , trunc(glob_sec_in_year)),
days_int : trunc(sec_temp / glob_sec_in_day) ,
sec_temp : mod(sec_temp , trunc(glob_sec_in_day)) ,
hours_int : trunc(sec_temp / glob_sec_in_hour),
sec_temp : mod(sec_temp , trunc(glob_sec_in_hour)),
minutes_int : trunc(sec_temp / glob_sec_in_minute),
sec_int : mod(sec_temp , trunc(glob_sec_in_minute)),
if (years_int > 0) then ( /* if number 4*/
printf(true,"= ~d Years ~d Days ~d Hours ~d Minutes ~d Seconds~%",years_int,days_int,hours_int,minutes_int,sec_int)
) elseif
(days_int > 0) then ( /* if number 5*/
printf(true,"= ~d Days ~d Hours ~d Minutes ~d Seconds~%",days_int,hours_int,minutes_int,sec_int)
) elseif
(hours_int > 0) then ( /* if number 6*/
printf(true,"= ~d Hours ~d Minutes ~d Seconds~%",hours_int,minutes_int,sec_int)
) elseif
(minutes_int > 0) then ( /* if number 7*/
printf(true,"= ~d Minutes ~d Seconds~%",minutes_int,sec_int)
) else (
printf(true,"= ~d Seconds~%",sec_int)
)/* end if 7*/
) else (
printf(true," Unknown~%")
)/* end if 6*/
)
); /* End Function number10 */
/* Begin Function number 11*/
ats(mmm_ats,arr_a,arr_b,jjj_ats) := (
block([ iii_ats, lll_ats,ma_ats, ret_ats],
ret_ats : 0.0,
if (jjj_ats <= mmm_ats) then ( /* if number 6*/
ma_ats : mmm_ats + 1,
iii_ats : jjj_ats,
while (iii_ats <= mmm_ats) do ( /* do number 1*/
lll_ats : ma_ats - iii_ats,
ret_ats : ret_ats + arr_a[iii_ats]*arr_b[lll_ats],
iii_ats : iii_ats + 1
)/* end do number 1*/
)/* end if 6*/
,
ret_ats
)
); /* End Function number11 */
/* Begin Function number 12*/
att(mmm_att,arr_aa,arr_bb,jjj_att) := (
block([ al_att, iii_att,lll_att, ma_att, ret_att],
ret_att : 0.0,
if (jjj_att <= mmm_att) then ( /* if number 6*/
ma_att : mmm_att + 2,
iii_att : jjj_att,
while (iii_att <= mmm_att) do ( /* do number 1*/
lll_att : ma_att - iii_att,
al_att : (lll_att - 1),
if (lll_att <= glob_max_terms) then ( /* if number 7*/
ret_att : ret_att + arr_aa[iii_att]*arr_bb[lll_att]* convfp(al_att)
)/* end if 7*/
,
iii_att : iii_att + 1
)/* end do number 1*/
,
ret_att : ret_att / convfp(mmm_att)
)/* end if 6*/
,
ret_att
)
); /* End Function number12 */
/* Begin Function number 13*/
display_pole() := (
if ((array_pole[1] # glob_large_float) and (array_pole[1] > 0.0) and (array_pole[2] # glob_large_float) and (array_pole[2]> 0.0) and glob_display_flag) then ( /* if number 6*/
omniout_float(ALWAYS,"Radius of convergence ",4, array_pole[1],4," "),
omniout_float(ALWAYS,"Order of pole ",4, array_pole[2],4," ")
)/* end if 6*/
); /* End Function number13 */
/* Begin Function number 14*/
logditto(file) := (
printf(file,""),
printf(file,"ditto"),
printf(file," | ")
); /* End Function number14 */
/* Begin Function number 15*/
logitem_integer(file,n) := (
printf(file,""),
printf(file,"~d",n),
printf(file," | ")
); /* End Function number15 */
/* Begin Function number 16*/
logitem_str(file,str) := (
printf(file,""),
printf(file,str),
printf(file," | ")
); /* End Function number16 */
/* Begin Function number 17*/
logitem_good_digits(file,rel_error) := (
block([good_digits],
printf(file,""),
if (rel_error # -1.0) then ( /* if number 6*/
if (rel_error > + 0.0000000000000000000000000000000001) then ( /* if number 7*/
good_digits : 1-floor(log10(rel_error)),
printf(file,"~d",good_digits)
) else (
good_digits : 16,
printf(file,"~d",good_digits)
)/* end if 7*/
) else (
printf(file,"Unknown")
)/* end if 6*/
,
printf(file," | ")
)
); /* End Function number17 */
/* Begin Function number 18*/
log_revs(file,revs) := (
printf(file,revs)
); /* End Function number18 */
/* Begin Function number 19*/
logitem_float(file,x) := (
printf(file,""),
printf(file,"~g",x),
printf(file," | ")
); /* End Function number19 */
/* Begin Function number 20*/
logitem_pole(file,pole) := (
printf(file,""),
if pole = 0 then ( /* if number 6*/
printf(file,"NA")
) elseif
pole = 1 then ( /* if number 7*/
printf(file,"Real")
) elseif
pole = 2 then ( /* if number 8*/
printf(file,"Complex")
) else (
printf(file,"No Pole")
)/* end if 8*/
,
printf(file," | ")
); /* End Function number20 */
/* Begin Function number 21*/
logstart(file) := (
printf(file,"")
); /* End Function number21 */
/* Begin Function number 22*/
logend(file) := (
printf(file,"
~%")
); /* End Function number22 */
/* Begin Function number 23*/
chk_data() := (
block([ errflag],
errflag : false,
if ((glob_max_terms < 15) or (glob_max_terms > 512)) then ( /* if number 8*/
omniout_str(ALWAYS,"Illegal max_terms = -- Using 30"),
glob_max_terms : 30
)/* end if 8*/
,
if (glob_max_iter < 2) then ( /* if number 8*/
omniout_str(ALWAYS,"Illegal max_iter"),
errflag : true
)/* end if 8*/
,
if (errflag) then ( /* if number 8*/
quit()
)/* end if 8*/
)
); /* End Function number23 */
/* Begin Function number 24*/
comp_expect_sec(t_end2,t_start2,t2,clock_sec2) := (
block([ ms2, rrr, sec_left, sub1, sub2],
ms2 : clock_sec2,
sub1 : (t_end2-t_start2),
sub2 : (t2-t_start2),
if (sub1 = 0.0) then ( /* if number 8*/
sec_left : 0.0
) else (
if (sub2 > 0.0) then ( /* if number 9*/
rrr : (sub1/sub2),
sec_left : rrr * ms2 - ms2
) else (
sec_left : 0.0
)/* end if 9*/
)/* end if 8*/
,
sec_left
)
); /* End Function number24 */
/* Begin Function number 25*/
comp_percent(t_end2,t_start2, t2) := (
block([ rrr, sub1, sub2],
sub1 : (t_end2-t_start2),
sub2 : (t2-t_start2),
if (sub2 > glob_small_float) then ( /* if number 8*/
rrr : (100.0*sub2)/sub1
) else (
rrr : 0.0
)/* end if 8*/
,
rrr
)
); /* End Function number25 */
/* Begin Function number 26*/
factorial_2(nnn) := (
nnn!
); /* End Function number26 */
/* Begin Function number 27*/
factorial_1(nnn) := (
block([ ret],
if (nnn <= glob_max_terms) then ( /* if number 8*/
if (array_fact_1[nnn] = 0) then ( /* if number 9*/
ret : factorial_2(nnn),
array_fact_1[nnn] : ret
) else (
ret : array_fact_1[nnn]
)/* end if 9*/
) else (
ret : factorial_2(nnn)
)/* end if 8*/
,
ret
)
); /* End Function number27 */
/* Begin Function number 28*/
factorial_3(mmm,nnn) := (
block([ ret],
if ((nnn <= glob_max_terms) and (mmm <= glob_max_terms)) then ( /* if number 8*/
if (array_fact_2[mmm,nnn] = 0) then ( /* if number 9*/
ret : factorial_1(mmm)/factorial_1(nnn),
array_fact_2[mmm,nnn] : ret
) else (
ret : array_fact_2[mmm,nnn]
)/* end if 9*/
) else (
ret : factorial_2(mmm)/factorial_2(nnn)
)/* end if 8*/
,
ret
)
); /* End Function number28 */
/* Begin Function number 29*/
convfp(mmm) := (
(mmm)
); /* End Function number29 */
/* Begin Function number 30*/
convfloat(mmm) := (
(mmm)
); /* End Function number30 */
/* Begin Function number 31*/
elapsed_time_seconds() := (
block([t],
t: elapsed_real_time(),
t)
); /* End Function number31 */
/* Begin Function number 32*/
Si(x) := (
0.0
); /* End Function number32 */
/* Begin Function number 33*/
Ci(x) := (
0.0
); /* End Function number33 */
/* Begin Function number 34*/
ln(x) := (
log(x)
); /* End Function number34 */
/* Begin Function number 35*/
arcsin(x) := (
asin(x)
); /* End Function number35 */
/* Begin Function number 36*/
arccos(x) := (
acos(x)
); /* End Function number36 */
/* Begin Function number 37*/
arctan(x) := (
atan(x)
); /* End Function number37 */
/* Begin Function number 38*/
omniabs(x) := (
abs(x)
); /* End Function number38 */
/* Begin Function number 39*/
expt(x,y) := (
if ((x = 0.0) and (y < 0.0)) then ( /* if number 8*/
print("expt error x = ",x,"y = ",y)
)/* end if 8*/
,
(x^y)
); /* End Function number39 */
/* Begin Function number 40*/
estimated_needed_step_error(x_start,x_end,estimated_h,estimated_answer) := (
block ([ desired_abs_gbl_error,range,estimated_steps,step_error],
omniout_float(ALWAYS,"glob_desired_digits_correct",32,glob_desired_digits_correct,32,""),
desired_abs_gbl_error : expt(10.0,- glob_desired_digits_correct) * omniabs(estimated_answer),
omniout_float(ALWAYS,"desired_abs_gbl_error",32,desired_abs_gbl_error,32,""),
range : (x_end - x_start),
omniout_float(ALWAYS,"range",32,range,32,""),
estimated_steps : range / estimated_h,
omniout_float(ALWAYS,"estimated_steps",32,estimated_steps,32,""),
step_error : omniabs(desired_abs_gbl_error / estimated_steps),
omniout_float(ALWAYS,"step_error",32,step_error,32,""),
(step_error)
)
); /* End Function number40 */
/* END ATS LIBRARY BLOCK */
/* BEGIN USER DEF BLOCK */
/* BEGIN USER DEF BLOCK */
exact_soln_y (x) := (block(
(1.0 + cos(x))
));
exact_soln_yp (x) := (block(
(-sin(x))
));
exact_soln_ypp (x) := (block(
(-cos(x))
));
/* END USER DEF BLOCK */
/* END USER DEF BLOCK */
/* END OUTFILE5 */
/* Begin Function number 2*/
main() := (
/* BEGIN OUTFIEMAIN */
block([ d1,d2,d3,d4,est_err_2,niii,done_once,
term,ord,order_diff,term_no,html_log_file,iiif,jjjf,
rows,r_order,sub_iter,calc_term,iii,temp_sum,current_iter,
x_start,x_end
,it, log10norm, max_terms, opt_iter, tmp,subiter, est_needed_step_err,value3,min_value,est_answer,best_h,found_h,repeat_it],
define_variable(glob_max_terms,30,fixnum ),
define_variable(glob_iolevel,5,fixnum ),
define_variable(ALWAYS,1,fixnum ),
define_variable(INFO,2,fixnum ),
define_variable(DEBUGL,3,fixnum ),
define_variable(DEBUGMASSIVE,4,fixnum ),
/* Top Generate Globals Definition */
define_variable(MAX_UNCHANGED,10,fixnum ),
define_variable(glob_check_sign,1.0,float ),
define_variable(glob_desired_digits_correct,8.0,float ),
define_variable(glob_max_value3,0.0,float ),
define_variable(glob_ratio_of_radius,0.01,float ),
define_variable(glob_percent_done,0.0,float ),
define_variable(glob_subiter_method,3,fixnum ),
define_variable(glob_log10normmin,0.1,float ),
define_variable(glob_total_exp_sec,0.1,float ),
define_variable(glob_optimal_expect_sec,0.1,float ),
define_variable(glob_html_log,true,boolean ),
define_variable(glob_good_digits,0,fixnum ),
define_variable(glob_max_opt_iter,10,fixnum ),
define_variable(glob_dump,false,boolean ),
define_variable(glob_djd_debug,true,boolean ),
define_variable(glob_display_flag,true,boolean ),
define_variable(glob_djd_debug2,true,boolean ),
define_variable(glob_sec_in_minute,60,fixnum ),
define_variable(glob_min_in_hour,60,fixnum ),
define_variable(glob_hours_in_day,24,fixnum ),
define_variable(glob_days_in_year,365,fixnum ),
define_variable(glob_sec_in_hour,3600,fixnum ),
define_variable(glob_sec_in_day,86400,fixnum ),
define_variable(glob_sec_in_year,31536000,fixnum ),
define_variable(glob_almost_1,0.9990,float ),
define_variable(glob_clock_sec,0.0,float ),
define_variable(glob_clock_start_sec,0.0,float ),
define_variable(glob_not_yet_finished,true,boolean ),
define_variable(glob_initial_pass,true,boolean ),
define_variable(glob_not_yet_start_msg,true,boolean ),
define_variable(glob_reached_optimal_h,false,boolean ),
define_variable(glob_optimal_done,false,boolean ),
define_variable(glob_disp_incr,0.1,float ),
define_variable(glob_h,0.1,float ),
define_variable(glob_hmax,1.0,float ),
define_variable(glob_hmin,0.00000000001,float ),
define_variable(glob_hmin_init,0.001,float ),
define_variable(glob_large_float,9.0e100,float ),
define_variable(glob_last_good_h,0.1,float ),
define_variable(glob_look_poles,false,boolean ),
define_variable(glob_neg_h,false,boolean ),
define_variable(glob_display_interval,0.0,float ),
define_variable(glob_next_display,0.0,float ),
define_variable(glob_dump_analytic,false,boolean ),
define_variable(glob_log10_abserr,0.1e-10,float ),
define_variable(glob_log10_relerr,0.1e-10,float ),
define_variable(glob_abserr,0.1e-10,float ),
define_variable(glob_relerr,0.1e-10,float ),
define_variable(glob_max_hours,0.0,float ),
define_variable(glob_max_iter,1000,fixnum ),
define_variable(glob_max_rel_trunc_err,0.1e-10,float ),
define_variable(glob_max_trunc_err,0.1e-10,float ),
define_variable(glob_no_eqs,0,fixnum ),
define_variable(glob_optimal_clock_start_sec,0.0,float ),
define_variable(glob_optimal_start,0.0,float ),
define_variable(glob_small_float,0.1e-50,float ),
define_variable(glob_smallish_float,0.1e-100,float ),
define_variable(glob_unchanged_h_cnt,0,fixnum ),
define_variable(glob_warned,false,boolean ),
define_variable(glob_warned2,false,boolean ),
define_variable(glob_max_sec,10000.0,float ),
define_variable(glob_orig_start_sec,0.0,float ),
define_variable(glob_start,0,fixnum ),
define_variable(glob_curr_iter_when_opt,0,fixnum ),
define_variable(glob_current_iter,0,fixnum ),
define_variable(glob_iter,0,fixnum ),
define_variable(glob_normmax,0.0,float ),
define_variable(glob_log10abserr,0.0,float ),
define_variable(glob_log10relerr,0.0,float ),
define_variable(glob_max_minutes,0.0,float ),
/* Bottom Generate Globals Deninition */
ALWAYS : 1,
INFO : 2,
DEBUGL : 3,
DEBUGMASSIVE : 4,
glob_iolevel : INFO,
/* Write Set Defaults */
glob_orig_start_sec : elapsed_time_seconds(),
MAX_UNCHANGED : 10,
glob_curr_iter_when_opt : 0,
glob_display_flag : true,
glob_no_eqs : 1,
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/h3sinpostode.ode#################"),
omniout_str(ALWAYS,"diff ( y , x , 3 ) = sin(x);"),
omniout_str(ALWAYS,"!"),
omniout_str(ALWAYS,"/* BEGIN FIRST INPUT BLOCK */"),
omniout_str(ALWAYS,"Digits:32,"),
omniout_str(ALWAYS,"max_terms:30,"),
omniout_str(ALWAYS,"!"),
omniout_str(ALWAYS,"/* END FIRST INPUT BLOCK */"),
omniout_str(ALWAYS,"/* BEGIN SECOND INPUT BLOCK */"),
omniout_str(ALWAYS,"x_start:0.1,"),
omniout_str(ALWAYS,"x_end:5.0,"),
omniout_str(ALWAYS,"array_y_init[0 + 1] : exact_soln_y(x_start),"),
omniout_str(ALWAYS,"array_y_init[1 + 1] : exact_soln_yp(x_start),"),
omniout_str(ALWAYS,"array_y_init[2 + 1] : exact_soln_ypp(x_start),"),
omniout_str(ALWAYS,"glob_h:0.00001,"),
omniout_str(ALWAYS,"glob_look_poles:true,"),
omniout_str(ALWAYS,"glob_max_iter:20,"),
omniout_str(ALWAYS,"/* END SECOND INPUT BLOCK */"),
omniout_str(ALWAYS,"/* BEGIN OVERRIDE BLOCK */"),
omniout_str(ALWAYS,"glob_desired_digits_correct:10,"),
omniout_str(ALWAYS,"glob_display_interval:0.001,"),
omniout_str(ALWAYS,"glob_look_poles:true,"),
omniout_str(ALWAYS,"glob_max_iter:10000000,"),
omniout_str(ALWAYS,"glob_max_minutes:3,"),
omniout_str(ALWAYS,"glob_subiter_method:3,"),
omniout_str(ALWAYS,"/* END OVERRIDE BLOCK */"),
omniout_str(ALWAYS,"!"),
omniout_str(ALWAYS,"/* BEGIN USER DEF BLOCK */"),
omniout_str(ALWAYS,"exact_soln_y (x) := (block("),
omniout_str(ALWAYS," (1.0 + cos(x)) "),
omniout_str(ALWAYS,"));"),
omniout_str(ALWAYS,"exact_soln_yp (x) := (block("),
omniout_str(ALWAYS," (-sin(x)) "),
omniout_str(ALWAYS,"));"),
omniout_str(ALWAYS,"exact_soln_ypp (x) := (block("),
omniout_str(ALWAYS," (-cos(x)) "),
omniout_str(ALWAYS,"));"),
omniout_str(ALWAYS,"/* END USER DEF BLOCK */"),
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 */
/* 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(array_y_init,max_terms+ 1),
array(array_norms,max_terms+ 1),
array(array_fact_1,max_terms+ 1),
array(array_pole,max_terms+ 1),
array(array_1st_rel_error,max_terms+ 1),
array(array_last_rel_error,max_terms+ 1),
array(array_type_pole,max_terms+ 1),
array(array_y,max_terms+ 1),
array(array_x,max_terms+ 1),
array(array_tmp0,max_terms+ 1),
array(array_tmp1_g,max_terms+ 1),
array(array_tmp1,max_terms+ 1),
array(array_tmp2,max_terms+ 1),
array(array_m1,max_terms+ 1),
array(array_y_higher,4+ 1,max_terms+ 1),
array(array_y_higher_work,4+ 1,max_terms+ 1),
array(array_y_higher_work2,4+ 1,max_terms+ 1),
array(array_y_set_initial,2+ 1,max_terms+ 1),
array(array_poles,1+ 1,3+ 1),
array(array_real_pole,1+ 1,3+ 1),
array(array_complex_pole,1+ 1,3+ 1),
array(array_fact_2,max_terms+ 1,max_terms+ 1),
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_y_init[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_norms[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_fact_1[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_pole[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_1st_rel_error[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_last_rel_error[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_type_pole[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_y[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_x[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_tmp0[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_tmp1_g[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_tmp1[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_tmp2[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_m1[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=4) do ( /* do number 2*/
term : 1,
while (term <= max_terms) do ( /* do number 3*/
array_y_higher[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=4) do ( /* do number 2*/
term : 1,
while (term <= max_terms) do ( /* do number 3*/
array_y_higher_work[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=4) do ( /* do number 2*/
term : 1,
while (term <= max_terms) do ( /* do number 3*/
array_y_higher_work2[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=2) do ( /* do number 2*/
term : 1,
while (term <= max_terms) do ( /* do number 3*/
array_y_set_initial[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=1) do ( /* do number 2*/
term : 1,
while (term <= 3) do ( /* do number 3*/
array_poles[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=1) do ( /* do number 2*/
term : 1,
while (term <= 3) do ( /* do number 3*/
array_real_pole[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=1) do ( /* do number 2*/
term : 1,
while (term <= 3) do ( /* do number 3*/
array_complex_pole[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
ord : 1,
while (ord <=max_terms) do ( /* do number 2*/
term : 1,
while (term <= max_terms) do ( /* do number 3*/
array_fact_2[ord,term] : 0.0,
term : term + 1
)/* end do number 3*/
,
ord : ord + 1
)/* end do number 2*/
,
/* BEGIN ARRAYS DEFINED AND INITIALIZATED */
array(array_y,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_y[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array(array_x,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_x[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array(array_tmp0,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_tmp0[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array(array_tmp1_g,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_tmp1_g[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array(array_tmp1,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_tmp1[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array(array_tmp2,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_tmp2[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array(array_m1,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_m1[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array(array_const_3,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_const_3[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array_const_3[1] : 3,
array(array_const_0D0,max_terms+1 + 1),
term : 1,
while (term <= max_terms + 1) do ( /* do number 2*/
array_const_0D0[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array_const_0D0[1] : 0.0,
array(array_m1,max_terms+1 + 1),
term : 1,
while (term <= max_terms) do ( /* do number 2*/
array_m1[term] : 0.0,
term : term + 1
)/* end do number 2*/
,
array_m1[1] : -1.0,
/* END ARRAYS DEFINED AND INITIALIZATED */
/* Initing Factorial Tables */
iiif : 0,
while (iiif <= glob_max_terms) do ( /* do number 2*/
jjjf : 0,
while (jjjf <= glob_max_terms) do ( /* do number 3*/
array_fact_1[iiif] : 0,
array_fact_2[iiif,jjjf] : 0,
jjjf : jjjf + 1
)/* end do number 3*/
,
iiif : iiif + 1
)/* end do number 2*/
,
/* Done Initing Factorial Tables */
/* TOP SECOND INPUT BLOCK */
/* BEGIN SECOND INPUT BLOCK */
/* END FIRST INPUT BLOCK */
/* BEGIN SECOND INPUT BLOCK */
x_start:0.1,
x_end:5.0,
array_y_init[0 + 1] : exact_soln_y(x_start),
array_y_init[1 + 1] : exact_soln_yp(x_start),
array_y_init[2 + 1] : exact_soln_ypp(x_start),
glob_h:0.00001,
glob_look_poles:true,
glob_max_iter:20,
/* END SECOND INPUT BLOCK */
/* BEGIN OVERRIDE BLOCK */
glob_desired_digits_correct:10,
glob_display_interval:0.001,
glob_look_poles:true,
glob_max_iter:10000000,
glob_max_minutes:3,
glob_subiter_method:3,
/* END OVERRIDE BLOCK */
/* 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 : expt(10.0 , (glob_log10_abserr)),
glob_relerr : expt(10.0 , (glob_log10_relerr)),
if (glob_h > 0.0) then ( /* if number 1*/
glob_neg_h : false,
glob_display_interval : omniabs(glob_display_interval)
) else (
glob_neg_h : true,
glob_display_interval : -omniabs(glob_display_interval)
)/* end if 1*/
,
chk_data(),
/* AFTER INITS AFTER SECOND INPUT BLOCK */
array_y_set_initial[1,1] : true,
array_y_set_initial[1,2] : true,
array_y_set_initial[1,3] : true,
array_y_set_initial[1,4] : false,
array_y_set_initial[1,5] : false,
array_y_set_initial[1,6] : false,
array_y_set_initial[1,7] : false,
array_y_set_initial[1,8] : false,
array_y_set_initial[1,9] : false,
array_y_set_initial[1,10] : false,
array_y_set_initial[1,11] : false,
array_y_set_initial[1,12] : false,
array_y_set_initial[1,13] : false,
array_y_set_initial[1,14] : false,
array_y_set_initial[1,15] : false,
array_y_set_initial[1,16] : false,
array_y_set_initial[1,17] : false,
array_y_set_initial[1,18] : false,
array_y_set_initial[1,19] : false,
array_y_set_initial[1,20] : false,
array_y_set_initial[1,21] : false,
array_y_set_initial[1,22] : false,
array_y_set_initial[1,23] : false,
array_y_set_initial[1,24] : false,
array_y_set_initial[1,25] : false,
array_y_set_initial[1,26] : false,
array_y_set_initial[1,27] : false,
array_y_set_initial[1,28] : false,
array_y_set_initial[1,29] : false,
array_y_set_initial[1,30] : false,
/* BEGIN OPTIMIZE CODE */
omniout_str(ALWAYS,"START of Optimize"),
/* Start Series -- INITIALIZE FOR OPTIMIZE */
glob_check_sign : check_sign(x_start,x_end),
glob_h : check_sign(x_start,x_end),
if (glob_display_interval < glob_h) then ( /* if number 2*/
glob_h : glob_display_interval
)/* end if 2*/
,
found_h : -1.0,
best_h : 0.0,
min_value : glob_large_float,
est_answer : est_size_answer(),
opt_iter : 1,
while ((opt_iter <= 20) and (found_h < 0.0)) do ( /* do number 2*/
omniout_int(ALWAYS,"opt_iter",32,opt_iter,4,""),
array_x[1] : x_start,
array_x[2] : glob_h,
glob_next_display : x_start,
order_diff : 3,
/* Start Series array_y */
term_no : 1,
while (term_no <= order_diff) do ( /* do number 3*/
array_y[term_no] : array_y_init[term_no] * expt(glob_h , (term_no - 1)) / factorial_1(term_no - 1),
term_no : term_no + 1
)/* end do number 3*/
,
rows : order_diff,
r_order : 1,
while (r_order <= rows) do ( /* do number 3*/
term_no : 1,
while (term_no <= (rows - r_order + 1)) do ( /* do number 4*/
it : term_no + r_order - 1,
array_y_higher[r_order,term_no] : array_y_init[it]* expt(glob_h , (term_no - 1)) / ((factorial_1(term_no - 1))),
term_no : term_no + 1
)/* end do number 4*/
,
r_order : r_order + 1
)/* end do number 3*/
,
atomall(),
est_needed_step_err : estimated_needed_step_error(x_start,x_end,glob_h,est_answer),
omniout_float(ALWAYS,"est_needed_step_err",32,est_needed_step_err,16,""),
value3 : test_suggested_h(),
omniout_float(ALWAYS,"value3",32,value3,32,""),
if ((value3 < est_needed_step_err) and (found_h < 0.0)) then ( /* if number 2*/
best_h : glob_h,
found_h : 1.0
)/* end if 2*/
,
omniout_float(ALWAYS,"best_h",32,best_h,32,""),
opt_iter : opt_iter + 1,
glob_h : glob_h * 0.5
)/* end do number 2*/
,
if (found_h > 0.0) then ( /* if number 2*/
glob_h : best_h
) else (
omniout_str(ALWAYS,"No increment to obtain desired accuracy found")
)/* end if 2*/
,
/* END OPTIMIZE CODE */
if (glob_html_log) then ( /* if number 2*/
html_log_file : openw("html/entry.html")
)/* end if 2*/
,
/* BEGIN SOLUTION CODE */
if (found_h > 0.0) then ( /* if number 2*/
omniout_str(ALWAYS,"START of Soultion"),
/* Start Series -- INITIALIZE FOR SOLUTION */
array_x[1] : x_start,
array_x[2] : glob_h,
glob_next_display : x_start,
order_diff : 3,
/* Start Series array_y */
term_no : 1,
while (term_no <= order_diff) do ( /* do number 2*/
array_y[term_no] : array_y_init[term_no] * expt(glob_h , (term_no - 1)) / factorial_1(term_no - 1),
term_no : term_no + 1
)/* end do number 2*/
,
rows : order_diff,
r_order : 1,
while (r_order <= rows) do ( /* do number 2*/
term_no : 1,
while (term_no <= (rows - r_order + 1)) do ( /* do number 3*/
it : term_no + r_order - 1,
array_y_higher[r_order,term_no] : array_y_init[it]* expt(glob_h , (term_no - 1)) / ((factorial_1(term_no - 1))),
term_no : term_no + 1
)/* end do number 3*/
,
r_order : r_order + 1
)/* end do number 2*/
,
current_iter : 1,
glob_clock_start_sec : elapsed_time_seconds(),
glob_log10normmin : -glob_large_float ,
if (omniabs(array_y_higher[1,1]) > glob_small_float) then ( /* if number 3*/
tmp : omniabs(array_y_higher[1,1]),
log10norm : (log10(tmp)),
if (log10norm < glob_log10normmin) then ( /* if number 4*/
glob_log10normmin : log10norm
)/* end if 4*/
)/* end if 3*/
,
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 ((glob_check_sign * array_x[1]) < (glob_check_sign * x_end )) and ((convfloat(glob_clock_sec) - convfloat(glob_orig_start_sec)) < convfloat(glob_max_sec))) do ( /* do number 2*/
/* left paren 0001C */
if (reached_interval()) then ( /* if number 3*/
omniout_str(INFO," "),
omniout_str(INFO,"TOP MAIN SOLVE Loop")
)/* end if 3*/
,
glob_iter : glob_iter + 1,
glob_clock_sec : elapsed_time_seconds(),
glob_current_iter : glob_current_iter + 1,
atomall(),
display_alot(current_iter),
if (glob_look_poles) then ( /* if number 3*/
/* left paren 0004C */
check_for_pole()
)/* end if 3*/
,/* was right paren 0004C */
if (reached_interval()) then ( /* if number 3*/
glob_next_display : glob_next_display + glob_display_interval
)/* end if 3*/
,
array_x[1] : array_x[1] + glob_h,
array_x[2] : glob_h
/* Jump Series array_y */,
order_diff : 4,
/* START PART 1 SUM AND ADJUST */
/* START SUM AND ADJUST EQ =1 */
/* sum_and_adjust array_y */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 4,
calc_term : 1,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[4,iii] : array_y_higher[4,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 4,
calc_term : 1,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 3,
calc_term : 2,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[3,iii] : array_y_higher[3,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 3,
calc_term : 2,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 3,
calc_term : 1,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[3,iii] : array_y_higher[3,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 3,
calc_term : 1,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 2,
calc_term : 3,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[2,iii] : array_y_higher[2,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 2,
calc_term : 3,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 2,
calc_term : 2,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[2,iii] : array_y_higher[2,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 2,
calc_term : 2,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 2,
calc_term : 1,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[2,iii] : array_y_higher[2,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 2,
calc_term : 1,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 1,
calc_term : 4,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[1,iii] : array_y_higher[1,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 1,
calc_term : 4,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 1,
calc_term : 3,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[1,iii] : array_y_higher[1,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 1,
calc_term : 3,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 1,
calc_term : 2,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[1,iii] : array_y_higher[1,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 1,
calc_term : 2,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(calc_term - 1)),
/* AFTER SUM SUBSERIES EQ =1 */
/* BEFORE ADJUST SUBSERIES EQ =1 */
ord : 1,
calc_term : 1,
/* adjust_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
array_y_higher_work[1,iii] : array_y_higher[1,iii] / expt(glob_h , (calc_term - 1)) / factorial_3(iii - calc_term , iii - 1),
iii : iii - 1
)/* end do number 3*/
,
/* AFTER ADJUST SUBSERIES EQ =1 */
/* BEFORE SUM SUBSERIES EQ =1 */
temp_sum : 0.0,
ord : 1,
calc_term : 1,
/* sum_subseriesarray_y */
iii : glob_max_terms,
while (iii >= calc_term) do ( /* do number 3*/
temp_sum : temp_sum + array_y_higher_work[ord,iii],
iii : iii - 1
)/* end do number 3*/
,
array_y_higher_work2[ord,calc_term] : temp_sum * expt(glob_h , (calc_term - 1)) / (factorial_1(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 ( /* do number 3*/
array_y[term_no] : array_y_higher_work2[1,term_no],
ord : 1,
while (ord <= order_diff) do ( /* do number 4*/
array_y_higher[ord,term_no] : array_y_higher_work2[ord,term_no],
ord : ord + 1
)/* end do number 4*/
,
term_no : term_no - 1
)/* end do number 3*/
/* END PART 2 HEVE MOVED TERMS to REGULAR Array */
)/* end do number 2*/
,/* right paren 0001C */
omniout_str(ALWAYS,"Finished!"),
if (glob_iter >= glob_max_iter) then ( /* if number 3*/
omniout_str(ALWAYS,"Maximum Iterations Reached before Solution Completed!")
)/* end if 3*/
,
if (elapsed_time_seconds() - convfloat(glob_orig_start_sec) >= convfloat(glob_max_sec )) then ( /* if number 3*/
omniout_str(ALWAYS,"Maximum Time Reached before Solution Completed!")
)/* end if 3*/
,
glob_clock_sec : elapsed_time_seconds(),
omniout_str(INFO,"diff ( y , x , 3 ) = sin(x);"),
omniout_int(INFO,"Iterations ",32,glob_iter,4," ")
,
prog_report(x_start,x_end),
if (glob_html_log) then ( /* if number 3*/
logstart(html_log_file),
logitem_str(html_log_file,"2013-01-12T23:33:30-06:00")
,
logitem_str(html_log_file,"Maxima")
,
logitem_str(html_log_file,"h3sin")
,
logitem_str(html_log_file,"diff ( y , x , 3 ) = sin(x);")
,
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_str(html_log_file,"16")
,
logitem_good_digits(html_log_file,array_last_rel_error[1])
,
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 ( /* if number 4*/
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 4*/
,
logitem_time(html_log_file,convfloat(glob_clock_sec))
,
if (glob_percent_done < 100.0) then ( /* if number 4*/
logitem_time(html_log_file,convfloat(glob_total_exp_sec))
,
0
) else (
logitem_str(html_log_file,"Done")
,
0
)/* end if 4*/
,
log_revs(html_log_file," 156 | ")
,
logitem_str(html_log_file,"h3sin diffeq.max")
,
logitem_str(html_log_file,"h3sin maxima results")
,
logitem_str(html_log_file,"Languages compared - single equations")
,
logend(html_log_file)
)/* end if 3*/
,
if (glob_html_log) then ( /* if number 3*/
close(html_log_file)
)/* end if 3*/
)/* end if 2*/
/* END OUTFILEMAIN */
)
); /* End Function number12 */
main();