Explorar el Código

Add test for Hermite Polynomials

Nikolay hace 7 meses
padre
commit
cf50e14d8a

+ 17 - 0
Orthogonal Polynomials/CMakeLists.txt

@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.12)
+
+# set( CMAKE_CXX_COMPILER "C:/msys64/mingw64/bin/g++.exe" )
+# set( CMAKE_C_COMPILER "C:/msys64/mingw64/bin/gcc.exe" )
+
+project(
+    OrthPol
+    LANGUAGES CXX
+)
+
+set(CMAKE_CXX_STANDARD 20)
+
+add_subdirectory(modules)
+add_subdirectory(bin)
+
+enable_testing()
+add_subdirectory(TEST)

+ 5 - 0
Orthogonal Polynomials/bin/CMakeLists.txt

@@ -0,0 +1,5 @@
+add_executable(${PROJECT_NAME} main.cpp)
+
+
+target_link_libraries(${PROJECT_NAME} PRIVATE Calc)
+target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})

+ 40 - 0
Orthogonal Polynomials/bin/main.cpp

@@ -0,0 +1,40 @@
+#include "modules/OrthPol.h"
+#include <iomanip>
+#include <string>
+
+int main()
+{   std::cout << "Chebyshev Polynomial of the first kind" << std::endl;
+std::cout << "------------------------------------------------------------------------" << std::endl;
+    std::cout << std::setw(2) << "n     ";
+    for (int j=1; j <=5; j++)
+    {
+        if (j == 5)
+        {
+            std::cout << std::setw(5) << std::left << std::setprecision(8) << j * 0.2 << std::endl;
+        }
+        else
+        {
+            std::cout << std::setw(5) << std::left << std::setprecision(8) << j * 0.2 << "    ";
+        }
+    }
+    std::cout << "------------------------------------------------------------------------" << std::endl;
+    for (int i=0; i<=20; ++i)
+    {   
+        std::cout << std::setw(2) << i << "    ";
+        for (int j=1; j <=5; ++j)
+        {
+
+            std::vector<double> res = OrthPol(1, i, j*0.2);
+            if (j == 5)
+            {    
+                std::cout << std::to_string(res[0]).substr(0,8) << std::endl;        
+                //std::cout << std::setw(10) << std::right << std::setprecision(8) << res[0] << std::endl;
+            }
+            else
+            {
+                std::cout << std::to_string(res[0]).substr(0,8) << " ";  
+                //std::cout << std::setw(10) << std::right << std::setprecision(8) << res[0] << " " ;
+            }
+        }
+    }
+}