## Gaussian quadrature and weights listed as scrapeable data

This file consists of Gauss quadrature points and weights from n=1 to n=30. The blank spaces separate out the value of n, quadrature points, and weights. The points and weights are for the integration limits of [-1,1]. To convert to any finite integration limits [a,b], multiply the weights by (b-a)/2 and use (b-a)/2*QuadPoint+(b+a)/2 for the quadrature points. The data is also given in a scrapeable textfile at https://mathforcollege.com/nm/blog/QuadPointsWeightsUpTo30.txt

 1

0

2.0

 2

-0.57735026918962576450914878050196
0.57735026918962576450914878050196

1.0
1.0

 3

-0.77459666924148337703585307995648
0
0.77459666924148337703585307995648

0.55555555555555555555555555555556
0.88888888888888888888888888888889
0.55555555555555555555555555555556

 4

-0.86113631159405257522394648889281
-0.33998104358485626480266575910324
0.33998104358485626480266575910324
0.86113631159405257522394648889281

0.347854845137453857373063949222
0.652145154862546142626936050778
0.652145154862546142626936050778
0.347854845137453857373063949222

 5

-0.90617984593866399279762687829939
-0.53846931010568309103631442070021
0
0.53846931010568309103631442070021
0.90617984593866399279762687829939

0.23692688505618908751426404071992
0.47862867049936646804129151483564
0.56888888888888888888888888888889
0.47862867049936646804129151483564
0.23692688505618908751426404071992

 6

-0.93246951420315202781230155449399
-0.66120938646626451366139959501991
-0.23861918608319690863050172168071
0.23861918608319690863050172168071
0.66120938646626451366139959501991
0.93246951420315202781230155449399

0.17132449237917034504029614217273
0.36076157304813860756983351383772
0.46791393457269104738987034398955
0.46791393457269104738987034398955
0.36076157304813860756983351383772
0.17132449237917034504029614217273

 7

-0.94910791234275852452618968404785
-0.74153118559939443986386477328079
-0.40584515137739716690660641207696
0
0.40584515137739716690660641207696
0.74153118559939443986386477328079
0.94910791234275852452618968404785

0.12948496616886969327061143267908
0.27970539148927666790146777142378
0.38183005050511894495036977548898
0.41795918367346938775510204081633
0.38183005050511894495036977548898
0.27970539148927666790146777142378
0.12948496616886969327061143267908

 8

-0.96028985649753623168356086856947
-0.79666647741362673959155393647583
-0.52553240991632898581773904918925
-0.18343464249564980493947614236018
0.18343464249564980493947614236018
0.52553240991632898581773904918925
0.79666647741362673959155393647583
0.96028985649753623168356086856947

0.10122853629037625915253135430996
0.22238103445337447054435599442624
0.3137066458778872873379622019866
0.3626837833783619829651504492772
0.3626837833783619829651504492772
0.3137066458778872873379622019866
0.22238103445337447054435599442624
0.10122853629037625915253135430996

 9

-0.96816023950762608983557620290367
-0.83603110732663579429942978806973
-0.61337143270059039730870203934147
-0.32425342340380892903853801464334
0
0.32425342340380892903853801464334
0.61337143270059039730870203934147
0.83603110732663579429942978806973
0.96816023950762608983557620290367

0.081274388361574411971892158110524
0.18064816069485740405847203124291
0.26061069640293546231874286941863
0.31234707704000284006863040658444
0.33023935500125976316452506928697
0.31234707704000284006863040658444
0.26061069640293546231874286941863
0.18064816069485740405847203124291
0.081274388361574411971892158110524

10

-0.97390652851717172007796401208445
-0.86506336668898451073209668842349
-0.67940956829902440623432736511487
-0.43339539412924719079926594316578
-0.14887433898163121088482600112972
0.14887433898163121088482600112972
0.43339539412924719079926594316578
0.67940956829902440623432736511487
0.86506336668898451073209668842349
0.97390652851717172007796401208445

0.066671344308688137593568809893332
0.1494513491505805931457763396577
0.21908636251598204399553493422816
0.26926671930999635509122692156947
0.29552422471475287017389299465134
0.29552422471475287017389299465134
0.26926671930999635509122692156947
0.21908636251598204399553493422816
0.1494513491505805931457763396577
0.066671344308688137593568809893332

11

-0.97822865814605699280393800112286
-0.88706259976809529907515776930393
-0.73015200557404932409341625203115
-0.51909612920681181592572566945861
-0.26954315595234497233153198540086
0
0.26954315595234497233153198540086
0.51909612920681181592572566945861
0.73015200557404932409341625203115
0.88706259976809529907515776930393
0.97822865814605699280393800112286

0.055668567116173666482753720442549
0.12558036946490462463469429922394
0.18629021092773425142609764143166
0.23319376459199047991852370484318
0.26280454451024666218068886989051
0.27292508677790063071448352833634
0.26280454451024666218068886989051
0.23319376459199047991852370484318
0.18629021092773425142609764143166
0.12558036946490462463469429922394
0.055668567116173666482753720442549

12

-0.98156063424671925069054909014928
-0.9041172563704748566784658661191
-0.76990267419430468703689383321282
-0.58731795428661744729670241894053
-0.36783149899818019375269153664372
-0.12523340851146891547244136946385
0.12523340851146891547244136946385
0.36783149899818019375269153664372
0.58731795428661744729670241894053
0.76990267419430468703689383321282
0.9041172563704748566784658661191
0.98156063424671925069054909014928

0.047175336386511827194615961485017
0.106939325995318430960254718194
0.16007832854334622633465252954336
0.2031674267230659217490644558098
0.23349253653835480876084989892488
0.24914704581340278500056243604295
0.24914704581340278500056243604295
0.23349253653835480876084989892488
0.2031674267230659217490644558098
0.16007832854334622633465252954336
0.106939325995318430960254718194
0.047175336386511827194615961485017

13

-0.98418305471858814947282944880711
-0.91759839922297796520654783650072
-0.80157809073330991279420648958286
-0.64234933944034022064398460699552
-0.44849275103644685287791285212764
-0.23045831595513479406552812109799
0
0.23045831595513479406552812109799
0.44849275103644685287791285212764
0.64234933944034022064398460699552
0.80157809073330991279420648958286
0.91759839922297796520654783650072
0.98418305471858814947282944880711

0.040484004765315879520021592200986
0.092121499837728447914421775953797
0.13887351021978723846360177686887
0.1781459807619457382800466919961
0.20781604753688850231252321930605
0.22628318026289723841209018603978
0.23255155323087391019458951526884
0.22628318026289723841209018603978
0.20781604753688850231252321930605
0.1781459807619457382800466919961
0.13887351021978723846360177686887
0.092121499837728447914421775953797
0.040484004765315879520021592200986

14

-0.98628380869681233884159726670405
-0.92843488366357351733639113937787
-0.82720131506976499318979474265039
-0.68729290481168547014801980301933
-0.51524863635815409196529071855119
-0.31911236892788976043567182416848
-0.10805494870734366206624465021983
0.10805494870734366206624465021983
0.31911236892788976043567182416848
0.51524863635815409196529071855119
0.68729290481168547014801980301933
0.82720131506976499318979474265039
0.92843488366357351733639113937787
0.98628380869681233884159726670405

0.035119460331751863031832876138192
0.080158087159760209805633277062854
0.12151857068790318468941480907248
0.15720316715819353456960193862384
0.18553839747793781374171659012516
0.20519846372129560396592406566122
0.21526385346315779019587644331626
0.21526385346315779019587644331626
0.20519846372129560396592406566122
0.18553839747793781374171659012516
0.15720316715819353456960193862384
0.12151857068790318468941480907248
0.080158087159760209805633277062854
0.035119460331751863031832876138192

15

-0.98799251802048542848956571858661
-0.93727339240070590430775894771021
-0.84820658341042721620064832077422
-0.72441773136017004741618605461394
-0.57097217260853884753722673725391
-0.39415134707756336989720737098105
-0.2011940939974345223006283033946
0
0.2011940939974345223006283033946
0.39415134707756336989720737098105
0.57097217260853884753722673725391
0.72441773136017004741618605461394
0.84820658341042721620064832077422
0.93727339240070590430775894771021
0.98799251802048542848956571858661

0.030753241996117268354628393577204
0.070366047488108124709267416450667
0.10715922046717193501186954668587
0.13957067792615431444780479451103
0.16626920581699393355320086048121
0.18616100001556221102680056186642
0.19843148532711157645611832644384
0.20257824192556127288062019996752
0.19843148532711157645611832644384
0.18616100001556221102680056186642
0.16626920581699393355320086048121
0.13957067792615431444780479451103
0.10715922046717193501186954668587
0.070366047488108124709267416450667
0.030753241996117268354628393577204

16

-0.98940093499164993259615417345033
-0.94457502307323257607798841553461
-0.86563120238783174388046789771239
-0.75540440835500303389510119484744
-0.61787624440264374844667176404879
-0.45801677765722738634241944298358
-0.2816035507792589132304605014605
-0.095012509837637440185319335424958
0.095012509837637440185319335424958
0.2816035507792589132304605014605
0.45801677765722738634241944298358
0.61787624440264374844667176404879
0.75540440835500303389510119484744
0.86563120238783174388046789771239
0.94457502307323257607798841553461
0.98940093499164993259615417345033

0.027152459411754094851780572456018
0.062253523938647892862843836994378
0.095158511682492784809925107602246
0.12462897125553387205247628219202
0.14959598881657673208150173054748
0.16915651939500253818931207903036
0.18260341504492358886676366796922
0.18945061045506849628539672320828
0.18945061045506849628539672320828
0.18260341504492358886676366796922
0.16915651939500253818931207903036
0.14959598881657673208150173054748
0.12462897125553387205247628219202
0.095158511682492784809925107602246
0.062253523938647892862843836994378
0.027152459411754094851780572456018

17

-0.99057547531441733567543401994067
-0.9506755217687677612227169578958
-0.88023915372698590212295569448816
-0.78151400389680140692523005552048
-0.657671159216690765850302216643
-0.51269053708647696788624656862955
-0.35123176345387631529718551709535
-0.17848418149584785585067749365407
0
0.17848418149584785585067749365407
0.35123176345387631529718551709535
0.51269053708647696788624656862955
0.657671159216690765850302216643
0.78151400389680140692523005552048
0.88023915372698590212295569448816
0.9506755217687677612227169578958
0.99057547531441733567543401994067

0.024148302868547931960110026287565
0.055459529373987201129440165358245
0.085036148317179180883535370191062
0.11188384719340397109478838562636
0.13513636846852547328631998170235
0.15404576107681028808143159480196
0.16800410215645004450997066378832
0.1765627053669926463252709901132
0.17944647035620652545826564426189
0.1765627053669926463252709901132
0.16800410215645004450997066378832
0.15404576107681028808143159480196
0.13513636846852547328631998170235
0.11188384719340397109478838562636
0.085036148317179180883535370191062
0.055459529373987201129440165358245
0.024148302868547931960110026287565

18

