# Question:Numerical intergration

## Question:Numerical intergration

Maple 2017

Hi all,

I am trying to find numerical integration of a complex function (Bessel+ trigonometric function) in (r, theta). MAPLE is unable to solve it due to high memory allocation issues. Function is like this f(r.theta)=Bessel(1,r)+cos(theta)*f(r)+....50 terms.

I am using  evalf( Int(f(r,theta), [r=0..1, theta=0..Pi])).

Will term by term integration be helpful? How to do it in maple?

PS: If I decrease the number of digits, I get the result fast.

 > restart;
 > F1 := 0.1e10 * (0.55776153956804000740336392666745e0 * r ^ 2 - 0.18915469024923561670746189899598e-134609736 * BesselJ(0.0e0, 0.15157937163140142799278350422223e3 * r) + 0.10159683864017545475828989384714e-98384011 * BesselJ(0.0e0, 0.12958780324510399675374141784136e3 * r) + 0.59829761821461366846048256106725e-56462782 * BesselJ(0.0e0, 0.98170950730790781973537759160851e2 * r) + 0.14811094053601555275542685914404e-80227782 * BesselJ(0.0e0, 0.11702112189889242502757649460146e3 * r) + 0.33892512681723589723181533606428e-7313754 * BesselJ(0.0e0, 0.35332307550083865102634479022519e2 * r) - 0.51262328796358933950059817332311e-2254297 * BesselJ(0.0e0, 0.19615858510468242021125065884138e2 * r) - 0.12881247566594125484600726823569e-19254076 * BesselJ(0.0e0, 0.57327525437901010745090504243751e2 * r) + 0.11118751423887112574088244798447e-31252221 * BesselJ(0.0e0, 0.73036895225573834826506117569092e2 * r) - 0.51777724984261891154172697895593e-33998785 * BesselJ(0.0e0, 0.76178699584641457572852614623535e2 * r) + 0.12182571270348008146031905708415e-42932343 * BesselJ(0.0e0, 0.85604019436350230965949425493380e2 * r) + 0.40737194122764952321439991068058e-36860993 * BesselJ(0.0e0, 0.79320487175476299391184484872488e2 * r) - 0.50622470024129990724764923292822e-6070573 * BesselJ(0.0e0, 0.32189679910974403626622984104460e2 * r) - 0.46336835054606228289459855037304e-46141486 * BesselJ(0.0e0, 0.88745767144926306903735916434854e2 * r) + 0.13326755919882635551499433439984e-71843536 * BesselJ(0.0e0, 0.11073775478089921510860865288827e3 * r) - 0.51549643524094258017297656487619e-15264332 * BesselJ(0.0e0, 0.51043535183571509468733034633224e2 * r) + 0.63020619016879105779529017065422e-17201382 * BesselJ(0.0e0, 0.54185553641061320532099966214534e2 * r) - 0.34143530857990731804462883496266e-75977837 * BesselJ(0.0e0, 0.11387944084759499813488417492843e3 * r) + 0.29817206128159554191843363526765e-49466273 * BesselJ(0.0e0, 0.91887504251694985280553622214490e2 * r) - 0.32466998108445575875801048023258e-52906705 * BesselJ(0.0e0, 0.95029231808044695268050998187174e2 * r) - 0.18661427630098737592148946513116e-60134503 * BesselJ(0.0e0, 0.10131266182303873013714105638865e3 * r) - 0.88067954684538428870806207522441e-67824881 * BesselJ(0.0e0, 0.10759606325950917218267036427761e3 * r) + 0.13287757851408088906808371290053e-129087698 * BesselJ(0.0e0, 0.14843772662034223039593927702627e3 * r) - 0.28491383339723867983586755114008e-93671487 * BesselJ(0.0e0, 0.12644613869851659569779448049584e3 * r) + 0.44151440493072282554074854252808e-21422416 * BesselJ(0.0e0, 0.60469457845347491559398749808383e2 * r) - 0.25433459757254658126695515265514e-23706400 * BesselJ(0.0e0, 0.63611356698481232631039762417874e2 * r) + 0.31838472287249562307154488541348e-118390557 * BesselJ(0.0e0, 0.14215442965585902903270090809976e3 * r) + 0.24664036351722993558633516210405e-26106029 * BesselJ(0.0e0, 0.66753226734098493415305259750042e2 * r) - 0.35291670105094410350434844041935e-8672580 * BesselJ(0.0e0, 0.38474766234771615112052197557717e2 * r) + 0.58664491893391140222815167210588e-10147051 * BesselJ(0.0e0, 0.41617094212814450885863516805060e2 * r) - 0.15835272073861680035000959411566e-11737166 * BesselJ(0.0e0, 0.44759318997652821732779352713212e2 * r) + 0.70213789662657167106991346854437e-13442927 * BesselJ(0.0e0, 0.47901460887185447121274008722508e2 * r) + 0.20203042047105171656770921613101e-86016 * BesselJ(0.0e0, 0.38317059702075123156144358863082e1 * r) + 0.45595799288913858149685893872177e-140247419 * BesselJ(0.0e0, 0.15472101451628595352476655565184e3 * r) - 0.18611154629569865685380386607775e-146000746 * BesselJ(0.0e0, 0.15786265540193029780509466960866e3 * r) + 0.98529688671644920915913795962299e-63921870 * BesselJ(0.0e0, 0.10445436579128276007136342813961e3 * r) - 0.15806285101030450527944027463056e-123681305 * BesselJ(0.0e0, 0.14529607934519590723242215085501e3 * r) - 0.40315574736579460691059726643094e-28621303 * BesselJ(0.0e0, 0.69895071837495773969730536435500e2 * r) + 0.62723521218202757338090566184844e-108155995 * BesselJ(0.0e0, 0.13587112236478900059180156821946e3 * r) - 0.10859734567264554119513113490716e-113215453 * BesselJ(0.0e0, 0.13901277738865970417843354613596e3 * r) - 0.54175511325922018873646654014932e-39838846 * BesselJ(0.0e0, 0.82462259914373556453986610648781e2 * r) + 0.11283650227585469604741653680022e-4943036 * BesselJ(0.0e0, 0.29046828534916855066647819883532e2 * r) - 0.61345791140260163801601678872534e-103212181 * BesselJ(0.0e0, 0.13272946438850961588677459735175e3 * r) - 0.10878629914720505255262338938331e-84593372 * BesselJ(0.0e0, 0.12016279832814900375811940782917e3 * r) - 0.35054349658929943485990383440882e-3931145 * BesselJ(0.0e0, 0.25903672087618382625495855445980e2 * r) + 0.13529453916914935758397358737774e-89074607 * BesselJ(0.0e0, 0.12330447048863571801676003206877e3 * r) + 0.13471689526126410315073637771645e-3034898 * BesselJ(0.0e0, 0.22760084380592771898053005152182e2 * r) - 0.21295581245266175979652384428576e-288353 * BesselJ(0.0e0, 0.70155866698156187535370499814765e1 * r) + 0.46293568384524693637583038682636e-606366 * BesselJ(0.0e0, 0.10173468135062722077185711776776e2 * r) - 0.65373336840252622743371660187403e-1040030 * BesselJ(0.0e0, 0.13323691936314223032393684126948e2 * r) + 0.12271878942218097649114096289979e-1589340 * BesselJ(0.0e0, 0.16470630050877632812552460470990e2 * r) + 0.30096533794321654779481815801012e5) * (-0.84195432401461277308031602263610e-5 * r ^ 2 - 0.59149959490724929627371164952978e-2 * r ^ 6 * cos(0.6e1 * theta) + 0.44528672504236299477606103483348e-2 * r ^ 9 * cos(0.9e1 * theta) + 0.2112306765385091377525007041829e-2 * r ^ 25 * cos(0.25e2 * theta) - 0.67200617360940427597733246769568e-3 * r ^ 4 * cos(0.4e1 * theta) + 0.8077651557524848874997646779728e-4 * r ^ 38 * cos(0.38e2 * theta) + 0.6431431133931729186611840353106e-3 * r ^ 39 * cos(0.39e2 * theta) + 0.6638764085868884552072751263020e-3 * r ^ 40 * cos(0.40e2 * theta) + 0.3077586813267194148977094233961e-3 * r ^ 41 * cos(0.41e2 * theta) - 0.1856408707409825202502168626613e-3 * r ^ 42 * cos(0.42e2 * theta) - 0.4195028383398335941571877904622e-3 * r ^ 43 * cos(0.43e2 * theta) - 0.3706398326158304378037548737582e-3 * r ^ 44 * cos(0.44e2 * theta) - 0.7999587757612915190037434403564e-4 * r ^ 45 * cos(0.45e2 * theta) + 0.1737050010593172373976692973078e-3 * r ^ 46 * cos(0.46e2 * theta) + 0.2156346448293426610250334073280e-3 * r ^ 47 * cos(0.47e2 * theta) + 0.8688707406587637755715273073496e-4 * r ^ 48 * cos(0.48e2 * theta) - 0.2566545888070136544474329645476e-4 * r ^ 49 * cos(0.49e2 * theta) + 0.10879633813910334336257501999693e-1 * cos(theta) * r + 0.1887562703232630941270016328998e-2 * r ^ 24 * cos(0.24e2 * theta) + 0.9513343462787182229625573235371e-3 * r ^ 26 * cos(0.26e2 * theta) - 0.6163648649547716429383661026270e-3 * r ^ 27 * cos(0.27e2 * theta) - 0.1638476483444926784339005153548e-2 * r ^ 28 * cos(0.28e2 * theta) - 0.1544747773264052898936010069036e-2 * r ^ 29 * cos(0.29e2 * theta) - 0.5206686266979668543527923877478e-3 * r ^ 30 * cos(0.30e2 * theta) + 0.7031766719478684183248753358164e-3 * r ^ 31 * cos(0.31e2 * theta) + 0.1364403772746535517159915014059e-2 * r ^ 32 * cos(0.32e2 * theta) + 0.10540246948583098852767644351809e-2 * r ^ 33 * cos(0.33e2 * theta) + 0.1949337811874134263703020015791e-3 * r ^ 34 * cos(0.34e2 * theta) - 0.7191715359288498000802128285804e-3 * r ^ 35 * cos(0.35e2 * theta) - 0.10227876151057534138247065986153e-2 * r ^ 36 * cos(0.36e2 * theta) - 0.6867126825080510201446558832207e-3 * r ^ 37 * cos(0.37e2 * theta) - 0.51907452513946892830363140141895e-2 * r ^ 5 * cos(0.5e1 * theta) + 0.15481206149695126077925147166938e-2 * r ^ 11 * cos(0.11e2 * theta) - 0.18891064144929437714573633077525e-2 * r ^ 12 * cos(0.12e2 * theta) - 0.3811736195725823688361734620913e-2 * r ^ 13 * cos(0.13e2 * theta) - 0.32257343081162300403533436479469e-2 * r ^ 14 * cos(0.14e2 * theta) - 0.6456518231629053621129825002098e-3 * r ^ 15 * cos(0.15e2 * theta) + 0.20319096805014454478199422911684e-2 * r ^ 16 * cos(0.16e2 * theta) + 0.3233144446775015541635116158538e-2 * r ^ 17 * cos(0.17e2 * theta) + 0.23137228128708316785559166203584e-2 * r ^ 18 * cos(0.18e2 * theta) + 0.6898483226498941349817978084256e-4 * r ^ 19 * cos(0.19e2 * theta) - 0.20285262491678306920628881668352e-2 * r ^ 20 * cos(0.20e2 * theta) - 0.2671173199674743523515178373090e-2 * r ^ 21 * cos(0.21e2 * theta) - 0.15775142288031750532503075313091e-2 * r ^ 22 * cos(0.22e2 * theta) + 0.3622094777240520457049718035053e-3 * r ^ 23 * cos(0.23e2 * theta) + 0.14579067481459940998484958894370e-2 * r ^ 8 * cos(0.8e1 * theta) + 0.43385218600667457865829805287215e-2 * r ^ 10 * cos(0.10e2 * theta) - 0.29324228962818139404116534560943e-2 * r ^ 7 * cos(0.7e1 * theta) + 0.54771662980043457997274959739776e-2 * r ^ 3 * cos(0.3e1 * theta) - 0.11907324829492592983826593268542e-1 + 0.99737018277250342942042004599405e6 * (0.10375843065514893709650453544669e-7 * r ^ 4 - 0.24066724220589275560649004814238e-8 * r ^ 2) * cos(0.2e1 * theta) / r ^ 2 - 0.18524693450872080736996040590111e-1589345 * BesselJ(0.0e0, 0.16470630050877632812552460470990e2 * r) - 0.20335836094200343189896872255293e-3034903 * BesselJ(0.0e0, 0.22760084380592771898053005152182e2 * r) + 0.32146186927377989454999075542184e-288358 * BesselJ(0.0e0, 0.70155866698156187535370499814765e1 * r) - 0.69881243704258704205303920297122e-606371 * BesselJ(0.0e0, 0.10173468135062722077185711776776e2 * r) + 0.98682608468381340045946744187651e-1040035 * BesselJ(0.0e0, 0.13323691936314223032393684126948e2 * r) - 0.20423032817438260168628393904163e-89074612 * BesselJ(0.0e0, 0.12330447048863571801676003206877e3 * r) + 0.16393027894394588837550747507414e-113215458 * BesselJ(0.0e0, 0.13901277738865970417843354613596e3 * r) + 0.81779224239606095156885663441587e-39838851 * BesselJ(0.0e0, 0.82462259914373556453986610648781e2 * r) - 0.17032938676879018403348115316985e-4943041 * BesselJ(0.0e0, 0.29046828534916855066647819883532e2 * r) + 0.92602932340297485357655867631396e-103212186 * BesselJ(0.0e0, 0.13272946438850961588677459735175e3 * r) + 0.16421550871268572218657911635481e-84593377 * BesselJ(0.0e0, 0.12016279832814900375811940782917e3 * r) + 0.52915375437527581357423578813141e-3931150 * BesselJ(0.0e0, 0.25903672087618382625495855445980e2 * r) + 0.77815414272085141864206462412262e-15264337 * BesselJ(0.0e0, 0.51043535183571509468733034633224e2 * r) - 0.95131124896907983486241420998755e-17201387 * BesselJ(0.0e0, 0.54185553641061320532099966214534e2 * r) + 0.51540472771347914200070162230077e-75977842 * BesselJ(0.0e0, 0.11387944084759499813488417492843e3 * r) - 0.45009782583936088946734982085640e-49466278 * BesselJ(0.0e0, 0.91887504251694985280553622214490e2 * r) + 0.49009706668463083583947296301775e-52906710 * BesselJ(0.0e0, 0.95029231808044695268050998187174e2 * r) + 0.28169869327339522936720076403132e-60134508 * BesselJ(0.0e0, 0.10131266182303873013714105638865e3 * r) + 0.13294067445237467596212175135530e-67824885 * BesselJ(0.0e0, 0.10759606325950917218267036427761e3 * r) - 0.20058186851887448492658350947366e-129087703 * BesselJ(0.0e0, 0.14843772662034223039593927702627e3 * r) + 0.43008421517583172146652387481621e-93671492 * BesselJ(0.0e0, 0.12644613869851659569779448049584e3 * r) - 0.66647650649066255093532041895905e-21422421 * BesselJ(0.0e0, 0.60469457845347491559398749808383e2 * r) + 0.38392413062141555362678468281752e-23706405 * BesselJ(0.0e0, 0.63611356698481232631039762417874e2 * r) - 0.48060931976467196435085585083844e-118390562 * BesselJ(0.0e0, 0.14215442965585902903270090809976e3 * r) - 0.37230950111886614086127736374754e-26106034 * BesselJ(0.0e0, 0.66753226734098493415305259750042e2 * r) + 0.53273616301499657528989740768063e-8672585 * BesselJ(0.0e0, 0.38474766234771615112052197557717e2 * r) - 0.88555447286690435479201942884554e-10147056 * BesselJ(0.0e0, 0.41617094212814450885863516805060e2 * r) + 0.23903720225781678909977638730792e-11737171 * BesselJ(0.0e0, 0.44759318997652821732779352713212e2 * r) - 0.10598938725267772368055360453741e-13442931 * BesselJ(0.0e0, 0.47901460887185447121274008722508e2 * r) - 0.30496972994915901977125629292157e-86021 * BesselJ(0.0e0, 0.38317059702075123156144358863082e1 * r) - 0.68827944640884252540240135035619e-140247424 * BesselJ(0.0e0, 0.15472101451628595352476655565184e3 * r) + 0.28093981036064987725074202641260e-146000751 * BesselJ(0.0e0, 0.15786265540193029780509466960866e3 * r) - 0.14873291099481638062068892057166e-63921874 * BesselJ(0.0e0, 0.10445436579128276007136342813961e3 * r) + 0.23859963700126918177896460503756e-123681310 * BesselJ(0.0e0, 0.14529607934519590723242215085501e3 * r) + 0.60857319959503281138409206408861e-28621308 * BesselJ(0.0e0, 0.69895071837495773969730536435500e2 * r) - 0.94682648696048924172260521336169e-108156000 * BesselJ(0.0e0, 0.13587112236478900059180156821946e3 * r) + 0.28553350861432233569650200943679e-134609741 * BesselJ(0.0e0, 0.15157937163140142799278350422223e3 * r) - 0.15336284689969342456370426833116e-98384016 * BesselJ(0.0e0, 0.12958780324510399675374141784136e3 * r) - 0.90314449987634539477129986599199e-56462787 * BesselJ(0.0e0, 0.98170950730790781973537759160851e2 * r) - 0.22357699119008062011176340166029e-80227787 * BesselJ(0.0e0, 0.11702112189889242502757649460146e3 * r) - 0.51161554857649418772612124539227e-7313759 * BesselJ(0.0e0, 0.35332307550083865102634479022519e2 * r) + 0.77381705849741819343661724258774e-2254302 * BesselJ(0.0e0, 0.19615858510468242021125065884138e2 * r) + 0.19444549898144465612468716205102e-19254081 * BesselJ(0.0e0, 0.57327525437901010745090504243751e2 * r) - 0.16784020006534355647552255243370e-31252226 * BesselJ(0.0e0, 0.73036895225573834826506117569092e2 * r) + 0.78159708666719140456536882061442e-33998790 * BesselJ(0.0e0, 0.76178699584641457572852614623535e2 * r) - 0.18389881393811040868057686236036e-42932348 * BesselJ(0.0e0, 0.85604019436350230965949425493380e2 * r) - 0.61493764461507094694745129374163e-36860998 * BesselJ(0.0e0, 0.79320487175476299391184484872488e2 * r) + 0.76415823798329557427383241351545e-6070578 * BesselJ(0.0e0, 0.32189679910974403626622984104460e2 * r) + 0.69946555772905592227422733556311e-46141491 * BesselJ(0.0e0, 0.88745767144926306903735916434854e2 * r) - 0.20117055364775216522977716192738e-71843541 * BesselJ(0.0e0, 0.11073775478089921510860865288827e3 * r) + 0.24003433134624560908493351044670e-2 * cos(0.2e1 * theta)) * r;
 (1)
 > evalf(subs(r=1,theta=Pi/4,F1))
 (2)
 > Digits:=16;
 (3)
 > int_F1:=evalf(Int(F1,[theta=Pi/4..2*Pi-Pi/4,r=0..1]));
 >