Merge pull request #11 from FYS3150-G2-2023/janitaws/finish-text-document
Janitaws/finish text document
This commit is contained in:
commit
34ff8a6ab9
37
README.md
37
README.md
@ -6,39 +6,32 @@
|
||||
|
||||
## Compile and run C++ programs
|
||||
|
||||
Compiling and linking is done using Make, make sure you are in the root folder. To create executable files, run shell commands
|
||||
Compiling and linking is done using Make, make sure you are in the root directory.
|
||||
|
||||
```shell
|
||||
cd src/
|
||||
make
|
||||
```
|
||||
To run `script-name`
|
||||
|
||||
```shell
|
||||
./main
|
||||
```
|
||||
|
||||
There are two ways of compiling the code.
|
||||
|
||||
The first way is to go into the src directory and compile
|
||||
There are two alternative ways to compile the code. The first alternative is to change
|
||||
directory to `src/` and compile
|
||||
|
||||
```shell
|
||||
cd src && make
|
||||
```
|
||||
|
||||
or you could use make in the project directory
|
||||
The second alternative does not involve changing directory to `src/`, use
|
||||
make in the projects root directory
|
||||
|
||||
```shell
|
||||
make code
|
||||
```
|
||||
|
||||
and it will compile everything with you needing to move into **src**.
|
||||
|
||||
You can run any of the compiled programs by going into the src directory
|
||||
and then doing
|
||||
You can run any of the compiled programs by changing directory to `src/`, then
|
||||
|
||||
```shell
|
||||
./program-name
|
||||
./test_suite
|
||||
./main
|
||||
```
|
||||
|
||||
Remove object files and executables from `src/`
|
||||
```shell
|
||||
make clean
|
||||
```
|
||||
|
||||
|
||||
@ -64,7 +57,7 @@ If you want to generate the documentation you can do
|
||||
make docs
|
||||
```
|
||||
|
||||
in the project root, and the documentation will be made into the **docs**
|
||||
in the project root, and the documentation will be made into the `docs/`
|
||||
directory.
|
||||
|
||||
## Generate project document
|
||||
@ -75,4 +68,4 @@ If you want to recompile the Pdf file, you can do
|
||||
make latex
|
||||
```
|
||||
|
||||
and a Pdf file will be produced inside the **latex** directory.
|
||||
and a Pdf file will be produced inside the `latex/` directory.
|
||||
|
||||
Binary file not shown.
BIN
latex/images/eigenvector_10.pdf
Normal file
BIN
latex/images/eigenvector_10.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
latex/output/eigenvector_10.csv
Normal file
13
latex/output/eigenvector_10.csv
Normal file
@ -0,0 +1,13 @@
|
||||
x,Vector 1,Vector 2,Vector 3,Analytic 1,Analytic 2,Analytic 3
|
||||
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
9.0909090909e-02,1.2013116562e-01,2.3053001908e-01,3.2225269916e-01,1.2013116588e-01,2.3053001915e-01,3.2225270128e-01
|
||||
1.8181818182e-01,2.3053002022e-01,3.8786838557e-01,4.2206128116e-01,2.3053001915e-01,3.8786838606e-01,4.2206128095e-01
|
||||
2.7272727273e-01,3.2225270064e-01,4.2206128186e-01,2.3053002150e-01,3.2225270128e-01,4.2206128095e-01,2.3053001915e-01
|
||||
3.6363636364e-01,3.8786838571e-01,3.2225270018e-01,-1.2013116730e-01,3.8786838606e-01,3.2225270128e-01,-1.2013116588e-01
|
||||
4.5454545455e-01,4.2206128199e-01,1.2013116659e-01,-3.8786838753e-01,4.2206128095e-01,1.2013116588e-01,-3.8786838606e-01
|
||||
5.4545454545e-01,4.2206128029e-01,-1.2013116676e-01,-3.8786838497e-01,4.2206128095e-01,-1.2013116588e-01,-3.8786838606e-01
|
||||
6.3636363636e-01,3.8786838601e-01,-3.2225270035e-01,-1.2013116452e-01,3.8786838606e-01,-3.2225270128e-01,-1.2013116588e-01
|
||||
7.2727272727e-01,3.2225270138e-01,-4.2206128196e-01,2.3053001725e-01,3.2225270128e-01,-4.2206128095e-01,2.3053001915e-01
|
||||
8.1818181818e-01,2.3053001839e-01,-3.8786838569e-01,4.2206128036e-01,2.3053001915e-01,-3.8786838606e-01,4.2206128095e-01
|
||||
9.0909090909e-01,1.2013116693e-01,-2.3053001912e-01,3.2225270306e-01,1.2013116588e-01,-2.3053001915e-01,3.2225270128e-01
|
||||
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
|
@ -1,103 +1,103 @@
|
||||
x,Vector 1,Vector 2,Vector 3
|
||||
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
9.9009900990e-03,4.3763580486e-03,-8.7484808732e-03,-1.3112140868e-02
|
||||
1.9801980198e-02,8.7484805374e-03,-1.7463118426e-02,-2.6110190173e-02
|
||||
2.9702970297e-02,1.3112137258e-02,-2.6110188342e-02,-3.8881042300e-02
|
||||
3.9603960396e-02,1.7463113948e-02,-3.4656251014e-02,-5.1313582739e-02
|
||||
4.9504950495e-02,2.1797194330e-02,-4.3068225457e-02,-6.3299631766e-02
|
||||
5.9405940594e-02,2.6110192331e-02,-5.1313581763e-02,-7.4734880361e-02
|
||||
6.9306930693e-02,3.0397918929e-02,-5.9360418816e-02,-8.5519850123e-02
|
||||
7.9207920792e-02,3.4656246898e-02,-6.7177598362e-02,-9.5560679417e-02
|
||||
8.9108910891e-02,3.8881042315e-02,-7.4734886241e-02,-1.0477000717e-01
|
||||
9.9009900990e-02,4.3068230096e-02,-8.2003031501e-02,-1.1306769719e-01
|
||||
1.0891089109e-01,4.7213744503e-02,-8.8953927224e-02,-1.2038155127e-01
|
||||
1.1881188119e-01,5.1313588425e-02,-9.5560676214e-02,-1.2664793098e-01
|
||||
1.2871287129e-01,5.5363780001e-02,-1.0179771917e-01,-1.3181231002e-01
|
||||
1.3861386139e-01,5.9360419789e-02,-1.0764092918e-01,-1.3582974462e-01
|
||||
1.4851485149e-01,6.3299627984e-02,-1.1306769819e-01,-1.3866528556e-01
|
||||
1.5841584158e-01,6.7177601217e-02,-1.1805702763e-01,-1.4029426114e-01
|
||||
1.6831683168e-01,7.0990579025e-02,-1.2258961789e-01,-1.4070249027e-01
|
||||
1.7821782178e-01,7.4734880844e-02,-1.2664793546e-01,-1.3988642874e-01
|
||||
1.8811881188e-01,7.8406882603e-02,-1.3021626991e-01,-1.3785316434e-01
|
||||
1.9801980198e-01,8.2003032834e-02,-1.3328082864e-01,-1.3462040439e-01
|
||||
2.0792079208e-01,8.5519846919e-02,-1.3582974378e-01,-1.3021627110e-01
|
||||
2.1782178218e-01,8.8953926852e-02,-1.3785316224e-01,-1.2467908375e-01
|
||||
2.2772277228e-01,9.2301946409e-02,-1.3934326062e-01,-1.1805702523e-01
|
||||
2.3762376238e-01,9.5560676953e-02,-1.4029425672e-01,-1.1040771966e-01
|
||||
2.4752475248e-01,9.8726957572e-02,-1.4070249295e-01,-1.0179772068e-01
|
||||
2.5742574257e-01,1.0179772036e-01,-1.4056637044e-01,-9.2301949636e-02
|
||||
2.6732673267e-01,1.0477000527e-01,-1.3988642578e-01,-8.2003032107e-02
|
||||
2.7722772277e-01,1.0764093290e-01,-1.3866528965e-01,-7.0990578930e-02
|
||||
2.8712871287e-01,1.1040771987e-01,-1.3690767831e-01,-5.9360423847e-02
|
||||
2.9702970297e-01,1.1306770152e-01,-1.3462040609e-01,-4.7213742425e-02
|
||||
3.0693069307e-01,1.1561828862e-01,-1.3181230529e-01,-3.4656247048e-02
|
||||
3.1683168317e-01,1.1805702504e-01,-1.2849425366e-01,-2.1797195258e-02
|
||||
3.2673267327e-01,1.2038155014e-01,-1.2467908448e-01,-8.7484830929e-03
|
||||
3.3663366337e-01,1.2258961573e-01,-1.2038155323e-01,4.3763575797e-03
|
||||
3.4653465347e-01,1.2467908410e-01,-1.1561829169e-01,1.7463115474e-02
|
||||
3.5643564356e-01,1.2664793338e-01,-1.1040771926e-01,3.0397924158e-02
|
||||
3.6633663366e-01,1.2849425248e-01,-1.0477000407e-01,4.3068226361e-02
|
||||
3.7623762376e-01,1.3021626897e-01,-9.8726953501e-02,5.5363781149e-02
|
||||
3.8613861386e-01,1.3181230641e-01,-9.2301949069e-02,6.7177599971e-02
|
||||
3.9603960396e-01,1.3328082420e-01,-8.5519846476e-02,7.8406881225e-02
|
||||
4.0594059406e-01,1.3462040441e-01,-7.8406886916e-02,8.8953928507e-02
|
||||
4.1584158416e-01,1.3582974237e-01,-7.0990582377e-02,9.8726952665e-02
|
||||
4.2574257426e-01,1.3690768207e-01,-6.3299628825e-02,1.0764092847e-01
|
||||
4.3564356436e-01,1.3785316922e-01,-5.5363784270e-02,1.1561828790e-01
|
||||
4.4554455446e-01,1.3866529183e-01,-4.7213741970e-02,1.2258961490e-01
|
||||
4.5544554455e-01,1.3934325896e-01,-3.8881046285e-02,1.2849425510e-01
|
||||
4.6534653465e-01,1.3988642934e-01,-3.0397919107e-02,1.3328083063e-01
|
||||
4.7524752475e-01,1.4029425867e-01,-2.1797194223e-02,1.3690767978e-01
|
||||
4.8514851485e-01,1.4056637371e-01,-1.3112142627e-02,1.3934326030e-01
|
||||
4.9504950495e-01,1.4070249059e-01,-4.3763545931e-03,1.4056637087e-01
|
||||
5.0495049505e-01,1.4070249237e-01,4.3763553240e-03,1.4056636855e-01
|
||||
5.1485148515e-01,1.4056636701e-01,1.3112141424e-02,1.3934326274e-01
|
||||
5.2475247525e-01,1.4029426479e-01,2.1797196040e-02,1.3690767734e-01
|
||||
5.3465346535e-01,1.3988642418e-01,3.0397922181e-02,1.3328082645e-01
|
||||
5.4455445545e-01,1.3934325818e-01,3.8881045170e-02,1.2849425588e-01
|
||||
5.5445544554e-01,1.3866528548e-01,4.7213739894e-02,1.2258961529e-01
|
||||
5.6435643564e-01,1.3785316347e-01,5.5363782200e-02,1.1561828838e-01
|
||||
5.7425742574e-01,1.3690767808e-01,6.3299625555e-02,1.0764093012e-01
|
||||
5.8415841584e-01,1.3582975080e-01,7.0990579118e-02,9.8726956974e-02
|
||||
5.9405940594e-01,1.3462040473e-01,7.8406883764e-02,8.8953931156e-02
|
||||
6.0396039604e-01,1.3328082628e-01,8.5519847508e-02,7.8406882521e-02
|
||||
6.1386138614e-01,1.3181231043e-01,9.2301955750e-02,6.7177597738e-02
|
||||
6.2376237624e-01,1.3021627254e-01,9.8726959125e-02,5.5363781584e-02
|
||||
6.3366336634e-01,1.2849425843e-01,1.0477000685e-01,4.3068225262e-02
|
||||
6.4356435644e-01,1.2664792968e-01,1.1040772008e-01,3.0397923775e-02
|
||||
6.5346534653e-01,1.2467908233e-01,1.1561828667e-01,1.7463112100e-02
|
||||
6.6336633663e-01,1.2258961618e-01,1.2038154892e-01,4.3763558959e-03
|
||||
6.7326732673e-01,1.2038155509e-01,1.2467908434e-01,-8.7484791158e-03
|
||||
6.8316831683e-01,1.1805702847e-01,1.2849425619e-01,-2.1797195967e-02
|
||||
6.9306930693e-01,1.1561828622e-01,1.3181230822e-01,-3.4656246425e-02
|
||||
7.0297029703e-01,1.1306768997e-01,1.3462040633e-01,-4.7213742058e-02
|
||||
7.1287128713e-01,1.1040771799e-01,1.3690767691e-01,-5.9360418526e-02
|
||||
7.2277227723e-01,1.0764092776e-01,1.3866528979e-01,-7.0990581227e-02
|
||||
7.3267326733e-01,1.0477000620e-01,1.3988642119e-01,-8.2003033815e-02
|
||||
7.4257425743e-01,1.0179772152e-01,1.4056636623e-01,-9.2301952893e-02
|
||||
7.5247524752e-01,9.8726952848e-02,1.4070249392e-01,-1.0179771955e-01
|
||||
7.6237623762e-01,9.5560678408e-02,1.4029425948e-01,-1.1040772236e-01
|
||||
7.7227722772e-01,9.2301954838e-02,1.3934326416e-01,-1.1805702951e-01
|
||||
7.8217821782e-01,8.8953928903e-02,1.3785316849e-01,-1.2467908256e-01
|
||||
7.9207920792e-01,8.5519848124e-02,1.3582974727e-01,-1.3021626851e-01
|
||||
8.0198019802e-01,8.2003030909e-02,1.3328082828e-01,-1.3462040327e-01
|
||||
8.1188118812e-01,7.8406885186e-02,1.3021626587e-01,-1.3785316474e-01
|
||||
8.2178217822e-01,7.4734885540e-02,1.2664793089e-01,-1.3988642777e-01
|
||||
8.3168316832e-01,7.0990582072e-02,1.2258961409e-01,-1.4070248742e-01
|
||||
8.4158415842e-01,6.7177598843e-02,1.1805702585e-01,-1.4029426160e-01
|
||||
8.5148514851e-01,6.3299627125e-02,1.1306769708e-01,-1.3866528902e-01
|
||||
8.6138613861e-01,5.9360415245e-02,1.0764093150e-01,-1.3582974369e-01
|
||||
8.7128712871e-01,5.5363784218e-02,1.0179772269e-01,-1.3181231038e-01
|
||||
8.8118811881e-01,5.1313579361e-02,9.5560678437e-02,-1.2664793139e-01
|
||||
8.9108910891e-01,4.7213741091e-02,8.8953928103e-02,-1.2038155214e-01
|
||||
9.0099009901e-01,4.3068225595e-02,8.2003031564e-02,-1.1306769867e-01
|
||||
9.1089108911e-01,3.8881045999e-02,7.4734883659e-02,-1.0477000196e-01
|
||||
9.2079207921e-01,3.4656245355e-02,6.7177597583e-02,-9.5560676903e-02
|
||||
9.3069306931e-01,3.0397926577e-02,5.9360420731e-02,-8.5519850964e-02
|
||||
9.4059405941e-01,2.6110186824e-02,5.1313584318e-02,-7.4734880388e-02
|
||||
9.5049504950e-01,2.1797196485e-02,4.3068226072e-02,-6.3299628759e-02
|
||||
9.6039603960e-01,1.7463116664e-02,3.4656247119e-02,-5.1313584252e-02
|
||||
9.7029702970e-01,1.3112143651e-02,2.6110184365e-02,-3.8881045879e-02
|
||||
9.8019801980e-01,8.7484791764e-03,1.7463117510e-02,-2.6110190428e-02
|
||||
9.9009900990e-01,4.3763588619e-03,8.7484790494e-03,-1.3112138188e-02
|
||||
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
x,Vector 1,Vector 2,Vector 3,Analytic 1,Analytic 2,Analytic 3
|
||||
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
9.9009900990e-03,4.3763580486e-03,-8.7484808732e-03,-1.3112140868e-02,4.3763573469e-03,-8.7484808507e-03,-1.3112140764e-02
|
||||
1.9801980198e-02,8.7484805374e-03,-1.7463118426e-02,-2.6110190173e-02,8.7484808507e-03,-1.7463115529e-02,-2.6110188805e-02
|
||||
2.9702970297e-02,1.3112137258e-02,-2.6110188342e-02,-3.8881042300e-02,1.3112140764e-02,-2.6110188805e-02,-3.8881044154e-02
|
||||
3.9603960396e-02,1.7463113948e-02,-3.4656251014e-02,-5.1313582739e-02,1.7463115529e-02,-3.4656246833e-02,-5.1313583715e-02
|
||||
4.9504950495e-02,2.1797194330e-02,-4.3068225457e-02,-6.3299631766e-02,2.1797195856e-02,-4.3068226575e-02,-6.3299628182e-02
|
||||
5.9405940594e-02,2.6110192331e-02,-5.1313581763e-02,-7.4734880361e-02,2.6110188805e-02,-5.1313583715e-02,-7.4734883337e-02
|
||||
6.9306930693e-02,3.0397918929e-02,-5.9360418816e-02,-8.5519850123e-02,3.0397921832e-02,-5.9360418568e-02,-8.5519847548e-02
|
||||
7.9207920792e-02,3.4656246898e-02,-6.7177598362e-02,-9.5560679417e-02,3.4656246833e-02,-6.7177599493e-02,-9.5560677562e-02
|
||||
8.9108910891e-02,3.8881042315e-02,-7.4734886241e-02,-1.0477000717e-01,3.8881044154e-02,-7.4734883337e-02,-1.0477000506e-01
|
||||
9.9009900990e-02,4.3068230096e-02,-8.2003031501e-02,-1.1306769719e-01,4.3068226575e-02,-8.2003032435e-02,-1.1306769690e-01
|
||||
1.0891089109e-01,4.7213744503e-02,-8.8953927224e-02,-1.2038155127e-01,4.7213743269e-02,-8.8953927731e-02,-1.2038155232e-01
|
||||
1.1881188119e-01,5.1313588425e-02,-9.5560676214e-02,-1.2664793098e-01,5.1313583715e-02,-9.5560677562e-02,-1.2664793125e-01
|
||||
1.2871287129e-01,5.5363780001e-02,-1.0179771917e-01,-1.3181231002e-01,5.5363781583e-02,-1.0179772170e-01,-1.3181230802e-01
|
||||
1.3861386139e-01,5.9360419789e-02,-1.0764092918e-01,-1.3582974462e-01,5.9360418568e-02,-1.0764093022e-01,-1.3582974582e-01
|
||||
1.4851485149e-01,6.3299627984e-02,-1.1306769819e-01,-1.3866528556e-01,6.3299628182e-02,-1.1306769690e-01,-1.3866528771e-01
|
||||
1.5841584158e-01,6.7177601217e-02,-1.1805702763e-01,-1.4029426114e-01,6.7177599493e-02,-1.1805702662e-01,-1.4029426076e-01
|
||||
1.6831683168e-01,7.0990579025e-02,-1.2258961789e-01,-1.4070249027e-01,7.0990580816e-02,-1.2258961664e-01,-1.4070249079e-01
|
||||
1.7821782178e-01,7.4734880844e-02,-1.2664793546e-01,-1.3988642874e-01,7.4734883337e-02,-1.2664793125e-01,-1.3988642566e-01
|
||||
1.8811881188e-01,7.8406882603e-02,-1.3021626991e-01,-1.3785316434e-01,7.8406884685e-02,-1.3021626962e-01,-1.3785316621e-01
|
||||
1.9801980198e-01,8.2003032834e-02,-1.3328082864e-01,-1.3462040439e-01,8.2003032435e-02,-1.3328082653e-01,-1.3462040445e-01
|
||||
2.0792079208e-01,8.5519846919e-02,-1.3582974378e-01,-1.3021627110e-01,8.5519847548e-02,-1.3582974582e-01,-1.3021626962e-01
|
||||
2.1782178218e-01,8.8953926852e-02,-1.3785316224e-01,-1.2467908375e-01,8.8953927731e-02,-1.3785316621e-01,-1.2467908343e-01
|
||||
2.2772277228e-01,9.2301946409e-02,-1.3934326062e-01,-1.1805702523e-01,9.2301950735e-02,-1.3934325949e-01,-1.1805702662e-01
|
||||
2.3762376238e-01,9.5560676953e-02,-1.4029425672e-01,-1.1040771966e-01,9.5560677562e-02,-1.4029426076e-01,-1.1040771973e-01
|
||||
2.4752475248e-01,9.8726957572e-02,-1.4070249295e-01,-1.0179772068e-01,9.8726955606e-02,-1.4070249079e-01,-1.0179772170e-01
|
||||
2.5742574257e-01,1.0179772036e-01,-1.4056637044e-01,-9.2301949636e-02,1.0179772170e-01,-1.4056637021e-01,-9.2301950735e-02
|
||||
2.6732673267e-01,1.0477000527e-01,-1.3988642578e-01,-8.2003032107e-02,1.0477000506e-01,-1.3988642566e-01,-8.2003032435e-02
|
||||
2.7722772277e-01,1.0764093290e-01,-1.3866528965e-01,-7.0990578930e-02,1.0764093022e-01,-1.3866528771e-01,-7.0990580816e-02
|
||||
2.8712871287e-01,1.1040771987e-01,-1.3690767831e-01,-5.9360423847e-02,1.1040771973e-01,-1.3690768069e-01,-5.9360418568e-02
|
||||
2.9702970297e-01,1.1306770152e-01,-1.3462040609e-01,-4.7213742425e-02,1.1306769690e-01,-1.3462040445e-01,-4.7213743269e-02
|
||||
3.0693069307e-01,1.1561828862e-01,-1.3181230529e-01,-3.4656247048e-02,1.1561828837e-01,-1.3181230802e-01,-3.4656246833e-02
|
||||
3.1683168317e-01,1.1805702504e-01,-1.2849425366e-01,-2.1797195258e-02,1.1805702662e-01,-1.2849425538e-01,-2.1797195856e-02
|
||||
3.2673267327e-01,1.2038155014e-01,-1.2467908448e-01,-8.7484830929e-03,1.2038155232e-01,-1.2467908343e-01,-8.7484808507e-03
|
||||
3.3663366337e-01,1.2258961573e-01,-1.2038155323e-01,4.3763575797e-03,1.2258961664e-01,-1.2038155232e-01,4.3763573469e-03
|
||||
3.4653465347e-01,1.2467908410e-01,-1.1561829169e-01,1.7463115474e-02,1.2467908343e-01,-1.1561828837e-01,1.7463115529e-02
|
||||
3.5643564356e-01,1.2664793338e-01,-1.1040771926e-01,3.0397924158e-02,1.2664793125e-01,-1.1040771973e-01,3.0397921832e-02
|
||||
3.6633663366e-01,1.2849425248e-01,-1.0477000407e-01,4.3068226361e-02,1.2849425538e-01,-1.0477000506e-01,4.3068226575e-02
|
||||
3.7623762376e-01,1.3021626897e-01,-9.8726953501e-02,5.5363781149e-02,1.3021626962e-01,-9.8726955606e-02,5.5363781583e-02
|
||||
3.8613861386e-01,1.3181230641e-01,-9.2301949069e-02,6.7177599971e-02,1.3181230802e-01,-9.2301950735e-02,6.7177599493e-02
|
||||
3.9603960396e-01,1.3328082420e-01,-8.5519846476e-02,7.8406881225e-02,1.3328082653e-01,-8.5519847548e-02,7.8406884685e-02
|
||||
4.0594059406e-01,1.3462040441e-01,-7.8406886916e-02,8.8953928507e-02,1.3462040445e-01,-7.8406884685e-02,8.8953927731e-02
|
||||
4.1584158416e-01,1.3582974237e-01,-7.0990582377e-02,9.8726952665e-02,1.3582974582e-01,-7.0990580816e-02,9.8726955606e-02
|
||||
4.2574257426e-01,1.3690768207e-01,-6.3299628825e-02,1.0764092847e-01,1.3690768069e-01,-6.3299628182e-02,1.0764093022e-01
|
||||
4.3564356436e-01,1.3785316922e-01,-5.5363784270e-02,1.1561828790e-01,1.3785316621e-01,-5.5363781583e-02,1.1561828837e-01
|
||||
4.4554455446e-01,1.3866529183e-01,-4.7213741970e-02,1.2258961490e-01,1.3866528771e-01,-4.7213743269e-02,1.2258961664e-01
|
||||
4.5544554455e-01,1.3934325896e-01,-3.8881046285e-02,1.2849425510e-01,1.3934325949e-01,-3.8881044154e-02,1.2849425538e-01
|
||||
4.6534653465e-01,1.3988642934e-01,-3.0397919107e-02,1.3328083063e-01,1.3988642566e-01,-3.0397921832e-02,1.3328082653e-01
|
||||
4.7524752475e-01,1.4029425867e-01,-2.1797194223e-02,1.3690767978e-01,1.4029426076e-01,-2.1797195856e-02,1.3690768069e-01
|
||||
4.8514851485e-01,1.4056637371e-01,-1.3112142627e-02,1.3934326030e-01,1.4056637021e-01,-1.3112140764e-02,1.3934325949e-01
|
||||
4.9504950495e-01,1.4070249059e-01,-4.3763545931e-03,1.4056637087e-01,1.4070249079e-01,-4.3763573469e-03,1.4056637021e-01
|
||||
5.0495049505e-01,1.4070249237e-01,4.3763553240e-03,1.4056636855e-01,1.4070249079e-01,4.3763573469e-03,1.4056637021e-01
|
||||
5.1485148515e-01,1.4056636701e-01,1.3112141424e-02,1.3934326274e-01,1.4056637021e-01,1.3112140764e-02,1.3934325949e-01
|
||||
5.2475247525e-01,1.4029426479e-01,2.1797196040e-02,1.3690767734e-01,1.4029426076e-01,2.1797195856e-02,1.3690768069e-01
|
||||
5.3465346535e-01,1.3988642418e-01,3.0397922181e-02,1.3328082645e-01,1.3988642566e-01,3.0397921832e-02,1.3328082653e-01
|
||||
5.4455445545e-01,1.3934325818e-01,3.8881045170e-02,1.2849425588e-01,1.3934325949e-01,3.8881044154e-02,1.2849425538e-01
|
||||
5.5445544554e-01,1.3866528548e-01,4.7213739894e-02,1.2258961529e-01,1.3866528771e-01,4.7213743269e-02,1.2258961664e-01
|
||||
5.6435643564e-01,1.3785316347e-01,5.5363782200e-02,1.1561828838e-01,1.3785316621e-01,5.5363781583e-02,1.1561828837e-01
|
||||
5.7425742574e-01,1.3690767808e-01,6.3299625555e-02,1.0764093012e-01,1.3690768069e-01,6.3299628182e-02,1.0764093022e-01
|
||||
5.8415841584e-01,1.3582975080e-01,7.0990579118e-02,9.8726956974e-02,1.3582974582e-01,7.0990580816e-02,9.8726955606e-02
|
||||
5.9405940594e-01,1.3462040473e-01,7.8406883764e-02,8.8953931156e-02,1.3462040445e-01,7.8406884685e-02,8.8953927731e-02
|
||||
6.0396039604e-01,1.3328082628e-01,8.5519847508e-02,7.8406882521e-02,1.3328082653e-01,8.5519847548e-02,7.8406884685e-02
|
||||
6.1386138614e-01,1.3181231043e-01,9.2301955750e-02,6.7177597738e-02,1.3181230802e-01,9.2301950735e-02,6.7177599493e-02
|
||||
6.2376237624e-01,1.3021627254e-01,9.8726959125e-02,5.5363781584e-02,1.3021626962e-01,9.8726955606e-02,5.5363781583e-02
|
||||
6.3366336634e-01,1.2849425843e-01,1.0477000685e-01,4.3068225262e-02,1.2849425538e-01,1.0477000506e-01,4.3068226575e-02
|
||||
6.4356435644e-01,1.2664792968e-01,1.1040772008e-01,3.0397923775e-02,1.2664793125e-01,1.1040771973e-01,3.0397921832e-02
|
||||
6.5346534653e-01,1.2467908233e-01,1.1561828667e-01,1.7463112100e-02,1.2467908343e-01,1.1561828837e-01,1.7463115529e-02
|
||||
6.6336633663e-01,1.2258961618e-01,1.2038154892e-01,4.3763558959e-03,1.2258961664e-01,1.2038155232e-01,4.3763573469e-03
|
||||
6.7326732673e-01,1.2038155509e-01,1.2467908434e-01,-8.7484791158e-03,1.2038155232e-01,1.2467908343e-01,-8.7484808507e-03
|
||||
6.8316831683e-01,1.1805702847e-01,1.2849425619e-01,-2.1797195967e-02,1.1805702662e-01,1.2849425538e-01,-2.1797195856e-02
|
||||
6.9306930693e-01,1.1561828622e-01,1.3181230822e-01,-3.4656246425e-02,1.1561828837e-01,1.3181230802e-01,-3.4656246833e-02
|
||||
7.0297029703e-01,1.1306768997e-01,1.3462040633e-01,-4.7213742058e-02,1.1306769690e-01,1.3462040445e-01,-4.7213743269e-02
|
||||
7.1287128713e-01,1.1040771799e-01,1.3690767691e-01,-5.9360418526e-02,1.1040771973e-01,1.3690768069e-01,-5.9360418568e-02
|
||||
7.2277227723e-01,1.0764092776e-01,1.3866528979e-01,-7.0990581227e-02,1.0764093022e-01,1.3866528771e-01,-7.0990580816e-02
|
||||
7.3267326733e-01,1.0477000620e-01,1.3988642119e-01,-8.2003033815e-02,1.0477000506e-01,1.3988642566e-01,-8.2003032435e-02
|
||||
7.4257425743e-01,1.0179772152e-01,1.4056636623e-01,-9.2301952893e-02,1.0179772170e-01,1.4056637021e-01,-9.2301950735e-02
|
||||
7.5247524752e-01,9.8726952848e-02,1.4070249392e-01,-1.0179771955e-01,9.8726955606e-02,1.4070249079e-01,-1.0179772170e-01
|
||||
7.6237623762e-01,9.5560678408e-02,1.4029425948e-01,-1.1040772236e-01,9.5560677562e-02,1.4029426076e-01,-1.1040771973e-01
|
||||
7.7227722772e-01,9.2301954838e-02,1.3934326416e-01,-1.1805702951e-01,9.2301950735e-02,1.3934325949e-01,-1.1805702662e-01
|
||||
7.8217821782e-01,8.8953928903e-02,1.3785316849e-01,-1.2467908256e-01,8.8953927731e-02,1.3785316621e-01,-1.2467908343e-01
|
||||
7.9207920792e-01,8.5519848124e-02,1.3582974727e-01,-1.3021626851e-01,8.5519847548e-02,1.3582974582e-01,-1.3021626962e-01
|
||||
8.0198019802e-01,8.2003030909e-02,1.3328082828e-01,-1.3462040327e-01,8.2003032435e-02,1.3328082653e-01,-1.3462040445e-01
|
||||
8.1188118812e-01,7.8406885186e-02,1.3021626587e-01,-1.3785316474e-01,7.8406884685e-02,1.3021626962e-01,-1.3785316621e-01
|
||||
8.2178217822e-01,7.4734885540e-02,1.2664793089e-01,-1.3988642777e-01,7.4734883337e-02,1.2664793125e-01,-1.3988642566e-01
|
||||
8.3168316832e-01,7.0990582072e-02,1.2258961409e-01,-1.4070248742e-01,7.0990580816e-02,1.2258961664e-01,-1.4070249079e-01
|
||||
8.4158415842e-01,6.7177598843e-02,1.1805702585e-01,-1.4029426160e-01,6.7177599493e-02,1.1805702662e-01,-1.4029426076e-01
|
||||
8.5148514851e-01,6.3299627125e-02,1.1306769708e-01,-1.3866528902e-01,6.3299628182e-02,1.1306769690e-01,-1.3866528771e-01
|
||||
8.6138613861e-01,5.9360415245e-02,1.0764093150e-01,-1.3582974369e-01,5.9360418568e-02,1.0764093022e-01,-1.3582974582e-01
|
||||
8.7128712871e-01,5.5363784218e-02,1.0179772269e-01,-1.3181231038e-01,5.5363781583e-02,1.0179772170e-01,-1.3181230802e-01
|
||||
8.8118811881e-01,5.1313579361e-02,9.5560678437e-02,-1.2664793139e-01,5.1313583715e-02,9.5560677562e-02,-1.2664793125e-01
|
||||
8.9108910891e-01,4.7213741091e-02,8.8953928103e-02,-1.2038155214e-01,4.7213743269e-02,8.8953927731e-02,-1.2038155232e-01
|
||||
9.0099009901e-01,4.3068225595e-02,8.2003031564e-02,-1.1306769867e-01,4.3068226575e-02,8.2003032435e-02,-1.1306769690e-01
|
||||
9.1089108911e-01,3.8881045999e-02,7.4734883659e-02,-1.0477000196e-01,3.8881044154e-02,7.4734883337e-02,-1.0477000506e-01
|
||||
9.2079207921e-01,3.4656245355e-02,6.7177597583e-02,-9.5560676903e-02,3.4656246833e-02,6.7177599493e-02,-9.5560677562e-02
|
||||
9.3069306931e-01,3.0397926577e-02,5.9360420731e-02,-8.5519850964e-02,3.0397921832e-02,5.9360418568e-02,-8.5519847548e-02
|
||||
9.4059405941e-01,2.6110186824e-02,5.1313584318e-02,-7.4734880388e-02,2.6110188805e-02,5.1313583715e-02,-7.4734883337e-02
|
||||
9.5049504950e-01,2.1797196485e-02,4.3068226072e-02,-6.3299628759e-02,2.1797195856e-02,4.3068226575e-02,-6.3299628182e-02
|
||||
9.6039603960e-01,1.7463116664e-02,3.4656247119e-02,-5.1313584252e-02,1.7463115529e-02,3.4656246833e-02,-5.1313583715e-02
|
||||
9.7029702970e-01,1.3112143651e-02,2.6110184365e-02,-3.8881045879e-02,1.3112140764e-02,2.6110188805e-02,-3.8881044154e-02
|
||||
9.8019801980e-01,8.7484791764e-03,1.7463117510e-02,-2.6110190428e-02,8.7484808507e-03,1.7463115529e-02,-2.6110188805e-02
|
||||
9.9009900990e-01,4.3763588619e-03,8.7484790494e-03,-1.3112138188e-02,4.3763573469e-03,8.7484808507e-03,-1.3112140764e-02
|
||||
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
x,Vector 1,Vector 2,Vector 3
|
||||
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
1.4285714286e-01,2.3192061397e-01,-4.1790650593e-01,-5.2112088916e-01
|
||||
2.8571428571e-01,4.1790650598e-01,-5.2112088916e-01,-2.3192061388e-01
|
||||
4.2857142857e-01,5.2112088920e-01,-2.3192061385e-01,4.1790650595e-01
|
||||
5.7142857143e-01,5.2112088915e-01,2.3192061400e-01,4.1790650592e-01
|
||||
7.1428571429e-01,4.1790650588e-01,5.2112088921e-01,-2.3192061394e-01
|
||||
8.5714285714e-01,2.3192061389e-01,4.1790650591e-01,-5.2112088921e-01
|
||||
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
x,Vector 1,Vector 2,Vector 3,Analytic 1,Analytic 2,Analytic 3
|
||||
0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
1.4285714286e-01,2.3192061397e-01,-4.1790650593e-01,-5.2112088916e-01,2.3192061392e-01,-4.1790650594e-01,-5.2112088917e-01
|
||||
2.8571428571e-01,4.1790650598e-01,-5.2112088916e-01,-2.3192061388e-01,4.1790650594e-01,-5.2112088917e-01,-2.3192061392e-01
|
||||
4.2857142857e-01,5.2112088920e-01,-2.3192061385e-01,4.1790650595e-01,5.2112088917e-01,-2.3192061392e-01,4.1790650594e-01
|
||||
5.7142857143e-01,5.2112088915e-01,2.3192061400e-01,4.1790650592e-01,5.2112088917e-01,2.3192061392e-01,4.1790650594e-01
|
||||
7.1428571429e-01,4.1790650588e-01,5.2112088921e-01,-2.3192061394e-01,4.1790650594e-01,5.2112088917e-01,-2.3192061392e-01
|
||||
8.5714285714e-01,2.3192061389e-01,4.1790650591e-01,-5.2112088921e-01,2.3192061392e-01,4.1790650594e-01,-5.2112088917e-01
|
||||
1.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00,0.0000000000e+00
|
||||
|
||||
|
@ -12,5 +12,5 @@ Scaling will result in a dimensionless variable $\hat{x} = \frac{1}{L}$.
|
||||
\end{align*}
|
||||
Now we insert the expression into the original equation
|
||||
\begin{align*}
|
||||
\frac{d u(\hat{x})}{d\hat{x}^{2}} &= - \frac{F L^{2}}{\gamma} u(\hat{x}) \\
|
||||
\frac{d u(\hat{x})}{d\hat{x}^{2}} &= - \frac{F L^{2}}{\gamma} u(\hat{x}). \\
|
||||
\end{align*}
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
\subsection*{a)}
|
||||
|
||||
The function for found the largest off-diagonal can be found in
|
||||
The function to find the largest off-diagonal can be found in
|
||||
\textbf{matrix.hpp} and \textbf{matrix.cpp}.
|
||||
|
||||
\subsection*{b)}
|
||||
|
||||
@ -1 +1,20 @@
|
||||
\section*{Problem 5}
|
||||
|
||||
\subsection*{a)}
|
||||
We used the Jacobi's rotation method to solve $\boldsymbol{A} \vec{v} = \lambda \vec{v}$, for $\boldsymbol{A}_{(N \cross N)}$ with $N \in [5, 100]$,
|
||||
and increased the matrix size by $3$ rows and columns for every new matrix generated. The number of similarity transformations performed for a tridiagonal matrix
|
||||
of is presented in Figure \ref{fig:transform}. We chose to run the program using dense matrices of same size as the tridiagonal matrices, to compare the scaling data.
|
||||
What we see is that the number of similarity transformations necessary to solve the system is proportional to the matrix size.
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=0.8\textwidth]{images/transform.pdf}
|
||||
\caption{Similarity transformations performed as a function of matrix size (N), data is presented in a logarithmic scale.}
|
||||
\label{fig:transform}
|
||||
\end{figure}
|
||||
|
||||
\subsection*{b)}
|
||||
For both the tridiagonal and dense matrices we are checking off-diagonal elements above the main diagonal, since these are symmetric matrices.
|
||||
The max value is found at index $(k,l)$ and for every rotation of the matrix, we update the remaining elements along row $k$ and $l$. This can lead to an increased
|
||||
value of off-diagonal elements, that previously were close to zero, and extra rotations has to be performed due to these elements. Which suggest that the
|
||||
number of similarity transformations perfomed on a matrix does not depend on its initial number of non-zero elements, making the Jacobi's rotation algorithm as
|
||||
computationally expensive for both dense and tridiagonal matrices of size $N \cross N$.
|
||||
@ -1 +1,21 @@
|
||||
\section*{Problem 6}
|
||||
|
||||
\subsection*{a)}
|
||||
The plot in Figure \ref{fig:eigenvector_10} is showing the discretization of $\hat{x}$ with $n=10$.
|
||||
The eigenvectors and corresponding analytical eigenvectors have a complete overlap suggesting the implementation of the algorithm is correct.
|
||||
We have included the boundary points for each vector to show a complete solution.
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics[width=0.8\textwidth]{images/eigenvector_10.pdf}
|
||||
\caption{The plot is showing the elements of eigenvector $\vec{v}_{1}, \vec{v}_{2}, \vec{v}_{3}$, corresponding to the three lowest eigenvalues of matrix $\boldsymbol{A} (10 \cross 10)$, against the position $\hat{x}$. The analytical eigenvectors $\vec{v}^{(1)}, \vec{v}^{(2)}, \vec{v}^{(3)}$ are also included in the plot.}
|
||||
\label{fig:eigenvector_10}
|
||||
\end{figure}
|
||||
|
||||
\subsection*{b)}
|
||||
For the discretization with $n=100$ the solution is visually close to a continuous curve, with a complete overlap of the analytical eigenvectors, presented in Figure \ref{fig:eigenvector_100}.
|
||||
\begin{figure}
|
||||
\centering
|
||||
\includegraphics[width=0.8\textwidth]{images/eigenvector_100.pdf}
|
||||
\caption{The plot is showing the elements of eigenvector $\vec{v}_{1}, \vec{v}_{2}, \vec{v}_{3}$, corresponding to the three lowest eigenvalues of matrix $\boldsymbol{A} (100 \cross 100)$, against the position $\hat{x}$. The analytical eigenvectors $\vec{v}^{(1)}, \vec{v}^{(2)}, \vec{v}^{(3)}$ are also included in the plot.}
|
||||
\label{fig:eigenvector_100}
|
||||
\end{figure}
|
||||
|
||||
40
src/main.cpp
40
src/main.cpp
@ -87,6 +87,7 @@ void write_eigenvec(int N)
|
||||
|
||||
// Create tridiagonal matrix
|
||||
arma::mat A = create_symmetric_tridiagonal(N, a, d);
|
||||
arma::mat analytic = arma::mat(N, N);
|
||||
arma::vec eigval;
|
||||
arma::mat eigvec;
|
||||
|
||||
@ -96,13 +97,36 @@ void write_eigenvec(int N)
|
||||
// Solve using Jacobi rotation method
|
||||
jacobi_eigensolver(A, 10e-14, eigval, eigvec, 100000, iters, converged);
|
||||
|
||||
// Build analytic eigenvectors
|
||||
arma::vec v, analytic_vec = arma::vec(N);
|
||||
for (int i=0; i < N; i++) {
|
||||
v = eigvec.col(i);
|
||||
|
||||
for (int j=0; j < N; j++) {
|
||||
analytic_vec(j) = std::sin(((j+1.)*(i+1.)*M_PI) / (N+1.));
|
||||
}
|
||||
|
||||
analytic_vec = arma::normalise(analytic_vec);
|
||||
|
||||
// Flip the sign of the analytic vector if they are different
|
||||
if (analytic_vec(0)*v(0) < 0.) {
|
||||
analytic_vec *= -1;
|
||||
}
|
||||
analytic.col(i) = analytic_vec;
|
||||
}
|
||||
|
||||
std::ofstream ofile;
|
||||
// Create file based on matrix size, and write header line to file
|
||||
ofile.open("../latex/output/eigenvector_" + std::to_string(N) + ".csv");
|
||||
ofile << "x,Vector 1,Vector 2,Vector 3" << std::endl;
|
||||
ofile << "x,"
|
||||
<< "Vector 1,Vector 2,Vector 3,"
|
||||
<< "Analytic 1,Analytic 2,Analytic 3" << std::endl;
|
||||
|
||||
// Add boundary value for x=0
|
||||
ofile << scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << std::endl;
|
||||
@ -113,10 +137,16 @@ void write_eigenvec(int N)
|
||||
ofile << scientific_format(x, 16)<< ","
|
||||
<< scientific_format(eigvec(i,0), 16) << ","
|
||||
<< scientific_format(eigvec(i,1), 16) << ","
|
||||
<< scientific_format(eigvec(i,2), 16) << std::endl;
|
||||
<< scientific_format(eigvec(i,2), 16) << ","
|
||||
<< scientific_format(analytic(i,0), 16) << ","
|
||||
<< scientific_format(analytic(i,1), 16) << ","
|
||||
<< scientific_format(analytic(i,2), 16) << std::endl;
|
||||
}
|
||||
// Add boundary value for x=1
|
||||
ofile << scientific_format(1., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << ","
|
||||
<< scientific_format(0., 16) << std::endl;
|
||||
@ -126,9 +156,9 @@ void write_eigenvec(int N)
|
||||
|
||||
int main()
|
||||
{
|
||||
write_transformation_tridiag(100);
|
||||
write_transformation_dense(100);
|
||||
write_eigenvec(6);
|
||||
write_transformation_tridiag(100);
|
||||
write_transformation_dense(100);
|
||||
write_eigenvec(10);
|
||||
write_eigenvec(100);
|
||||
return 0;
|
||||
}
|
||||
|
||||
19
src/plot.py
19
src/plot.py
@ -24,29 +24,28 @@ def plot_transformations(save: bool=False) -> None:
|
||||
fig.savefig("../latex/images/transform.pdf")
|
||||
|
||||
|
||||
|
||||
def plot_eigenvectors(N: int, save: bool=False) -> None:
|
||||
# Load data based on matrix size
|
||||
path = f"../latex/output/eigenvector_{N}.csv"
|
||||
eigvec = pd.read_csv(path, header=0)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
ax.plot(eigvec['x'], eigvec['Vector 1'], label='Vector 1')
|
||||
ax.plot(eigvec['x'], eigvec['Vector 2'], label='Vector 2')
|
||||
ax.plot(eigvec['x'], eigvec['Vector 3'], label='Vector 3')
|
||||
ax.plot(eigvec['x'], eigvec['Vector 1'], label=r'$\vec{v}_{1}$')
|
||||
ax.plot(eigvec['x'], eigvec['Vector 2'], label=r'$\vec{v}_{2}$')
|
||||
ax.plot(eigvec['x'], eigvec['Vector 3'], label=r'$\vec{v}_{3}$')
|
||||
ax.plot(eigvec['x'], eigvec['Analytic 1'], '--', label=r'$\vec{v}^{(1)}$')
|
||||
ax.plot(eigvec['x'], eigvec['Analytic 2'], '--', label=r'$\vec{v}^{(2)}$')
|
||||
ax.plot(eigvec['x'], eigvec['Analytic 3'], '--', label=r'$\vec{v}^{(3)}$')
|
||||
ax.set_xlabel(r'Element $\hat{x}_{i}$')
|
||||
ax.set_ylabel(r'Value of element $v_{i}$')
|
||||
ax.legend()
|
||||
ax.set_ylabel(r'Element $v_{i}$')
|
||||
ax.legend(loc='upper left')
|
||||
|
||||
# Save to file
|
||||
if save is True:
|
||||
fig.savefig(f"../latex/images/eigenvector_{N}.pdf")
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
plot_transformations(True)
|
||||
plot_eigenvectors(6, True)
|
||||
plot_eigenvectors(10, True)
|
||||
plot_eigenvectors(100, True)
|
||||
# plt.show()
|
||||
Loading…
Reference in New Issue
Block a user