-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFirstSteps.nb
3965 lines (3828 loc) · 195 KB
/
FirstSteps.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 13.1' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 200015, 3957]
NotebookOptionsPosition[ 189556, 3784]
NotebookOutlinePosition[ 189954, 3800]
CellTagsIndexPosition[ 189911, 3797]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["First Steps with the LagrangeMesh Package", "Title",
CellChangeTimes->{{3.87147132325914*^9,
3.871471333579706*^9}},ExpressionUUID->"54988bd3-7c43-4051-a97a-\
7de9b4ec9b07"],
Cell[TextData[{
"This notebook describes a step-by-step numerical solution of the Schr\
\[ODoubleDot]dinger equation associated with the Quartic Anharmonic \
Oscillator (QAO) potential, ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
RowBox[{"V", "(", "x", ")"}], "=",
RowBox[{
RowBox[{
FractionBox["1", "2"],
SuperscriptBox["x", "2"]}], "+",
RowBox[{"g", " ",
SuperscriptBox["x", "4"]}]}]}], ","}], TraditionalForm]],
ExpressionUUID->"bfe1b373-71ac-4d19-938b-bafd0064b4d2"],
" for two different coupling constants",
Cell[BoxData[
FormBox[
RowBox[{" ",
RowBox[{
RowBox[{"g", "=", "0"}], ",", " ", "1"}]}], TraditionalForm]],
ExpressionUUID->"640eda6e-66b0-4291-a3c0-c9b0605940cf"],
". The goal of this notebook is to guide the user to obtain highly accurate \
energy estimates for a concrete problem using the LagrangeMesh Package. The \
discussion here presented can be applied to systems of different nature."
}], "Text",
CellChangeTimes->{{3.8714713707484503`*^9, 3.871471484927894*^9}, {
3.871471527017639*^9, 3.871471618539589*^9}, {3.871471685062402*^9,
3.8714716852145147`*^9}, {3.871471885785482*^9, 3.871471909026442*^9}, {
3.8714720462065153`*^9, 3.871472088536178*^9}, {3.871472958571971*^9,
3.8714729593870487`*^9}, {3.871476618079541*^9, 3.871476618681077*^9}, {
3.871477123500455*^9, 3.8714771355168*^9}, 3.871477231471682*^9, {
3.871532127731707*^9, 3.871532132274387*^9}, 3.871533663314363*^9, {
3.8715337548941603`*^9, 3.871533778342248*^9},
3.871536424179265*^9},ExpressionUUID->"355dcaf4-d6c4-4e9e-8105-\
1ebdd2450151"],
Cell[CellGroupData[{
Cell["Installation ", "Chapter",
CellChangeTimes->{{3.871530862330833*^9,
3.871530865208123*^9}},ExpressionUUID->"029f52d7-3313-4ce7-bb5e-\
944289fdbcd7"],
Cell["\<\
Once the file LagrangeMesh.wl is downloaded by the user, it is ready to be \
installed. Below, we describe two options for this purpose.\
\>", "Text",
CellChangeTimes->{{3.871530931553969*^9, 3.871530981634674*^9},
3.871533790431991*^9},ExpressionUUID->"782a35cb-00c1-45e7-8cee-\
034b1923bdc7"],
Cell[CellGroupData[{
Cell["Full Installation", "Section",
CellChangeTimes->{{3.871530901537848*^9,
3.871530909884218*^9}},ExpressionUUID->"a8341718-0738-4e0f-bbc1-\
c0a80b1d4c45"],
Cell[TextData[{
"In the Mathematica\[CloseCurlyQuote]s menu, go to File ",
Cell[BoxData[
FormBox["->", TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"5cf19477-18b2-46e7-af82-80ca18cf9063"],
" Install.\n A window will prompt you for more information. Fill in as \
follows:\n \n i. Type of Item to Install ",
Cell[BoxData[
FormBox["->", TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"0fe2ddab-5650-4103-86d6-f6f8316d913b"],
" Package\n ii. Source ",
Cell[BoxData[
FormBox["->", TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"55c69ec3-f73a-4ca1-b1fd-5e10bce85251"],
" Select file LagrangeMesh.wl \niii. Install Name ",
Cell[BoxData[
FormBox["->", TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"c4b4131e-af9f-4eba-9d95-afb5bdea620e"],
" LagrangeMesh\n iv. Click OK.\n\nOnce the installation is successful, the \
file LagrangeMesh.wl can be deleted. To load the package in a given NoteBook, \
type ",
StyleBox["Needs[\[OpenCurlyDoubleQuote]LagrangeMesh`\[CloseCurlyDoubleQuote]]\
", "Input"],
"in the command line and evaluate the cell. Each time the kernel is \
restarted, the package has to be loaded as indicated."
}], "Text",
CellChangeTimes->{{3.87153098887418*^9, 3.871531054917202*^9}, {
3.871531110127592*^9, 3.871531113661663*^9}, 3.871531244705941*^9, {
3.871531333405128*^9, 3.8715313583968*^9}, {3.87153380154429*^9,
3.871533809216159*^9}},ExpressionUUID->"5dc29d54-b1ec-4254-837f-\
d3e002c8f824"]
}, Open ]],
Cell[CellGroupData[{
Cell["Loading the Package Temporarily", "Section",
CellChangeTimes->{{3.871530914119719*^9, 3.871530924585609*^9},
3.871531063288609*^9},ExpressionUUID->"82e10e60-837f-40cf-9857-\
ebe984588bd9"],
Cell[TextData[{
"This is a simple alternative that requires no full installation. Loading \
the package is achieved by evaluating ",
StyleBox["<<\[CloseCurlyDoubleQuote]path/LagrangeMesh.wl\
\[CloseCurlyDoubleQuote] ", "Input"],
"in the command line of the notebook we want to work with. The explicit form \
of ",
StyleBox["path", "Input"],
" is found by evaluating the command ",
StyleBox["NotebookDirectory[]", "Input"],
". This option only works if the package and the notebook (in which we will \
perform calculations) are contained in the same directory. Each time the \
kernel is restarted, the package has to be loaded as indicated. In this case, \
the file LagrangeMesh.wl must not be deleted. "
}], "Text",
CellChangeTimes->{{3.8715310848995733`*^9, 3.871531101014461*^9}, {
3.871531131776145*^9, 3.8715311500308847`*^9}, {3.871531210144699*^9,
3.87153123772246*^9}, {3.871531379181363*^9, 3.871531379445867*^9},
3.871533834466235*^9},ExpressionUUID->"765ea6ea-cff3-4ab8-bb59-\
7204504062ca"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["Preliminaries", "Chapter",
CellChangeTimes->{{3.871471790959092*^9,
3.8714717934871283`*^9}},ExpressionUUID->"6e955e0a-3ac6-4f2c-9a94-\
47b8a4178820"],
Cell["\<\
The basic definition that we need is the potential. Let us construct the \
function V(x) by evaluating the next line\
\>", "Text",
CellChangeTimes->{{3.871471638027635*^9, 3.871471668660421*^9}, {
3.8714718506020937`*^9,
3.871471858424704*^9}},ExpressionUUID->"32e727e8-fa01-4baa-ae11-\
d518e723f7f1"],
Cell[BoxData[
RowBox[{
RowBox[{"V", "[", "x_", "]"}], ":=",
RowBox[{
RowBox[{
FractionBox["1", "2"],
SuperscriptBox["x", "2"]}], "+",
RowBox[{"g", " ",
SuperscriptBox["x", "4"]}]}]}]], "Input",
CellChangeTimes->{{3.8714716701514683`*^9, 3.871471696334565*^9}, {
3.871472951452351*^9, 3.871472952290661*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"c34090f7-8bc3-4d60-ae32-969ce530131a"],
Cell["\<\
Note that we have not assigned the value for the coupling constant g, we can \
do it later. Now, let us load all commands that the package provides. To do \
so, we evaluate\
\>", "Text",
CellChangeTimes->{{3.871471735070305*^9, 3.871471758116938*^9}, {
3.871471800455267*^9, 3.871471845632492*^9}, {3.871472099931963*^9,
3.87147211032027*^9}, {3.87153141413518*^9,
3.8715314145428677`*^9}},ExpressionUUID->"24dd7963-7e28-49a0-9a8a-\
7eb0b8aee2be"],
Cell[BoxData[
RowBox[{"Needs", "[", "\"\<LagrangeMesh`\>\"", "]"}]], "Input",
CellChangeTimes->{{3.87147176508871*^9, 3.8714717737528143`*^9}},
CellLabel->"In[2]:=",ExpressionUUID->"39255063-13a7-4885-a636-e322a39b2e19"],
Cell["\<\
Once the package is loaded, we proceed to construct those Hermite meshes that \
we are going to use further down: \
\>", "Text",
CellChangeTimes->{{3.871472483875201*^9, 3.871472530668892*^9}, {
3.871472672409266*^9,
3.871472674369219*^9}},ExpressionUUID->"832e6d90-493a-4ae6-9eab-\
43970d5a342f"],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{"BuildMesh", "[",
RowBox[{"\"\<Hermite\>\"", ",", "10"}], "]"}], "\[IndentingNewLine]",
RowBox[{"BuildMesh", "[",
RowBox[{"\"\<Hermite\>\"", ",", "50"}], "]"}], "\[IndentingNewLine]",
RowBox[{"BuildMesh", "[",
RowBox[{"\"\<Hermite\>\"", ",", "100"}], "]"}], "\[IndentingNewLine]",
RowBox[{"BuildMesh", "[",
RowBox[{"\"\<Hermite\>\"", ",", "10", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}], "\[IndentingNewLine]",
RowBox[{"BuildMesh", "[",
RowBox[{"\"\<Hermite\>\"", ",", "50", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}], "\[IndentingNewLine]",
RowBox[{"BuildMesh", "[",
RowBox[{"\"\<Hermite\>\"", ",", "100", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}], "\[IndentingNewLine]",
RowBox[{"BuildMesh", "[",
RowBox[{"\"\<Hermite\>\"", ",", "200", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}]}], "Input",
CellChangeTimes->{{3.8714725324881077`*^9, 3.871472643066637*^9}, {
3.871474678013934*^9, 3.8714747091363783`*^9}, {3.871475035889597*^9,
3.87147504511475*^9}, {3.871477153670288*^9, 3.871477158048395*^9}},
CellLabel->"In[3]:=",ExpressionUUID->"9842d86d-2fd0-4d1d-9547-343840908237"],
Cell[CellGroupData[{
Cell[BoxData["\<\"Hermite_10_WP_MachinePrecision.dat\"\>"], "Print",
CellChangeTimes->{{3.871474681671006*^9, 3.87147470971949*^9},
3.871531468067499*^9},
CellLabel->
"During evaluation of \
In[3]:=",ExpressionUUID->"80ef143b-a819-4257-9352-35dd6bdbff0a"],
Cell[BoxData["\<\"Hermite_50_WP_MachinePrecision.dat\"\>"], "Print",
CellChangeTimes->{{3.871474681671006*^9, 3.87147470971949*^9},
3.87153146816798*^9},
CellLabel->
"During evaluation of \
In[3]:=",ExpressionUUID->"5a224038-5de9-4bbd-aa58-03437f40a0c9"],
Cell[BoxData["\<\"Hermite_100_WP_MachinePrecision.dat\"\>"], "Print",
CellChangeTimes->{{3.871474681671006*^9, 3.87147470971949*^9},
3.8715314682712927`*^9},
CellLabel->
"During evaluation of \
In[3]:=",ExpressionUUID->"85b6a9ee-aa29-4829-9674-b4d480410459"],
Cell[BoxData["\<\"Hermite_10_WP_30.dat\"\>"], "Print",
CellChangeTimes->{{3.871474681671006*^9, 3.87147470971949*^9},
3.8715314683585663`*^9},
CellLabel->
"During evaluation of \
In[3]:=",ExpressionUUID->"aae58588-5fe5-4ea8-9509-082b9a2cc7fc"],
Cell[BoxData["\<\"Hermite_50_WP_30.dat\"\>"], "Print",
CellChangeTimes->{{3.871474681671006*^9, 3.87147470971949*^9},
3.871531468466902*^9},
CellLabel->
"During evaluation of \
In[3]:=",ExpressionUUID->"a6f7409d-ca68-42df-9ebd-c89b6e7ae782"],
Cell[BoxData["\<\"Hermite_100_WP_30.dat\"\>"], "Print",
CellChangeTimes->{{3.871474681671006*^9, 3.87147470971949*^9},
3.871531469273184*^9},
CellLabel->
"During evaluation of \
In[3]:=",ExpressionUUID->"ca2770de-1b3c-4f4c-852c-d6e3ccae5a23"],
Cell[BoxData["\<\"Hermite_200_WP_30.dat\"\>"], "Print",
CellChangeTimes->{{3.871474681671006*^9, 3.87147470971949*^9},
3.87153147623524*^9},
CellLabel->
"During evaluation of \
In[3]:=",ExpressionUUID->"2db111f7-35f8-4ae5-a2d8-5defb8631132"]
}, Open ]]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"g", "=", "0"}], TraditionalForm]],
FormatType->
TraditionalForm,ExpressionUUID->"48d712d2-3c33-4d29-8b54-5d8e54f799a4"]], \
"Chapter",
CellChangeTimes->{{3.871472704737956*^9,
3.871472708804438*^9}},ExpressionUUID->"273bd1ee-d206-469c-b075-\
beb4f17ca658"],
Cell[CellGroupData[{
Cell["Eigenvalues", "Section",
CellChangeTimes->{{3.871473425880424*^9, 3.871473428944425*^9}, {
3.87147348694657*^9,
3.871473487242271*^9}},ExpressionUUID->"b2f5c27f-9282-45a5-add0-\
5cb413114355"],
Cell[TextData[{
"At ",
Cell[BoxData[
FormBox[
RowBox[{"g", "=", "0"}], TraditionalForm]],ExpressionUUID->
"95a177bf-bffb-40e8-9fc6-003b8df01ced"],
" the potential ",
Cell[BoxData[
FormBox[
RowBox[{"V", "(", "x", ")"}], TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"0812e5d1-e3b2-4974-9599-d50003d04adc"],
" describes a harmonic oscillator. For this system, the spectrum is known in \
exact form. Let us compute the eigenvalues using ",
StyleBox["LagMeshEigenvalues", "Input"],
" with ",
Cell[BoxData[
FormBox[
RowBox[{"N", "=", "10"}], TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"6148be20-e3fe-4954-92ee-b3dc192023a0"],
" mesh points, and then compare with exact results. First, we focus on the \
first five eigenvalues."
}], "Text",
CellChangeTimes->{{3.871472717314782*^9, 3.8714727923588552`*^9}, {
3.87147284735927*^9, 3.871472871823514*^9}, {3.871472928561323*^9,
3.8714729417855673`*^9}, 3.871477297496986*^9, {3.871531509609123*^9,
3.871531535488585*^9}, {3.871531666089093*^9, 3.871531695883697*^9}, {
3.871533884820175*^9, 3.871533886596285*^9}, {3.871536666206004*^9,
3.8715366665753403`*^9}},ExpressionUUID->"2e3cad81-7b75-48d0-bf11-\
f48989427492"],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"g", "=", "0"}], ";"}], "\[IndentingNewLine]",
RowBox[{"HO", "=",
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "5",
",", "10"}], "]"}]}]}], "Input",
CellChangeTimes->{{3.871472874059533*^9, 3.871472945762542*^9}, {
3.871473167939138*^9, 3.871473170521171*^9}},
CellLabel->"In[10]:=",ExpressionUUID->"0ee767f6-0303-4266-8b44-3520117c9ec4"],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"0.49999999999999956`", ",", "1.4999999999999964`", ",",
"2.499999999999999`", ",", "3.5000000000000058`", ",",
"4.500000000000003`"}], "}"}]], "Output",
CellChangeTimes->{{3.871472890608478*^9, 3.871472963507012*^9},
3.871473170988962*^9, 3.871531561891202*^9},
CellLabel->"Out[11]=",ExpressionUUID->"1c38e80e-1f01-4f4b-ba71-25df38c36686"]
}, Open ]],
Cell[TextData[{
"As output, we obtained an ordered list that contains the first five \
eigenvalues calculated with ",
StyleBox["MachinePrecision", "Input"],
". At first glance, they look equal to the exact eigenvalues (given by ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
SubscriptBox["E", "n"], "=",
RowBox[{"n", "+",
FractionBox["1", "2"]}]}], ",", " ",
RowBox[{"n", "=", "0"}], ",",
RowBox[{"...", "4"}]}], TraditionalForm]],ExpressionUUID->
"75520481-09e6-4b35-9b59-d7715cdfc8db"],
"). We can compare results in a more detailed way:"
}], "Text",
CellChangeTimes->{{3.871472973794776*^9, 3.8714730645589533`*^9}, {
3.8714731117603083`*^9, 3.87147315523221*^9}, {3.871531636188375*^9,
3.8715316373163347`*^9}, {3.8715338888287354`*^9,
3.871533900021566*^9}},ExpressionUUID->"3bb5f1dd-ef46-433e-a38d-\
09dde8a9b54c"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"HO", "-",
RowBox[{"{",
RowBox[{
FractionBox["1", "2"], ",",
FractionBox["3", "2"], ",",
FractionBox["5", "2"], ",",
FractionBox["7", "2"], ",",
FractionBox["9", "2"]}], "}"}]}]], "Input",
CellChangeTimes->{{3.871473172995843*^9, 3.871473202017673*^9}},
CellLabel->"In[43]:=",ExpressionUUID->"eecbb0a8-9613-4c6e-b058-092f2e13bf87"],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"-", "4.440892098500626`*^-16"}], ",",
RowBox[{"-", "3.552713678800501`*^-15"}], ",",
RowBox[{"-", "8.881784197001252`*^-16"}], ",", "5.773159728050814`*^-15",
",", "2.6645352591003757`*^-15"}], "}"}]], "Output",
CellChangeTimes->{{3.8714731954536037`*^9, 3.871473202331573*^9}},
CellLabel->"Out[43]=",ExpressionUUID->"193db29c-a74e-47cd-b84d-7003ad16600f"]
}, Open ]],
Cell["\<\
The accuracy in terms of deviation is consistent with Machine precision, \
which in my computer corresponds to almost an arithmetic of 16 digits, as we \
can check by evaluating the following:\
\>", "Text",
CellChangeTimes->{{3.871473213425823*^9, 3.871473242786792*^9}, {
3.871473300924326*^9, 3.871473375935504*^9}, {3.871473611686225*^9,
3.87147361775021*^9},
3.871533923461261*^9},ExpressionUUID->"8cd0e3cc-2e65-49d5-beb7-\
cd2cfcc353aa"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"N", "[", "MachinePrecision", "]"}]], "Input",
CellChangeTimes->{{3.871473231445189*^9, 3.87147323213897*^9}, {
3.871473287068431*^9, 3.871473295604618*^9}},
CellLabel->"In[12]:=",ExpressionUUID->"293f330f-bbcd-4798-8216-dfc5763a0300"],
Cell[BoxData["15.954589770191003`"], "Output",
CellChangeTimes->{{3.8714732890827*^9, 3.871473295848596*^9},
3.8714733848929167`*^9, 3.871531592761403*^9},
CellLabel->"Out[12]=",ExpressionUUID->"e025cea1-4598-4cde-a469-1d85b8c0db13"]
}, Open ]],
Cell[TextData[{
"Keeping the number of mesh points fixed, more accurate estimates of the \
first eigenvalues can be obtained if we increase ",
StyleBox["WorkingPrecision", "Input"],
". Instead of ",
StyleBox["MachinePrecision", "Input"],
", we use an arithmetic of 30 digits."
}], "Text",
CellChangeTimes->{{3.871473448889151*^9, 3.871473479409856*^9}, {
3.871473509531546*^9, 3.871473542635984*^9}, {3.871477360659029*^9,
3.8714773626991367`*^9}, {3.8715317127854652`*^9,
3.871531724293599*^9}},ExpressionUUID->"56fac36d-b7df-4a94-b58d-\
93b658e57b10"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"HO", "=",
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "5",
",", "10", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}]}]], "Input",
CellChangeTimes->{{3.871473518539998*^9, 3.8714735187077217`*^9}, {
3.871473550885182*^9, 3.871473556980876*^9}, 3.871474576461969*^9, {
3.871477365445756*^9, 3.871477365563737*^9}},
CellLabel->"In[14]:=",ExpressionUUID->"94f1ec72-0d89-4bda-81df-9075c1161218"],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"0.50000000000000000000000000000534489841`28.255316426648278", ",",
"1.50000000000000000000000000001222291876`28.255316426648278", ",",
"2.49999999999999999999999999999424034819`28.255316426648278", ",",
"3.49999999999999999999999999997379036181`28.255316426648278", ",",
"4.49999999999999999999999999998542332162`28.255316426648278"}],
"}"}]], "Output",
CellChangeTimes->{3.871473571681726*^9, 3.871477366261066*^9,
3.8715316136514177`*^9},
CellLabel->"Out[14]=",ExpressionUUID->"f86be79c-7828-4f1c-95e3-98ffc296b880"]
}, Open ]],
Cell["Once again, let us compare with the exact spectrum", "Text",
CellChangeTimes->{{3.871473574830621*^9, 3.871473596413517*^9}, {
3.871531617054473*^9,
3.871531617994369*^9}},ExpressionUUID->"5531998f-8629-4209-8122-\
b0c2546f5103"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"HO", "-",
RowBox[{"{",
RowBox[{
FractionBox["1", "2"], ",",
FractionBox["3", "2"], ",",
FractionBox["5", "2"], ",",
FractionBox["7", "2"], ",",
FractionBox["9", "2"]}], "}"}]}]], "Input",
CellLabel->"In[16]:=",ExpressionUUID->"0a9dfa42-21dc-4d70-b3be-26bda33f333f"],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"0``28.55634642231226", ",", "0``28.0792251675926", ",",
"0``27.857376417976244", ",", "0``27.711248382298002", ",",
"0``27.602103912872934"}], "}"}]], "Output",
CellChangeTimes->{3.871473602591617*^9, 3.871531620249433*^9,
3.871531651503016*^9},
CellLabel->"Out[16]=",ExpressionUUID->"3839c962-3b78-4e19-a1c8-79c572e5d7a2"]
}, Open ]],
Cell[TextData[{
"Note that the order in deviation is almost consistent with the ",
StyleBox["WorkingPrecision", "Input"],
". "
}], "Text",
CellChangeTimes->{{3.8714736223270483`*^9,
3.871473679527725*^9}},ExpressionUUID->"fae7199b-e61c-4f2e-8099-\
6c40086e7bd1"]
}, Open ]],
Cell[CellGroupData[{
Cell["Eigenfunctions", "Section",
CellChangeTimes->{{3.871473662761836*^9,
3.871473665487854*^9}},ExpressionUUID->"ec0c7a93-f82b-4163-b083-\
a2a4a3bf18b7"],
Cell[TextData[{
"Exact expressions for eigenfunctions are known at ",
Cell[BoxData[
FormBox[
RowBox[{"g", "=", "0"}], TraditionalForm]],ExpressionUUID->
"88b0ec41-8ef6-4244-8010-e0027bb7da41"],
". In particular, we have the following normalized function for the ground \
state."
}], "Text",
CellChangeTimes->{{3.871473813291095*^9, 3.8714738635309753`*^9}, {
3.871473934278865*^9, 3.871473948776868*^9}, {3.871477399732486*^9,
3.871477407207465*^9},
3.8715340258243427`*^9},ExpressionUUID->"b6bd2ed2-8241-44e0-a33f-\
212e812986ef"],
Cell[BoxData[
RowBox[{
RowBox[{
SubscriptBox["\[Psi]", "0"], "[", "x_", "]"}], ":=",
RowBox[{
FractionBox["1",
SuperscriptBox["\[Pi]",
FractionBox["1", "4"]]],
RowBox[{"Exp", "[",
RowBox[{
RowBox[{"-",
FractionBox["1", "2"]}],
SuperscriptBox["x", "2"]}], "]"}]}]}]], "Input",
CellChangeTimes->{{3.8714738677175198`*^9, 3.871473886669483*^9}, {
3.871473922823545*^9, 3.871473928302919*^9}},
CellLabel->"In[17]:=",ExpressionUUID->"4230a206-abb3-42bc-9ad6-c799151e0280"],
Cell[TextData[{
"The ground state normalized eigenfunction can be calculated with ",
StyleBox["MachinePrecision", "Input"],
" using the package, as shown below."
}], "Text",
CellChangeTimes->{{3.871474035873663*^9, 3.8714740685309687`*^9}, {
3.871474105267686*^9, 3.871474118052239*^9}, {3.87153364842663*^9,
3.871533649938459*^9},
3.871534042055141*^9},ExpressionUUID->"f6d90fe5-ece9-441b-9b5a-\
3d6bd93a6292"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"GS", "=",
RowBox[{"LagMeshEigenfunctions", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "1",
",", "10"}], "]"}]}]], "Input",
CellChangeTimes->{{3.87147408030013*^9, 3.871474088276017*^9}, {
3.871474189144373*^9, 3.8714741917990093`*^9}},
CellLabel->"In[18]:=",ExpressionUUID->"648bf9e1-beb7-4910-8597-05d6d78dd94d"],
Cell[BoxData[
RowBox[{
SuperscriptBox["\[ExponentialE]",
RowBox[{"-",
FractionBox[
SuperscriptBox["x", "2"], "2"]}]], " ",
RowBox[{"(",
RowBox[{"0.7511255444649418`", "\[VeryThinSpace]", "+",
RowBox[{"6.217248937900877`*^-15", " ", "x"}], "+",
RowBox[{"1.536964999715451`*^-15", " ",
SuperscriptBox["x", "2"]}], "-",
RowBox[{"2.6645352591003757`*^-15", " ",
SuperscriptBox["x", "3"]}], "+",
RowBox[{"1.5959455978986625`*^-16", " ",
SuperscriptBox["x", "4"]}], "+",
RowBox[{"1.6653345369377348`*^-16", " ",
SuperscriptBox["x", "5"]}], "-",
RowBox[{"5.898059818321144`*^-17", " ",
SuperscriptBox["x", "6"]}], "-",
RowBox[{"6.938893903907228`*^-17", " ",
SuperscriptBox["x", "7"]}], "-",
RowBox[{"3.469446951953614`*^-18", " ",
SuperscriptBox["x", "8"]}], "+",
RowBox[{"1.734723475976807`*^-18", " ",
SuperscriptBox["x", "9"]}]}], ")"}]}]], "Output",
CellChangeTimes->{{3.871474083818595*^9, 3.871474090190008*^9},
3.871474124867371*^9, 3.8714741924955397`*^9, 3.871531763713131*^9},
CellLabel->"Out[18]=",ExpressionUUID->"bfc10e9c-e0f3-4773-8dca-0a965c123303"]
}, Open ]],
Cell["\<\
If we plot the absolute deviation between the exact and approximate solution \
as a function of x, it will give us an idea of the accuracy of the method. \
For this purpose, we have\
\>", "Text",
CellChangeTimes->{{3.8714741352431726`*^9, 3.8714742012708263`*^9}, {
3.871474244601776*^9, 3.871474246112159*^9}, 3.871477439876751*^9, {
3.8715317775914907`*^9, 3.8715317810670223`*^9}, {3.871534073289545*^9,
3.871534073441305*^9}},ExpressionUUID->"893e6228-cd0f-4f50-a52b-\
816615a3b8ce"],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"Abs", "[",
RowBox[{
RowBox[{
SubscriptBox["\[Psi]", "0"], "[", "x", "]"}], "-", "GS"}], "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "10"}], ",", "10"}], "}"}]}], "]"}]], "Input",
CellChangeTimes->{{3.8714742035933733`*^9, 3.8714742527368183`*^9}, {
3.871474293309534*^9, 3.871474308258665*^9}},
CellLabel->"In[19]:=",ExpressionUUID->"8406ebc8-8a10-47eb-811d-5a1c1cce50a6"],
Cell[BoxData[
GraphicsBox[{{{}, {},
TagBox[
{RGBColor[0.368417, 0.506779, 0.709798], AbsoluteThickness[1.6], Opacity[
1.], LineBox[CompressedData["
1:eJxF13s4lGkfB/BpQk6RQ4WKHFIpbUvUM/N71ym0Ha2W3rVXqjEkbMmpQmhp
Qt5KDjnuMiRSDpGkEjlkkRBiHZqQ83pzyjHe3ue+55k/5pr5XN/f737u+/fM
9cw1qqxzlvZ0Go029O31//fL/YfGl5bUS759pNU3RRN9Pmum2hdIl8ipxRCH
V32YfjJL2lD291hiI+H69dwEsrtfAvEq9LYorw/1V5QnE6I73iuXvEH5/qhM
ItLj5IGAeNInp3xKiMxl7qm03aQDFmr7CGF7cx3F42pkP02aYMi1Vrhww1XJ
fkOp3xmWZXF2W6s3knmBbznD57//crnVo0J62ESUWXghzin7iDJpod9MmIdv
W21cjF1POumjH9M88cXhfSNKpA2DHzHTXl9qcf9VkXTA5S6mbVDk6rfpa5GN
RMDv5PIsCbk1yG80gKat8tLkqjzaX4g+/H099lpmsyzyjD6sF3fMmDSWQS7x
Bmc9LeH29dLIfyeDm/DTe17S2D9wwbvZfL8sHZvLhVBP+5s/9kshu6XA/cdJ
ioW52Mp3YVBv7Y4oM+zadDitL3TsiOtK5KocOCsSMTvEwlbIBa8W1QSOFbZL
LnC8DD6+YGBLPYK0Am/n7cLY7Dz4pD/mLxYniWxYAHa7u9LLyiSQm56DQ/pu
a7Mn2PACnBTDl/91Hzv9BbjOm9jWhWMHFIPvywy5thPYGiUQae7pNzovjiz0
CiqPSf6suAt7SyXMnE7ZutdFDJ+nGrQuMpbOpooit76F4IaAnNyaFci8RujT
en1qclwEWbQF9gatlNuthL2zDZI7j5ZfMhJGtuiA8uxdAbwHy5FzeNB/ZTWY
K9Bx3g2svp+zO0/RkE92Q1HUFtMB668v0Tx4sLVEmZnrv4BM64KYIfnvvdPn
kQPaQWS1xGaThjmct4GnwbINknOz2C3Qe2ZatlkNO6ARLCP/Ef3jwAzO30Jo
xkAgnTeNXQ2lxT2LDh58V8LOwbbJ7xK/YD8Hj8/aW9cGCVw4feX4ohPfhWAk
olVZu0dgS3XvO2eaprDTIVqrrsbimcDt36vR9nD5vgVsw2pHEVeBPY8rMVIk
BC5inz0bOj6JnQSLzq+459smqfU43k4ShvcEefWVYoPNNwS5dIish5Qn3zkQ
c6eoo8N4ktpvRr541qWuCexyKGqw8V/jPUHNY7E1K+/rSYGNefSBXnNBfc3o
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
"]]},
Annotation[#, "Charting`Private`Tag$13952#1"]& ]}, {}},
AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948],
Axes->{True, True},
AxesLabel->{None, None},
AxesOrigin->{0, 0},
DisplayFunction->Identity,
Frame->{{False, False}, {False, False}},
FrameLabel->{{None, None}, {None, None}},
FrameTicks->{{Automatic, Automatic}, {Automatic, Automatic}},
GridLines->{None, None},
GridLinesStyle->Directive[
GrayLevel[0.5, 0.4]],
ImagePadding->All,
Method->{
"DefaultBoundaryStyle" -> Automatic,
"DefaultGraphicsInteraction" -> {
"Version" -> 1.2, "TrackMousePosition" -> {True, False},
"Effects" -> {
"Highlight" -> {"ratio" -> 2}, "HighlightPoint" -> {"ratio" -> 2},
"Droplines" -> {
"freeformCursorMode" -> True,
"placement" -> {"x" -> "All", "y" -> "None"}}}}, "DefaultMeshStyle" ->
AbsolutePointSize[6], "ScalingFunctions" -> None,
"CoordinatesToolOptions" -> {"DisplayFunction" -> ({
(Identity[#]& )[
Part[#, 1]],
(Identity[#]& )[
Part[#, 2]]}& ), "CopiedValueFunction" -> ({
(Identity[#]& )[
Part[#, 1]],
(Identity[#]& )[
Part[#, 2]]}& )}},
PlotRange->{{-10, 10}, {0., 2.886579864025407*^-15}},
PlotRangeClipping->True,
PlotRangePadding->{{
Scaled[0.02],
Scaled[0.02]}, {
Scaled[0.05],
Scaled[0.05]}},
Ticks->{Automatic, Automatic}]], "Output",
CellChangeTimes->{{3.871474298989876*^9, 3.871474308692651*^9},
3.8715317865021143`*^9},
CellLabel->"Out[19]=",ExpressionUUID->"78245446-6242-42b1-a39f-ef7d7749aeb4"]
}, Open ]],
Cell[TextData[{
"In this case, the order of the deviation is consistent with the requested \
accuracy. For for the harmonic oscillator, the LagrangeMesh method leads to \
the exact eigenvalues and eigenfunctions within the desired accuracy. \
Therefore, we can reduce the deviation using a larger value for ",
StyleBox["WorkingPrecision", "Input"],
" in calculations."
}], "Text",
CellChangeTimes->{{3.871474237048091*^9, 3.871474290923717*^9}, {
3.871474328699147*^9, 3.871474374987747*^9}, {3.871477175125834*^9,
3.8714771754534807`*^9}, {3.8715318536580143`*^9, 3.8715318912735147`*^9}, {
3.8715340999220753`*^9,
3.871534126898888*^9}},ExpressionUUID->"d1de4d95-3db0-4df8-987b-\
63d6db0ffa9c"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[TextData[Cell[BoxData[
FormBox[
RowBox[{"g", "=", "1"}],
TraditionalForm]],ExpressionUUID->"b4b5287a-19b8-4dd2-8694-ad18d14383b0"]], \
"Chapter",
CellChangeTimes->{{3.871474394476552*^9,
3.871474397398645*^9}},ExpressionUUID->"3f5faca9-2810-4ae4-ae90-\
ea5b316d84aa"],
Cell[CellGroupData[{
Cell["Eigenvalues ", "Section",
CellChangeTimes->{{3.871475248205168*^9,
3.871475252021737*^9}},ExpressionUUID->"0c7475a3-6e6a-4e4c-a601-\
2943b5ecc75b"],
Cell[TextData[{
"At ",
Cell[BoxData[
FormBox[
RowBox[{"g", "=", "1"}], TraditionalForm]],ExpressionUUID->
"d76ef1af-86ee-4af0-9ce6-f450fcd1a535"],
" the potential ",
Cell[BoxData[
FormBox[
RowBox[{"V", "(", "x", ")"}], TraditionalForm]],ExpressionUUID->
"cca1989f-90b9-47c4-bc5f-704748f3fef0"],
" admits no exact solutions. A natural question arises: how can we study the \
accuracy of our results? We will focus the discussion on the ground state \
only. But similar considerations can be made for excited states. Firstly, we \
calculate the energy with ",
Cell[BoxData[
FormBox[
RowBox[{"N", "=", "10"}], TraditionalForm]],ExpressionUUID->
"b93ae803-0bea-4b57-a78e-6be81ba2d4e3"],
" mesh points and ",
StyleBox["MachinePrecision.", "Input"],
" Gradually we will increase the value of ",
Cell[BoxData[
FormBox["N", TraditionalForm]],ExpressionUUID->
"56769b04-3372-42c0-b041-cdc5eee78fc3"],
" up to ",
Cell[BoxData[
FormBox[
RowBox[{"N", "=", "100"}], TraditionalForm]],ExpressionUUID->
"698ced5e-e758-4d9c-81ca-9e4f2b3d5737"],
" and modify ",
StyleBox["WorkingPrecision", "Input"],
" accordingly. "
}], "Text",
CellChangeTimes->{{3.871474407661077*^9, 3.871474568345785*^9}, {
3.871474607075282*^9, 3.871474637828004*^9}, {3.871474721910283*^9,
3.871474726737927*^9}, {3.871474864130657*^9, 3.871474865826951*^9}, {
3.871477481062725*^9, 3.871477481622672*^9}, {3.8715319446542273`*^9,
3.871531960413677*^9}, {3.871532040567762*^9, 3.871532052088911*^9},
3.871534157884727*^9, {3.871536702198142*^9,
3.87153671452507*^9}},ExpressionUUID->"d7081d4d-5b6c-43b6-908b-\
4b825c2d2645"],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"g", "=", "1"}], ";"}], "\[IndentingNewLine]",
RowBox[{"NumberForm", "[",
RowBox[{
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "1",
",", "10"}], "]"}], ",", "15"}], "]"}], "\[IndentingNewLine]",
RowBox[{"NumberForm", "[",
RowBox[{
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "1",
",", "50"}], "]"}], ",", "15"}], "]"}], "\[IndentingNewLine]",
RowBox[{"NumberForm", "[",
RowBox[{
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "1",
",", "100"}], "]"}], ",", "15"}], "]"}]}], "Input",
CellChangeTimes->{{3.871474584434451*^9, 3.871474597581444*^9}, {
3.8714746948073606`*^9, 3.87147474828811*^9}, {3.8714747822120047`*^9,
3.871474805793789*^9}},
CellLabel->"In[20]:=",ExpressionUUID->"75365fec-7a8c-4290-8c7e-0cf410ef1afa"],
Cell[BoxData[
TagBox[
InterpretationBox[
StyleBox["\<\"0.805461942299127\"\>",
ShowStringCharacters->False],
0.8054619422991274,
AutoDelete->True],
NumberForm[#, 15]& ]], "Output",
CellChangeTimes->{{3.8714745880959578`*^9, 3.8714745979888563`*^9}, {
3.871474668774322*^9, 3.8714746987390957`*^9}, {3.871474736533684*^9,
3.87147475937278*^9}, 3.871474806627331*^9, 3.871532189083344*^9},
CellLabel->
"Out[21]//NumberForm=",ExpressionUUID->"5f7a2b98-00f1-45d6-b02f-\
99eed9490c79"],
Cell[BoxData[
TagBox[
InterpretationBox[
StyleBox["\<\"0.803770651211246\"\>",
ShowStringCharacters->False],
0.8037706512112461,
AutoDelete->True],
NumberForm[#, 15]& ]], "Output",
CellChangeTimes->{{3.8714745880959578`*^9, 3.8714745979888563`*^9}, {
3.871474668774322*^9, 3.8714746987390957`*^9}, {3.871474736533684*^9,
3.87147475937278*^9}, 3.871474806627331*^9, 3.871532189260651*^9},
CellLabel->
"Out[22]//NumberForm=",ExpressionUUID->"5e9e3d26-e747-4812-bd00-\
359604f8726e"],
Cell[BoxData[
TagBox[
InterpretationBox[
StyleBox["\<\"0.803770654796773\"\>",
ShowStringCharacters->False],
0.8037706547967726,
AutoDelete->True],
NumberForm[#, 15]& ]], "Output",
CellChangeTimes->{{3.8714745880959578`*^9, 3.8714745979888563`*^9}, {
3.871474668774322*^9, 3.8714746987390957`*^9}, {3.871474736533684*^9,
3.87147475937278*^9}, 3.871474806627331*^9, 3.871532189515367*^9},
CellLabel->
"Out[23]//NumberForm=",ExpressionUUID->"3e5c8497-f1f6-4b54-a59d-\
f64a51aa246c"]
}, Open ]],
Cell[TextData[{
"Secondly, we consider the same mesh points, but with a higher value of ",
StyleBox["WorkingPrecision", "Input"],
" and compare with previous results. "
}], "Text",
CellChangeTimes->{{3.871474889139419*^9, 3.8714749472872257`*^9}, {
3.8714750732636633`*^9, 3.8714750797762203`*^9}, {3.871477635674931*^9,
3.871477637179133*^9}},ExpressionUUID->"891f8082-47da-44aa-8562-\
a23fd348c424"],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "1", ",",
"10", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}], "\[IndentingNewLine]",
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "1", ",",
"50", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}], "\[IndentingNewLine]",
RowBox[{"LagMeshEigenvalues", "[",
RowBox[{
RowBox[{"V", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "\[Infinity]"}], ",", "\[Infinity]"}], "}"}], ",", "1", ",",
"100", ",",
RowBox[{"WorkingPrecision", "->", "30"}]}], "]"}]}], "Input",
CellChangeTimes->{{3.871474959061297*^9, 3.871474994192808*^9}},
CellLabel->"In[24]:=",ExpressionUUID->"4e894b39-ea01-4a1a-ba49-da66db5b634b"],
Cell[BoxData["0.80546194229912446852218241962179312949`28.255316426648278"], \
"Output",
CellChangeTimes->{{3.8714749796887293`*^9, 3.871474994867535*^9},
3.871532205196271*^9},
CellLabel->"Out[24]=",ExpressionUUID->"b4d1bb61-4519-4166-9c9f-3d4f1fabf855"],
Cell[BoxData["0.8037706512133755587607621055711175969`27.155979721280822"], \
"Output",
CellChangeTimes->{{3.8714749796887293`*^9, 3.871474994867535*^9},
3.871532205701845*^9},
CellLabel->"Out[25]=",ExpressionUUID->"a7addde2-1b13-44c6-87ba-90f076c2bff1"],
Cell[BoxData["0.80377065123427376830457826716866963381`26.906705973507034"], \
"Output",
CellChangeTimes->{{3.8714749796887293`*^9, 3.871474994867535*^9},
3.871532207658729*^9},
CellLabel->"Out[26]=",ExpressionUUID->"505a374f-b06f-4c05-9a75-447fd104e775"]
}, Open ]],
Cell[TextData[{
"Note that the estimates are similar, but they do not coincide in all \
displayed digits despite the fact the number of mesh points does. In this \
case, we observe that ",
StyleBox["MachinePrecision", "Input"],
" is not enough to see the real scope of the LagMeshEigenvalues: numerical \
errors contaminate our calculations, especially for large meshes. Note that \
results for ",
Cell[BoxData[
FormBox[
RowBox[{"N", "=", "50"}], TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"cbe3947b-75e4-4dc4-b86a-d247f85bd097"],
" and ",
Cell[BoxData[
FormBox[
RowBox[{"N", "=", "100"}], TraditionalForm]],
FormatType->TraditionalForm,ExpressionUUID->
"7a6f2230-1acc-4278-b014-3de9cdf35bda"],
" mesh points predict the same energy within the first 11 decimal digits. As \
heuristic remarks about the QAO, the larger value of ",
StyleBox["WorkingPrecision", "Input"],
" we use, the smaller numerical errors associated with arithmetic \
operations are involved. On the other hand, the larger the mesh, the more \
accurate results. "