From nobody Mon Oct 4 19:19:36 2021 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 031EB12D1379; Mon, 4 Oct 2021 19:19:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HNVs4438Kz4Wqg; Mon, 4 Oct 2021 19:19:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 584D01E8E6; Mon, 4 Oct 2021 19:19:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 194JJad3050654; Mon, 4 Oct 2021 19:19:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 194JJaqv050653; Mon, 4 Oct 2021 19:19:36 GMT (envelope-from git) Date: Mon, 4 Oct 2021 19:19:36 GMT Message-Id: <202110041919.194JJaqv050653@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 32afad732f1c - main - math/py-heyoka: Update 0.14.0 -> 0.15.0 List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32afad732f1c177ab2c0d6a29bdeae8b4f8b967d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=32afad732f1c177ab2c0d6a29bdeae8b4f8b967d commit 32afad732f1c177ab2c0d6a29bdeae8b4f8b967d Author: Yuri Victorovich AuthorDate: 2021-10-04 17:46:02 +0000 Commit: Yuri Victorovich CommitDate: 2021-10-04 19:18:27 +0000 math/py-heyoka: Update 0.14.0 -> 0.15.0 Reported by: portscout --- math/py-heyoka/Makefile | 8 +++- math/py-heyoka/distinfo | 6 +-- .../files/example-restricted-three-body-problem.py | 53 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/math/py-heyoka/Makefile b/math/py-heyoka/Makefile index 29ea55c91cc4..ca6a769fb2aa 100644 --- a/math/py-heyoka/Makefile +++ b/math/py-heyoka/Makefile @@ -1,7 +1,6 @@ PORTNAME= heyoka DISTVERSIONPREFIX= v -DISTVERSION= 0.14.0 -PORTREVISION= 1 +DISTVERSION= 0.15.0 CATEGORIES= math PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -21,6 +20,7 @@ RUN_DEPENDS= ${PYNUMPY} \ ${PYTHON_PKGNAMEPREFIX}cloudpickle>0:devel/py-cloudpickle@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}mpmath>0:math/py-mpmath@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}sympy>0:math/py-sympy@${PY_FLAVOR} +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}matplotlib>0:math/py-matplotlib@${PY_FLAVOR} USES= cmake compiler:c++17-lang python:3.7+ USE_PYTHON= flavors @@ -32,4 +32,8 @@ GH_PROJECT= ${PORTNAME}.py CMAKE_ON= HEYOKA_PY_ENABLE_IPO CMAKE_ARGS= -DFREEBSD_PYTHON_DISTVERSION=${PYTHON_DISTVERSION} +do-test: install + # integrate and plot an example + @${PYTHON_CMD} ${FILESDIR}/example-restricted-three-body-problem.py + .include diff --git a/math/py-heyoka/distinfo b/math/py-heyoka/distinfo index f0bcf70423e6..3d66af0656f3 100644 --- a/math/py-heyoka/distinfo +++ b/math/py-heyoka/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1630378504 -SHA256 (bluescarni-heyoka.py-v0.14.0_GH0.tar.gz) = 20fa3498be323ea2b51ec2ab5057c1193af3189df69ddffff42f62741b05994e -SIZE (bluescarni-heyoka.py-v0.14.0_GH0.tar.gz) = 60372207 +TIMESTAMP = 1633368323 +SHA256 (bluescarni-heyoka.py-v0.15.0_GH0.tar.gz) = 0e8c4bf0cc276e52fff3e4114dc759a6f8882fe83215279bcb156403b5d11756 +SIZE (bluescarni-heyoka.py-v0.15.0_GH0.tar.gz) = 101630534 diff --git a/math/py-heyoka/files/example-restricted-three-body-problem.py b/math/py-heyoka/files/example-restricted-three-body-problem.py new file mode 100644 index 000000000000..03500f8d4b18 --- /dev/null +++ b/math/py-heyoka/files/example-restricted-three-body-problem.py @@ -0,0 +1,53 @@ +import heyoka as hy +import numpy as np + +# Create the symbolic variables. +# from https://bluescarni.github.io/heyoka.py/notebooks/The%20restricted%20three-body%20problem.html + +x, y, z, px, py, pz = hy.make_vars("x", "y", "z", "px", "py", "pz") + +# Fix mu to 0.01. +mu = 0.01 + +rps_32 = ((x - mu)**2 + y**2 + z**2)**(-3/2.) +rpj_32 = ((x - mu + 1.)**2 + y**2 + z**2)**(-3/2.) + +# The equations of motion. +dxdt = px + y +dydt = py - x +dzdt = pz +dpxdt = py - (1. - mu) * rps_32 * (x - mu) - mu * rpj_32 * (x - mu + 1.) +dpydt = -px -((1. - mu) * rps_32 + mu * rpj_32) * y +dpzdt = -((1. - mu) * rps_32 + mu * rpj_32) * z + +# create the integrator object +ta = hy.taylor_adaptive( + # The ODEs. + [(x, dxdt), (y, dydt), (z, dzdt), + (px, dpxdt), (py, dpydt), (pz, dpzdt)], + # The initial conditions. + [-0.45, 0.80, 0.00, -0.80, -0.45, 0.58], + # Operate below machine precision + # and in high-accuracy mode. + tol = 1e-18, high_accuracy = True +) + +# integrate the RTBP up to time unit +t_grid = np.linspace(0, 200, 2500) +out = ta.propagate_grid(t_grid) +print(out) + +# plot +from matplotlib.pylab import plt +plt.rcParams["figure.figsize"] = (12,6) + +plt.subplot(1,2,1) +plt.plot(out[4][:, 0], out[4][:, 1]) +plt.xlabel("x") +plt.ylabel("y") +plt.subplot(1,2,2) +plt.plot(out[4][:, 0], out[4][:, 2]) +plt.xlabel("x") +plt.ylabel("z"); + +plt.show();