-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
148 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# SPDX-FileCopyrightText: 2024 Alexandru Fikl <alexfikl@gmail.com> | ||
# SPDX-License-Identifier: MIT | ||
|
||
from __future__ import annotations | ||
|
||
import numpy as np | ||
|
||
from pycaputo import fracevolve, fracplot | ||
from pycaputo.fode.gallery import Chua | ||
|
||
# setup system (parameters from Figure 5.6 from [Petras2011]) | ||
alpha = (0.93, 0.99, 0.92) | ||
y0 = np.array([0.2, -0.1, 0.1]) | ||
func = Chua(alpha=10.725, beta=10.593, gamma=0.268, m=(-1.1726, -0.7872)) | ||
|
||
print(f"alpha {alpha} y0 {y0} parameters {func}") | ||
|
||
# setup controller | ||
from pycaputo.controller import make_fixed_controller | ||
|
||
dt = 5.0e-3 | ||
control = make_fixed_controller(dt, tstart=0.0, tfinal=100.0) | ||
print(control) | ||
|
||
# setup stepper | ||
from pycaputo.fode import caputo | ||
|
||
stepper = caputo.PECE( | ||
derivative_order=alpha, | ||
control=control, | ||
source=func.source, | ||
y0=(y0,), | ||
corrector_iterations=1, | ||
) | ||
|
||
solution = fracevolve(stepper, dtinit=dt) | ||
fracplot(solution, "gallery-chua") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters