Download 05.py from TestCaseGeneration/NumFEM_Eval: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/05.py
- Command line
-
hf download hf://datasets/TestCaseGeneration/NumFEM_Eval/05.py
-
curl -L -o 05.py https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/05.py
1.24 kB
| from numpy import array | |
| def legendre_interval(count): | |
| from math import sqrt | |
| if count <= 1: | |
| p = array([0.0]) | |
| w = array([2.0]) | |
| return p, w | |
| elif count == 2: | |
| p = array([-1.0 / sqrt(3.0),1.0 / sqrt(3.0)]) | |
| w = array([1.0,1.0]) | |
| return p, w | |
| elif count == 3: | |
| p = array([-sqrt(3.0 / 5.0),0.0,sqrt(3.0 / 5.0)]) | |
| w = array([5.0 / 9.0,8.0 / 9.0,5.0 / 9.0]) | |
| return p, w | |
| elif count == 4: | |
| p = array([-sqrt((3.0 + 2.0 * sqrt(6.0 / 5.0)) / 7.0),-sqrt((3.0 - 2.0 * sqrt(6.0 / 5.0)) / 7.0),sqrt((3.0 - 2.0 * sqrt(6.0 / 5.0)) / 7.0), sqrt((3.0 + 2.0 * sqrt(6.0 / 5.0)) / 7.0)]) | |
| w = array([(18.0 - sqrt(30.0)) / 36.0,(18.0 + sqrt(30.0)) / 36.0,(18.0 + sqrt(30.0)) / 36.0,(18.0 - sqrt(30.0)) / 36.0]) | |
| return p, w | |
| else: | |
| p = array([-(1.0 / 3.0) * sqrt(5.0 + 2.0 * sqrt(10.0 / 7.0)),-(1.0 / 3.0) * sqrt(5.0 - 2.0 * sqrt(10.0 / 7.0)),0.0,(1.0 / 3.0) * sqrt(5.0 - 2.0 * sqrt(10.0 / 7.0)),(1.0 / 3.0) * sqrt(5.0 + 2.0 * sqrt(10.0 / 7.0))]) | |
| w = array([(322.0 - 13.0 * sqrt(70.0)) / 900.0,(322.0 + 13.0 * sqrt(70.0)) / 900.0,128.0 / 225.0,(322.0 + 13.0 * sqrt(70.0)) / 900.0,(322.0 - 13.0 * sqrt(70.0)) / 900.0]) | |
| return p, w |