Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
python-math
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thibaut.Lunet
python-math
Commits
9554ff45
Commit
9554ff45
authored
Mar 19, 2018
by
Thibaut.Lunet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TL: last sympy example
parent
8f7dc86d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
examples/sympy/README.md
examples/sympy/README.md
+4
-0
examples/sympy/blockMatrixComp.py
examples/sympy/blockMatrixComp.py
+27
-0
examples/sympy/generalMidPointInterpolation.py
examples/sympy/generalMidPointInterpolation.py
+2
-3
No files found.
examples/sympy/README.md
View file @
9554ff45
...
...
@@ -9,6 +9,10 @@ This script is a basic example of how to solve a differential equation using sym
In particular, the equation u''(t) - u(t) = exp(t) is solved, using the sympy function
[
dsolve
](
http://docs.sympy.org/latest/modules/solvers/ode.html
)
.
## [blockMatrixComputation.py](blockMatrixComputation.py)
Performs block matrix computation with non-comuutative blocks, and print latex output for the results
## [generalMidPointInterpolation.py](generalMidPointInterpolation.py)
This script compute the general formula of mid-point interpolation on one-dimensionnal uniform grids.
...
...
examples/sympy/blockMatrixComp.py
0 → 100644
View file @
9554ff45
# -*- coding: utf-8 -*-
"""
Performs block matrix computations, and print latex formula
"""
import
sympy
as
sy
sy
.
init_printing
()
# Define symbolds
A
,
B
,
C
=
sy
.
symbols
(
'A, B, C'
,
commutative
=
False
)
D
=
sy
.
symbols
(
'D'
,
commutative
=
True
)
M
=
sy
.
Matrix
([[
D
,
B
,
0
],
[
C
,
D
,
0
],
[
0
,
0
,
A
]])
# Compute symbolic operations
M1
=
M
**
2
M1
.
simplify
()
M2
=
(
M
-
sy
.
eye
(
3
))
*
M
M2
.
simplify
()
# Print latex formula
print
(
'M1 = '
)
print
(
sy
.
latex
(
M1
))
print
(
'M2 = '
)
print
(
sy
.
latex
(
M2
))
examples/sympy/generalMidPointInterpolation.py
View file @
9554ff45
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 19 18:54:50 2016
@author: t.lunet
Compute the analytical mid-point interpolation formula, for any order,
on uniform 1D grids
"""
import
sympy
as
sy
from
time
import
time
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment