Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions utils/chebutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@

def chebD(n):
"""
Hint: https://people.maths.ox.ac.uk/trefethen/book.pdf, Chapter 6, pages
51-55.
Computes a spectral differentiation matrix and Chebysev grid
Parameters
----------
n: <int>
An integer defining the number of grid points (n+1)
Returns
-------
D: (n+1)x(n+1) matrix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd write np.array<float>(n+1, n+1) , but this is good!

differentiation matrix
x: (n+1)-d array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider np.array<float>(n+1,)

Chebysev grid
"""
if n == 0:
x = 1; D = 0; w = 0
Expand Down
4 changes: 2 additions & 2 deletions utils/quadroots.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def quadroots(a, b, c):
Roots of the equation.
"""

x1 = (-b + np.sqrt(b**2 - 4*a*c))/2*a
x2 = (-b - np.sqrt(b**2 - 4*a*c))/2*a
x1 = (-b + np.sqrt(b**2 - 4*a*c))/(2*a)
x2 = (-b - np.sqrt(b**2 - 4*a*c))/(2*a)

return (x1, x2)