-0.99156516842093094673001600470615
-0.95582394957139775518119589292978
-0.89260246649755573920606059112715
-0.80370495897252311568241745501459
-0.69168704306035320787489108128885
-0.55977083107394753460787154852533
-0.41175116146284264603593179383305
-0.25188622569150550958897285487791
-0.084775013041735301242261852935784
0.084775013041735301242261852935784
0.25188622569150550958897285487791
0.41175116146284264603593179383305
0.55977083107394753460787154852533
0.69168704306035320787489108128885
0.80370495897252311568241745501459
0.89260246649755573920606059112715
0.95582394957139775518119589292978
0.99156516842093094673001600470615

0.021616013526483310313342710266452
0.049714548894969796453334946202639
0.076425730254889056529129677616637
0.10094204410628716556281398492483
0.1225552067114784601845191268002
0.14064291467065065120473130375195
0.15468467512626524492541800383637
0.16427648374583272298605377646593
0.16914238296314359184065647013499
0.16914238296314359184065647013499
0.16427648374583272298605377646593
0.15468467512626524492541800383637
0.14064291467065065120473130375195
0.1225552067114784601845191268002
0.10094204410628716556281398492483
0.076425730254889056529129677616637
0.049714548894969796453334946202639
0.021616013526483310313342710266452

19

-0.99240684384358440318901767025326
-0.96020815213483003085277884068765
-0.90315590361481790164266092853231
-0.82271465653714282497892248671271
-0.72096617733522937861709586082378
-0.60054530466168102346963816494624
-0.4645707413759609457172671481041
-0.31656409996362983199011732884984
-0.16035864564022537586809611574074
0
0.16035864564022537586809611574074
0.31656409996362983199011732884984
0.4645707413759609457172671481041
0.60054530466168102346963816494624
0.72096617733522937861709586082378
0.82271465653714282497892248671271
0.90315590361481790164266092853231
0.96020815213483003085277884068765
0.99240684384358440318901767025326

0.019461788229726477036312041464438
0.044814226765699600332838157401994
0.069044542737641226580708258006013
0.09149002162244999946446209412384
0.11156664554733399471602390168177
0.12875396253933622767551578485688
0.1426067021736066117757461094419
0.15276604206585966677885540089766
0.15896884339395434764995643946505
0.16105444984878369597916362532092
0.15896884339395434764995643946505
0.15276604206585966677885540089766
0.1426067021736066117757461094419
0.12875396253933622767551578485688
0.11156664554733399471602390168177
0.09149002162244999946446209412384
0.069044542737641226580708258006013
0.044814226765699600332838157401994
0.019461788229726477036312041464438

20

-0.99312859918509492478612238847132
-0.96397192727791379126766613119728
-0.9122344282513259058677524412033
-0.83911697182221882339452906170152
-0.74633190646015079261430507035564
-0.63605368072651502545283669622629
-0.51086700195082709800436405095525
-0.37370608871541956067254817702493
-0.22778585114164507808049619536857
-0.076526521133497333754640409398838
0.076526521133497333754640409398838
0.22778585114164507808049619536857
0.37370608871541956067254817702493
0.51086700195082709800436405095525
0.63605368072651502545283669622629
0.74633190646015079261430507035564
0.83911697182221882339452906170152
0.9122344282513259058677524412033
0.96397192727791379126766613119728
0.99312859918509492478612238847132

0.017614007139152118311861962351853
0.040601429800386941331039952274932
0.062672048334109063569506535187042
0.083276741576704748724758143222046
0.10193011981724043503675013548035
0.11819453196151841731237737771138
0.13168863844917662689849449974816
0.14209610931838205132929832506716
0.14917298647260374678782873700197
0.1527533871307258506980843319551
0.1527533871307258506980843319551
0.14917298647260374678782873700197
0.14209610931838205132929832506716
0.13168863844917662689849449974816
0.11819453196151841731237737771138
0.10193011981724043503675013548035
0.083276741576704748724758143222046
0.062672048334109063569506535187042
0.040601429800386941331039952274932
0.017614007139152118311861962351853

21

-0.99375217062038950026024203593794
-0.9672268385663062943166222149077
-0.92009933415040082879018713371496
-0.85336336458331728364725063858757
-0.76843996347567790861587785130622
-0.66713880419741231930596666999034
-0.55161883588721980705901879672431
-0.42434212020743878357366888854379
-0.2880213168024010966007925160646
-0.14556185416089509093703098233869
0
0.14556185416089509093703098233869
0.2880213168024010966007925160646
0.42434212020743878357366888854379
0.55161883588721980705901879672431
0.66713880419741231930596666999034
0.76843996347567790861587785130623
0.85336336458331728364725063858756
0.92009933415040082879018713371497
0.96722683856630629431662221490769
0.99375217062038950026024203593794

0.016017228257774333324224616858403
0.036953789770852493799950668299422
0.057134425426857208283635826472357
0.076100113628379302017051653300256
0.093444423456033861553289741113883
0.10879729916714837766347457807013
0.12183141605372853419536717712572
0.13226893863333746178105257449678
0.13988739479107315472213342386758
0.14452440398997005906382716655375
0.14608113364969042719198514768337
0.14452440398997005906382716655375
0.13988739479107315472213342386758
0.13226893863333746178105257449678
0.12183141605372853419536717712574
0.1087972991671483776634745780701
0.09344442345603386155328974111395
0.076100113628379302017051653300153
0.057134425426857208283635826472488
0.036953789770852493799950668299287
0.016017228257774333324224616858503

22

-0.9942945854823992920730314211613
-0.97006049783542872712395098676527
-0.92695677218717400052069293925905
-0.86581257772030013653642563701938
-0.78781680597920816200427795540835
-0.69448726318668278005068983576226
-0.58764040350691159295887692763865
-0.46935583798675702640633071096641
-0.34193582089208422515814742042738
-0.20786042668822128547884653391955
-0.069739273319722221213841796118628
0.069739273319722221213841796118628
0.20786042668822128547884653391955
0.34193582089208422515814742042738
0.46935583798675702640633071096641
0.58764040350691159295887692763865
0.69448726318668278005068983576226
0.78781680597920816200427795540835
0.86581257772030013653642563701938
0.92695677218717400052069293925905
0.97006049783542872712395098676527
0.9942945854823992920730314211613

0.014627995298272200684991098047185
0.033774901584814154793302246865913
0.052293335152683285940312051273211
0.069796468424520488094961418930218
0.085941606217067727414443681372703
0.10041414444288096493207883783054
0.11293229608053921839340060742178
0.12325237681051242428556098615481
0.13117350478706237073296499253031
0.13654149834601517135257383123152
0.13925187285563199337541024834181
0.13925187285563199337541024834181
0.13654149834601517135257383123152
0.13117350478706237073296499253031
0.12325237681051242428556098615481
0.11293229608053921839340060742178
0.10041414444288096493207883783054
0.085941606217067727414443681372703
0.069796468424520488094961418930218
0.052293335152683285940312051273211
0.033774901584814154793302246865913
0.014627995298272200684991098047185

23

-0.99476933499755212352392571544557
-0.97254247121811523195602407682078
-0.93297108682601610234919698903842
-0.87675235827044166737815688593415
-0.80488840161883989215111840699678
-0.71866136313195019446162448374862
-0.6196098757636461563850973116496
-0.50950147784600754968979304786685
-0.39030103803029083142148887288061
-0.26413568097034493053386953828331
-0.13325682429846611093174268224177
0
0.13325682429846611093174268224177
0.26413568097034493053386953828331
0.39030103803029083142148887288061
0.50950147784600754968979304786685
0.6196098757636461563850973116496
0.71866136313195019446162448374862
0.80488840161883989215111840699678
0.87675235827044166737815688593415
0.93297108682601610234919698903842
0.97254247121811523195602407682078
0.99476933499755212352392571544557

0.013411859487141772081309493458615
0.030988005856979444310694219641885
0.048037671731084668571641071632034
0.064232421408525852127169615158911
0.079281411776718954922892524742043
0.092915766060035147477018617369765
0.10489209146454141007408618501474
0.11499664022241136494164351293396
0.12304908430672953046757840067201
0.12890572218808214997859533939979
0.13246203940469661737164246470332
0.13365457218610617535145711054584
0.13246203940469661737164246470332
0.12890572218808214997859533939979
0.12304908430672953046757840067201
0.11499664022241136494164351293396
0.10489209146454141007408618501474
0.092915766060035147477018617369765
0.079281411776718954922892524742043
0.064232421408525852127169615158911
0.048037671731084668571641071632034
0.030988005856979444310694219641885
0.013411859487141772081309493458615

24

-0.99518721999702136017999740970074
-0.97472855597130949819839199300817
-0.93827455200273275852364900170872
-0.8864155270044010342131543419822
-0.82000198597390292195394987266975
-0.74012419157855436424382810309998
-0.64809365193697556925249578691075
-0.54542147138883953565837561721837
-0.43379350762604513848708423191335
-0.31504267969616337438679329131981
-0.19111886747361630915863982075707
-0.064056892862605626085043082624745
0.064056892862605626085043082624745
0.19111886747361630915863982075707
0.31504267969616337438679329131981
0.43379350762604513848708423191335
0.54542147138883953565837561721837
0.64809365193697556925249578691075
0.74012419157855436424382810309998
0.82000198597390292195394987266975
0.8864155270044010342131543419822
0.93827455200273275852364900170872
0.97472855597130949819839199300817
0.99518721999702136017999740970074

0.012341229799987199546805667070037
0.028531388628933663181307815951878
0.044277438817419806168602748211338
0.059298584915436780746367758500109
0.073346481411080305734033615253117
0.086190161531953275917185202983743
0.097618652104113888269880664464247
0.10744427011596563478257734244661
0.11550566805372560135334448390678
0.12167047292780339120446315347626
0.12583745634682829612137538251118
0.1279381953467521569740561652247
0.1279381953467521569740561652247
0.12583745634682829612137538251118
0.12167047292780339120446315347626
0.11550566805372560135334448390678
0.10744427011596563478257734244661
0.097618652104113888269880664464247
0.086190161531953275917185202983743
0.073346481411080305734033615253117
0.059298584915436780746367758500109
0.044277438817419806168602748211338
0.028531388628933663181307815951878
0.012341229799987199546805667070037

25

-0.9955569697904980979087849468939
-0.97666392145951751149831538647959
-0.94297457122897433941401116965847
-0.8949919978782753688510420067828
-0.83344262876083400142102110869357
-0.75925926303735763057728286520436
-0.67356636847346836448512063324762
-0.57766293024122296772368984161265
-0.47300273144571496052218211500919
-0.36117230580938783773582173012764
-0.24386688372098843204519036279745
-0.12286469261071039638735981880804
0
0.12286469261071039638735981880804
0.24386688372098843204519036279745
0.36117230580938783773582173012764
0.47300273144571496052218211500919
0.57766293024122296772368984161265
0.67356636847346836448512063324762
0.75925926303735763057728286520436
0.83344262876083400142102110869357
0.8949919978782753688510420067828
0.94297457122897433941401116965847
0.97666392145951751149831538647959
0.9955569697904980979087849468939

0.011393798501026287947902964113235
0.026354986615032137261901815295299
0.040939156701306312655623487711646
0.054904695975835191925936891540473
0.068038333812356917207187185656708
0.080140700335001018013234959669111
0.091028261982963649811497220702892
0.10053594906705064420220689039269
0.10851962447426365311609395705012
0.11485825914571164833932554586956
0.1194557635357847722281781265129
0.12224244299031004168895951894585
0.12317605372671545120390287307905
0.12224244299031004168895951894585
0.1194557635357847722281781265129
0.11485825914571164833932554586956
0.10851962447426365311609395705012
0.10053594906705064420220689039269
0.091028261982963649811497220702892
0.080140700335001018013234959669111
0.068038333812356917207187185656708
0.054904695975835191925936891540473
0.040939156701306312655623487711646
0.026354986615032137261901815295299
0.011393798501026287947902964113235

