Exemplo n.º 1
0
def test_cfl(s):
    v = Valeur(sys=s,
               xs=np.linspace(0, 1, 2),
               ys=np.linspace(0, 1, 2),
               ts=np.linspace(0, 1, 20))
    assert v.verification_cfl()

    v = Valeur(sys=s,
               xs=np.linspace(0, 1, 2),
               ys=np.linspace(0, 1, 2),
               ts=np.linspace(0, 1, 2))
    assert not v.verification_cfl()
Exemplo n.º 2
0
def test_extremites(s):
    v = Valeur(sys=s,
               xs=np.linspace(0, 1, 2),
               ys=np.linspace(0, 1, 2),
               ts=np.linspace(0, 1, 2))
    assert v.verification_extremites()

    v = Valeur(sys=s,
               xs=np.linspace(0, 2, 2),
               ys=np.linspace(0, 1, 2),
               ts=np.linspace(0, 1, 2))
    assert not v.verification_extremites()
Exemplo n.º 3
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 perrollaz <perrollaz@vincent-MacBookPro>
#
# Distributed under terms of the MIT license.
"""
Exemple d'utilisation du module. Cas avec boite invariante.
"""

import sys
sys.path.append("..")
import matplotlib.pyplot as plt
from hjb.cartographie import Valeur
from hjb.systeme import Systeme
import hjb.affichage as aff

s = Systeme(a=1, b=2, c=2, d=1, M=1, alpha=0.4, beta=0.4, bx=1, by=1)
v = Valeur.from_dl(sys=s, T=50, dl=0.02)
v.resolution()
fc = aff.affichage_contour(v, im=10, num=21)
plt.show()
Exemplo n.º 4
0
def test_constructeur(s):
    v = Valeur.from_dl(sys=s, T=10, dl=0.1)
    assert isinstance(v, Valeur)
    assert v.verification_cfl()
    assert v.verification_extremites()
Exemplo n.º 5
0
def test_instanciation(s):
    v = Valeur(sys=s,
               xs=np.linspace(0, 1, 2),
               ys=np.linspace(0, 1, 2),
               ts=np.linspace(0, 1, 2))
    assert isinstance(v, Valeur)
Exemplo n.º 6
0
def vs(s):
    vs = Valeur(sys=s,
                xs=np.array([0, 1]),
                ys=np.array([0, 1]),
                ts=np.array([0, 0.5, 1]))
    return vs
Exemplo n.º 7
0
def v(s):
    v = Valeur.from_dl(sys=s, T=1, dl=0.1)
    return v