diff options
| author | Yuri Victorovich <yuri@FreeBSD.org> | 2023-01-16 23:56:19 -0800 |
|---|---|---|
| committer | Yuri Victorovich <yuri@FreeBSD.org> | 2023-01-16 23:58:44 -0800 |
| commit | 8bd99875f247b39eb434bb43b699ee9deb05d197 (patch) | |
| tree | 56605956417b5cc85d96841becd7e01c22d3cded /math/py-pyaudi/files | |
| parent | math/audi: New port: Header only C++ library implementing the algebra of Tayl... (diff) | |
math/py-pyaudi: New port: Library implementing the algebra of Taylor polynomials
Diffstat (limited to 'math/py-pyaudi/files')
| -rw-r--r-- | math/py-pyaudi/files/patch-CMakeLists.txt | 13 | ||||
| -rw-r--r-- | math/py-pyaudi/files/test.py | 39 |
2 files changed, 52 insertions, 0 deletions
diff --git a/math/py-pyaudi/files/patch-CMakeLists.txt b/math/py-pyaudi/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..4509ec5ec8db --- /dev/null +++ b/math/py-pyaudi/files/patch-CMakeLists.txt @@ -0,0 +1,13 @@ +--- CMakeLists.txt.orig 2023-01-17 00:20:58 UTC ++++ CMakeLists.txt +@@ -1,3 +1,10 @@ ++ ++cmake_minimum_required(VERSION 3.8) ++ ++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake_modules" "${CMAKE_SOURCE_DIR}/../cmake_modules/yacma") ++ ++include(YACMAPythonSetup) ++ + # Python version check. + if(${PYTHON_VERSION_MAJOR} LESS 3) + message(FATAL_ERROR "Minimum supported Python version is 3.0") diff --git a/math/py-pyaudi/files/test.py b/math/py-pyaudi/files/test.py new file mode 100644 index 000000000000..a88096364d54 --- /dev/null +++ b/math/py-pyaudi/files/test.py @@ -0,0 +1,39 @@ +# from http://darioizzo.github.io/audi/notebooks/example00.html + +from pyaudi import gdual_double as gdual +from pyaudi import sin, cos, tan + +# Define some variables (gduals) +x,y,z = [gdual(0.,_,3) for _ in "xyz"] + +# Create a function of these variables +f = x*x+2*tan(x/(y+1))-sin(z) +print(f) + +# Extracting the derivatives +print(f.get_derivative([0,0,1])) +print(f.get_derivative({"dz": 1})) +print(f.get_derivative({"dx":1, "dy":1})) + +# Changing the point +x = gdual(1.,"x",3) +y = gdual(2.,"y",3) +z = gdual(3.,"z",3) +f = x*x+2*tan(x/(y+1))-sin(z) +print(f) + +print(f.get_derivative([0,0,1])) + +print(-cos(3.)) + +# Encapsulating f in a function call + +def f(x,y,z): + return x*x+2*tan(x/(y+1))-sin(z) + + +x = gdual(1.,"x",3) +y = gdual(2.,"y",3) +z = gdual(3.,"z",3) +print(f(x,y,z)) #Call with gduals +print(f(1.,2.,3.)) #Call with floats |