26

-0.99588570114561692900321695932291
-0.97838544595647099110058035431193
-0.94715906666171425013591528351804
-0.90263786198430707421766559923121
-0.84544594278849801879750706146784
-0.77638594882067885619296724724228
-0.69642726041995726486381391372942
-0.60669229301761806323197874691689
-0.50844071482450571769570306472557
-0.40305175512348630648107737709888
-0.29200483948595689514283538207783
-0.17685882035689018396905774841834
-0.059230093429313207093718575198403
0.059230093429313207093718575198403
0.17685882035689018396905774841834
0.29200483948595689514283538207783
0.40305175512348630648107737709888
0.50844071482450571769570306472557
0.60669229301761806323197874691689
0.69642726041995726486381391372942
0.77638594882067885619296724724228
0.84544594278849801879750706146784
0.90263786198430707421766559923121
0.94715906666171425013591528351804
0.97838544595647099110058035431193
0.99588570114561692900321695932291

0.010551372617343007155651187685252
0.024417851092631908789615827519788
0.03796238329436276395030314124885
0.050975825297147811998319900724073
0.063274046329574835539453689907045
0.074684149765659745887075796102848
0.085045894313485239210447765079982
0.094213800355914148463664883067303
0.10205916109442542323841407025343
0.108471840528576590656579426728
0.1133618165463196665494407184426
0.11666044348529658204466250754036
0.11832141527926227651637108570047
0.11832141527926227651637108570047
0.11666044348529658204466250754036
0.1133618165463196665494407184426
0.108471840528576590656579426728
0.10205916109442542323841407025343
0.094213800355914148463664883067303
0.085045894313485239210447765079982
0.074684149765659745887075796102848
0.063274046329574835539453689907045
0.050975825297147811998319900724073
0.03796238329436276395030314124885
0.024417851092631908789615827519788
0.010551372617343007155651187685252

27

-0.99617926288898856693888720838123
-0.97992347596150122285587335566105
-0.95090055781470500685190803064388
-0.90948232067749110430064501820969
-0.85620790801829449030273722270684
-0.79177163907050822714439734410727
-0.71701347373942369929481621164234
-0.63290797194649514092773463763449
-0.54055156457945689490030094155998
-0.44114825175002688058597415568928
-0.33599390363850889973031903420728
-0.22645936543953685885723910736023
-0.11397258560952996693289498386998
0
0.11397258560952996693289498386998
0.22645936543953685885723910736023
0.33599390363850889973031903420728
0.44114825175002688058597415568928
0.54055156457945689490030094155998
0.63290797194649514092773463763449
0.71701347373942369929481621164234
0.79177163907050822714439734410727
0.85620790801829449030273722270684
0.90948232067749110430064501820969
0.95090055781470500685190803064388
0.97992347596150122285587335566105
0.99617926288898856693888720838123

0.0097989960512943602611500550912591
0.022686231596180623196034206446761
0.035297053757419711022578289304712
0.047449412520615062704096710114185
0.058983536859833599110300833719532
0.069748823766245592984322888356667
0.079604867773057771263074959009842
0.088423158543756950194322802853749
0.096088727370028507565652646558106
0.10250163781774579867124771153266
0.10757828578853318721216298442666
0.11125248835684519267216309604285
0.1134763461089651486203699480921
0.11422086737895698904504573690184
0.1134763461089651486203699480921
0.11125248835684519267216309604285
0.10757828578853318721216298442666
0.10250163781774579867124771153266
0.096088727370028507565652646558106
0.088423158543756950194322802853749
0.079604867773057771263074959009842
0.069748823766245592984322888356667
0.058983536859833599110300833719532
0.047449412520615062704096710114185
0.035297053757419711022578289304712
0.022686231596180623196034206446761
0.0097989960512943602611500550912591

28

-0.99644249757395444995043639048331
-0.98130316537087275369455994580783
-0.95425928062893819725410183970522
-0.91563302639213207386968942332993
-0.86589252257439504894225456737969
-0.80564137091717917144788595542528
-0.73561087801363177202814451029253
-0.65665109403886496121989817650674
-0.56972047181140171930800328335643
-0.47587422495511826103441184766743
-0.37625151608907871022135720955609
-0.27206162763517807767682635612577
-0.16456928213338077128147177789117
-0.05507928988403427042651652734188
0.05507928988403427042651652734188
0.16456928213338077128147177789117
0.27206162763517807767682635612577
0.37625151608907871022135720955609
0.47587422495511826103441184766743
0.56972047181140171930800328335643
0.65665109403886496121989817650674
0.73561087801363177202814451029253
0.80564137091717917144788595542528
0.86589252257439504894225456737969
0.91563302639213207386968942332993
0.95425928062893819725410183970522
0.98130316537087275369455994580783
0.99644249757395444995043639048331

0.0091242825930945177388161539229517
0.021132112592771259751500380993265
0.032901427782304379977630819170532
0.044272934759004227839587877653207
0.055107345675716745431482918226946
0.065272923966999595793397566775505
0.074646214234568779023931887173022
0.083113417228901218390396498244332
0.090571744393032840942186031336784
0.096930657997929915850489006095441
0.10211296757806076981421663850571
0.10605576592284641791041643699681
0.10871119225829413525357151930367
0.11004701301647519628237626560182
0.11004701301647519628237626560182
0.10871119225829413525357151930367
0.10605576592284641791041643699681
0.10211296757806076981421663850571
0.096930657997929915850489006095441
0.090571744393032840942186031336784
0.083113417228901218390396498244332
0.074646214234568779023931887173022
0.065272923966999595793397566775505
0.055107345675716745431482918226946
0.044272934759004227839587877653207
0.032901427782304379977630819170532
0.021132112592771259751500380993265
0.0091242825930945177388161539229517

29

-0.99667944226059658616319153254935
-0.98254550526141317487092601578638
-0.95728559577808772579820803698082
-0.92118023295305878509375343608311
-0.87463780492010279041779342125658
-0.81818548761525244498957221457878
-0.75246285173447713391261007721214
-0.67821453760268651515618500539199
-0.59628179713822782037958621118899
-0.50759295512422764210262791962752
-0.41315288817400866389070658603162
-0.31403163786763993494819592319105
-0.21135228616600107450637572890294
-0.10627823013267923017098239243038
0
0.10627823013267923017098239243038
0.21135228616600107450637572890294
0.31403163786763993494819592319105
0.41315288817400866389070658603162
0.50759295512422764210262791962752
0.59628179713822782037958621118899
0.67821453760268651515618500539199
0.75246285173447713391261007721214
0.81818548761525244498957221457878
0.87463780492010279041779342125658
0.92118023295305878509375343608311
0.95728559577808772579820803698082
0.98254550526141317487092601578638
0.99667944226059658616319153254935

0.0085169038787464096542638133022498
0.019732085056122705983859801640396
0.030740492202093622644408525374617
0.041402062518682836104830010114077
0.051594826902497923912594381179543
0.061203090657079138542109848023907
0.070117933255051278569581486948879
0.07823832713576378382814488865968
0.085472257366172527545344849297208
0.091737757139258763347966411077111
0.096963834094408606301900074882689
0.1010912737599149661218205469075
0.10407331007772937391332847128512
0.10587615509732094140659132785219
0.10647938171831424424651112690968
0.10587615509732094140659132785219
0.10407331007772937391332847128512
0.1010912737599149661218205469075
0.096963834094408606301900074882689
0.091737757139258763347966411077111
0.085472257366172527545344849297208
0.07823832713576378382814488865968
0.070117933255051278569581486948879
0.061203090657079138542109848023907
0.051594826902497923912594381179543
0.041402062518682836104830010114077
0.030740492202093622644408525374617
0.019732085056122705983859801640396
0.0085169038787464096542638133022498

30

-0.9968934840746495402716300509187
-0.98366812327974720997003258160566
-0.9600218649683075122168710255818
-0.92620004742927432587932427708047
-0.88256053579205268154311646253023
-0.8295657623827683974428981197325
-0.7677774321048261949179773409745
-0.69785049479331579693229238802664
-0.62052618298924286114047755643119
-0.53662414814201989926416979331107
-0.44703376953808917678060990032285
-0.35270472553087811347103720708937
-0.25463692616788984643980512981781
-0.15386991360858354696379467274326
-0.051471842555317695833025213166723
0.051471842555317695833025213166723
0.15386991360858354696379467274326
0.25463692616788984643980512981781
0.35270472553087811347103720708937
0.44703376953808917678060990032285
0.53662414814201989926416979331107
0.62052618298924286114047755643119
0.69785049479331579693229238802664
0.7677774321048261949179773409745
0.8295657623827683974428981197325
0.88256053579205268154311646253023
0.92620004742927432587932427708047
0.9600218649683075122168710255818
0.98366812327974720997003258160566
0.9968934840746495402716300509187

0.0079681924961666056154658834746736
0.018466468311090959142302131912047
0.028784707883323369349719179611292
0.038799192569627049596801936446348
0.048402672830594052902938140422808
0.057493156217619066481721689402056
0.065974229882180495128128515115962
0.073755974737705206268243850022191
0.08075589522942021535469493846053
0.086899787201082979802387530715126
0.092122522237786128717632707087619
0.09636873717464425963946862635181
0.099593420586795267062780282103569
0.10176238974840550459642895216855
0.10285265289355884034128563670542
0.10285265289355884034128563670542
0.10176238974840550459642895216855
0.099593420586795267062780282103569
0.09636873717464425963946862635181
0.092122522237786128717632707087619
0.086899787201082979802387530715126
0.08075589522942021535469493846053
0.073755974737705206268243850022191
0.065974229882180495128128515115962
0.057493156217619066481721689402056
0.048402672830594052902938140422808
0.038799192569627049596801936446348
0.028784707883323369349719179611292
0.018466468311090959142302131912047
0.0079681924961666056154658834746736

______________________

This post is brought to you by

Holistic Numerical Methods Open Course Ware:

Numerical Methods for the STEM undergraduate at http://nm.MathForCollege.com;

Introduction to Matrix Algebra for the STEM undergraduate at http://ma.MathForCollege.com

the textbooks on

Numerical Methods with Applications

Introduction to Programming Concepts Using MATLAB

the Massive Open Online Course (MOOCs) available at

Numerical Methods

Introduction to Matrix Algebra

## I thought Gaussian quadrature requires that the integral must be transformed to the integral limit of [-1,1]?

Question asked on YouTube: I thought Gaussian quadrature requires that the integral must be transformed to the integral limit of [-1,1]?

The document in the above image is given here. This post is brought to you by

• Holistic Numerical Methods Open Course Ware:
• the textbooks on
• the Massive Open Online Course (MOOCs) available at

To relate how quadrature formulas are derived, see a simple example of how to do so.

To relate how quadrature formulas are derived, see a simple example of how to do so

See the pdf file for solution.

______________________

This post is brought to you by

