Skip to content

Commit

Permalink
added switch to control the bias term in making constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Mai Peng authored and Mai Peng committed Apr 2, 2024
1 parent d6ee083 commit ff30661
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/8_trapping_sindy_examples/trapping_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ def obj_function(m, L_obj, Q_obj, P_obj):

# Define some setup and plotting functions
# Build the skew-symmetric nonlinearity constraints
def make_constraints(r):
def make_constraints(r, include_bias=True):
q = 0
N = int((r**2 + 3 * r) / 2.0) + 1 # + 1 for constant term
N = int((r**2 + 3 * r) / 2.0)
if include_bias is True:
N = N + 1 # + 1 for constant term
p = r + r * (r - 1) + int(r * (r - 1) * (r - 2) / 6.0)
constraint_zeros = np.zeros(p)
constraint_matrix = np.zeros((p, r * N))
Expand Down

0 comments on commit ff30661

Please sign in to comment.