puncturedfem.Monomial
Monomial of the form c * x_1 ^ alpha_1 * x_2 ^ alpha_2.
Attributes:
| Name | Type | Description |
|---|---|---|
alpha |
MultiIndex
|
Multi-index of the Monomial. |
coef |
float
|
Coefficient of the Monomial. |
__add__(other)
Define the operation self + other.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
The object to add to self. Must be another Monomial. |
required |
Returns:
| Type | Description |
|---|---|
Monomial
|
The result of the addition. |
__eq__(other, tol=1e-12)
Return True iff self == other.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
The object to compare to self. Must be another Monomial. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True iff self == other. |
__gt__(other)
Return True iff self.idx > other.idx.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
The object to compare to self. Must be another Monomial. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True iff self.idx > other.idx. |
__init__(alpha=None, coef=0.0)
Monomial of the form c * x_1 ^ alpha_1 * x_2 ^ alpha_2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha |
MultiIndex, optional
|
Multi-index of the Monomial. Default is None. |
None
|
coef |
float, optional
|
Coefficient of the Monomial. Default is 0.0. |
0.0
|
__mul__(other)
Define the operation self * other.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
The object to multiply by self. Must be a scalar (int or float) or another Monomial. |
required |
Returns:
| Type | Description |
|---|---|
Monomial
|
The result of the multiplication. |
__neg__()
Define negation operation: -self.
__repr__()
Return a string representation of self.
Returns:
| Type | Description |
|---|---|
str
|
String representation of self. |
__rmul__(other)
Define the operation: other * self.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other |
object
|
The object to multiply by self. Must be a scalar (int or float). |
required |
Returns:
| Type | Description |
|---|---|
Monomial
|
The result of the multiplication. |
copy()
eval(x, y)
Evaluate the Monomial at the point (x, y).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
FloatLike
|
x-coordinate of the point at which to evaluate the Monomial. |
required |
y |
FloatLike
|
y-coordinate of the point at which to evaluate the Monomial. |
required |
Returns:
| Type | Description |
|---|---|
FloatLike
|
Value(s) of the Monomial at the point (x, y). If x and y are arrays, the result is an array of the same shape. |
grad()
is_zero(tol=1e-12)
Return True iff self is the zero Monomial.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tol |
float, optional
|
Tolerance for the comparison. Default is 1e-12. |
1e-12
|
Returns:
| Type | Description |
|---|---|
bool
|
True iff self is the zero Monomial. |
Notes
This method is deprecated and will be removed in a future release.
partial_deriv(var)
Compute the partial derivative of self with respect to var.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var |
str
|
The variable with respect to which to differentiate. Must be one of the strings "x" or "y". |
required |
Returns:
| Type | Description |
|---|---|
Monomial
|
The partial derivative of self with respect to var. |
set_coef(coef)
Set the coefficient of the Monomial to coef.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coef |
float
|
Coefficient of the Monomial. |
required |
set_multidx(alpha)
Set the multi-index of the Monomial to alpha.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha |
MultiIndex
|
Multi-index of the Monomial. |
required |
See Also
MultiIndex: Class representing a multi-index.
set_multidx_from_idx(idx)
Set the multi-index via lexical ordering using the index idx.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
idx |
int
|
Lexical ordering index of the multi-index. |
required |
See Also
MultiIndex: Class representing a multi-index.