• Holistic Numerical Methods Open Course Ware:
• the textbooks on
• the Massive Open Online Course (MOOCs) available at

## Length of curve

This is a solution to the problem I gave to the class in a recent test.

A robot follows a path generated by a quadratic interpolant from x=2 to x=4.  The interpolant passes through three consecutive data points (2,4), (3,9) and (4,16) and is given by y=x2.  Find the best estimate of the length of the interpolant path from x=2 to x=4.

The solution is given as an audio pdf (also called pencast – need Adobe X reader or higher). Three methods are shown. I expected one to use Method 2 or Method 3.
http://www.eng.usf.edu/~kaw/class/EML3041/livescribe/length_of_curve.pdf

______________________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, the textbook on Introduction to Programming Concepts Using MATLAB, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos.  Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

## A MATLAB program to find quadrature points and weights for Gauss-Legendre Quadrature rule

Recently, I got a request how one can find the quadrature and weights of a Gauss-Legendre quadrature rule for large n.  It seems that the internet has these points available free of charge only up to n=12.  Below is the MATLAB program that finds these values for any n.  I tried the program for n=25 and it gave results in a minute or so.  The results output up to 32 significant digits.
_______________________________________________________

% Program to get the quadrature points
% and weight for Gauss-Legendre Quadrature
% Rule
clc
clear all
syms x
% Input n: Quad pt rule
n=14;
% Calculating the Pn(x)
% Legendre Polynomial
% Using recursive relationship
% P(order of polynomial, value of x)
% P(0,x)=1; P(1,x)=0;
% (i+1)*P(i+1,x)=(2*i+1)*x*P(i,x)-i*P(i-1,x)
m=n-1;
P0=1;
P1=x;
for i=1:1:m
Pn=((2.0*i+1)*x*P1-i*P0)/(i+1.0);
P0=P1;
P1=Pn;
end
if n==1
Pn=P1;
end
Pn=expand(Pn);
% Finding the weights
% Formula for weights is given at
% Equation (13)
for k=1:1:n
P0=1;
P1=x;
m=n;
% Calculating P(n+1,x)
for i=1:1:m
Pn=((2.0*i+1)*x*P1-i*P0)/(i+1.0);
P0=P1;
P1=Pn;
end
Pn=P1;
end
fprintf(‘Quad point rule for n=%g \n’,n)
disp(‘  ‘)
disp(‘Abscissas’)
disp(‘  ‘)
disp(‘Weights’)
disp(weights’)_______________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, the textbook on Introduction to Programming Concepts Using MATLAB, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos.  Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

## How do I integrate a discrete function in MATLAB?

Many students ask me how do I do this or that in MATLAB.  So I thought why not have a small series of my next few blogs do that.  In this blog, I show you how to integrate a discrete function.

The MATLAB program link is here.

The HTML version of the MATLAB program is here.

_____________________________________________________

%% HOW DO I DO THAT IN MATLAB SERIES?
% In this series, I am answering questions that students have asked
% me about MATLAB.  Most of the questions relate to a mathematical
% procedure.

%% TOPIC
% How do I integrate a discrete function?  Three cases of data are
% discussed.

%% SUMMARY

% Language : MATLAB 2008a;
% Authors : Autar Kaw;
% Mfile available at
% http://nm.mathforcollege.com/blog/integrationdiscrete.m;
% Last Revised : April 3, 2009;
% Abstract: This program shows you how to integrate a given discrete function.

clc
clear all

%% INTRODUCTION

disp(‘ABSTRACT’)
disp(‘   This program shows you how to integrate’)
disp(‘   a discrete function’)
disp(‘ ‘)
disp(‘AUTHOR’)
disp(‘   Autar K Kaw of https://autarkaw.wordpress.com&#8217;)
disp(‘ ‘)
disp(‘MFILE SOURCE’)
disp(‘   http://nm.mathforcollege.com/blog/integrationdiscrete.m&#8217;)
disp(‘ ‘)
disp(‘LAST REVISED’)
disp(‘   April 3, 2009’)
disp(‘ ‘)

%% CASE 1

%% INPUTS

% Integrate the discrete function y from x=1 to 6.5
% with y vs x data given as (1,2), (2,7), (4,16), (6.5,18)
% Defining the x-array
x=[1  2  4  6.5];
% Defining the y-array
y=[2  7  16  18];

%% DISPLAYING INPUTS
disp(‘____________________________________’)
disp(‘CASE#1’)
disp(‘LOWER LIMIT AND UPPER LIMITS OF INTEGRATION MATCH x(1) AND x(LAST)’)
disp(‘ ‘)
disp(‘INPUTS’)
disp(‘The x-data is’)
x
disp(‘The y-data is’)
y
fprintf(‘  Lower limit of integration, a= %g’,x(1))
fprintf(‘\n  Upper limit of integration, b= %g’,x(length(x)))
disp(‘ ‘)

%% THE CODE

intvalue=trapz(x,y);

%% DISPLAYING OUTPUTS

disp(‘OUTPUTS’)
fprintf(‘  Value of integral is = %g’,intvalue)
disp(‘  ‘)
disp(‘___________________________________________’)

%% CASE 2

%% INPUTS

% Integrate the discrete function y from x=3 to 6
% with y vs x data given as (1,2), (2,7), (4,16), (6.5,18)
% Defining the x-array
x=[1  2  4  6.5];
% Defining the y-array
y=[2  7  16  18];
% Lower limit of integration, a
a=3;
% Upper limit of integration, b
b=6;
%% DISPLAYING INPUTS

disp(‘CASE#2’)
disp(‘LOWER LIMIT AND UPPER LIMITS OF INTEGRATION DO not MATCH x(1) AND x(LAST)’)
disp(‘  ‘)
disp(‘INPUTS’)
disp(‘The x-data is’)
x
disp(‘The y-data is’)
y
fprintf(‘  Lower limit of integration, a= %g’,a)
fprintf(‘\n  Upper limit of integration, b= %g’,b)
% Choose how many divisions you want for splining from a to b
n=1000;
fprintf(‘\n  Number of subdivisions used for splining = %g’,n)
disp(‘  ‘)
disp(‘  ‘)

%% THE CODE

xx=a:(b-a)/n:b;
% Using spline to approximate the curve from x(1) to x(last)
yy=spline(x,y,xx);
intvalue=trapz(xx,yy);

%% DISPLAYING OUTPUTS

disp(‘OUTPUTS’)
fprintf(‘  Value of integral is = %g’,intvalue)
disp(‘  ‘)
disp(‘___________________________________________’)
%% CASE 3

%% INPUTS

% Integrate the discrete function y from x=1 to 6.5
% with y vs x data given as (1,2), (4,16), (2,7), (6.5,18)
% The x-data is not in ascending order
% Defining the x-array
x=[1  4   2 6.5];
% Defining the y-array
y=[2  16  7 18];
% Lower limit of integration, a
a=3;
% Upper limit of integration, b
b=6;
%% DISPLAYING INPUTS

disp(‘CASE#3’)
disp(‘LOWER LIMIT AND UPPER LIMITS OF INTEGRATION DO not MATCH x(1) AND x(LAST) ‘)
disp(‘AND X-DATA IS NOT IN ASCENDING OR DESCENDING ORDER’)
disp(‘   ‘)
disp(‘INPUTS’)
disp(‘The x-data is’)
x
disp(‘The y-data is’)
y
fprintf(‘  Lower limit of integration, a= %g’,a)
fprintf(‘\n  Upper limit of integration, b= %g’,b)
% Choose how many divisions you want for splining from a to b
n=1000;
fprintf(‘\n  Number of subdivisions used for splining = %g’,n)
disp(‘  ‘)
disp(‘  ‘)

%% THE CODE
[x,so] = sort(x); % so is the sort order
y = y(so); % y data is now in same order as x data
xx=a:(b-a)/n:b;
% Using spline to approximate the curve from x(1) to x(last)
yy=spline(x,y,xx);
intvalue=trapz(xx,yy);

%% DISPLAYING OUTPUTS

disp(‘OUTPUTS’)
fprintf(‘  Value of integral is = %g’,intvalue)
disp(‘  ‘)

____________________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.mathforcollege.com, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://nm.mathforcollege.com/videos

## How do I integrate a continuous function in MATLAB

Many students ask me how do I do this or that in MATLAB.  So I thought why not have a small series of my next few blogs do that.  In this blog I show you how to integrate a continuous function.

The MATLAB program link is here.

The HTML version of the MATLAB program is here.

___________________________________________

%% HOW DO I DO THAT IN MATLAB SERIES?
% In this series, I am answering questions that students have asked
% me about MATLAB.  Most of the questions relate to a mathematical
% procedure.

%% TOPIC
% How do I integrate a continuous function?

%% SUMMARY

% Language : Matlab 2008a;
% Authors : Autar Kaw;
% Mfile available at
% http://numericalmethods.eng.usf.edu/blog/integration.m;
% Last Revised : March 28, 2009;
% Abstract: This program shows you how to integrate a given function.
clc
clear all

%% INTRODUCTION

disp(‘ABSTRACT’)
disp(‘   This program shows you how to integrate’)
disp(‘   a given function ‘)
disp(‘ ‘)
disp(‘AUTHOR’)
disp(‘   Autar K Kaw of https://autarkaw.wordpress.com&#8217;)
disp(‘ ‘)
disp(‘MFILE SOURCE’)
disp(‘   http://numericalmethods.eng.usf.edu/blog/integration.m&#8217;)
disp(‘ ‘)
disp(‘LAST REVISED’)
disp(‘   March 29, 2009’)
disp(‘ ‘)

%% INPUTS

% Integrate exp(x)*sin(3*x) from x=2.0 to 8.7
% Define x as a symbol
syms x
% Assigning the function to be differentiated
y=exp(x)*sin(3*x);
% Assigning the lower limit
a=2.0;
% Assigning the upper limit
b=8.7;

%% DISPLAYING INPUTS

disp(‘INPUTS’)
func=[‘  The function is to be integrated is ‘ char(y)];
disp(func)
fprintf(‘  Lower limit of integration, a= %g’,a)
fprintf(‘\n  Upper limit of integration, b= %g’,b)
disp(‘  ‘)
disp(‘  ‘)

%% THE CODE

% Finding the integral using the int command
% Argument 1 is the function to be integrated
% Argument 2 is the variable with respect to which the
%    function is to be integrated – the dummy variable
% Argument 3 is the lower limit of integration
% Argument 4 is the upper imit of integration
intvalue=int(y,x,a,b);
intvalue=double(intvalue);

%% DISPLAYING OUTPUTS

disp(‘OUTPUTS’)
fprintf(‘  Value of integral is = %g’,intvalue)
disp(‘  ‘)

_________________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos

## Why keep doubling the segments for an automatic integrator based on Trapezoidal rule?

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://www.youtube.com/numericalmethodsguy.

## Can I use numerical solution of ODE techniques to do numerical integration?

Yes.

If you are finding the value of the $y=\int_{a}^{b} f(x) dx$, then we can solve the integral as an ordinary differential equation as

dy/dx=f(x), y(a)=0

We can now use any of the numerical techniques such as Euler’s methods and Runge-Kutta methods to find the value of y(b) which would be the approximate value of the integral. Use exact techniques of solving linear ODEs with fixed coefficients such as Laplace transforms, and you can have the exact value of the integral.

_____________________________________________________

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu