Skip to content

Commit

Permalink
Release Symbolica 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benruijl committed May 13, 2024
1 parent 9fe3dcc commit bdc19e1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name = "symbolica"
readme = "Readme.md"
repository = "https://github.com/benruijl/symbolica"
rust-version = "1.73"
version = "0.4.0"
version = "0.5.0"

[profile.release]
codegen-units = 1
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If you want to use Symbolica as a library in Rust, simply include it in the `Car

```toml
[dependencies]
symbolica = "0.4"
symbolica = "0.5"
```

# Examples
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ keywords = ["math", "algebra", "polynomial", "expression", "manipulation"]
license = {file = "License.md"}
name = "symbolica"
readme = "Readme.md"
version = "0.4.0"
version = "0.5.0"

classifiers = [
"Development Status :: 3 - Alpha",
Expand Down
29 changes: 23 additions & 6 deletions src/api/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,10 @@ macro_rules! req_wc_cmp {

#[pymethods]
impl PythonExpression {
/// Create a new symbol from a `name`. Can be turned into a symmetric symbol
/// using `is_symmetric=True` or into an antisymmetric symbol using `is_antisymmetric=True`.
/// The symbol can be made multilinear using `is_linear=True`. If no attributes
/// Create a new symbol from a `name`. Symbols carry information about their attributes.
/// The symbol can signal that it is symmetric if it is used as a function
/// using `is_symmetric=True`, antisymmetric using `is_antisymmetric=True`, and
/// multilinear using `is_linear=True`. If no attributes
/// are specified, the attributes are inherited from the symbol if it was already defined,
/// otherwise all attributes are set to `false`.
///
Expand All @@ -1296,7 +1297,7 @@ impl PythonExpression {
/// >>> print(e)
/// x**2 + 5
///
/// Define a regular symbol and use it as a function symbol:
/// Define a regular symbol and use it as a function:
/// >>> f = Expression.symbol('f')
/// >>> e = f(1,2)
/// >>> print(e)
Expand Down Expand Up @@ -1351,7 +1352,14 @@ impl PythonExpression {
Ok(Atom::new_var(id).into())
}

/// Create a Symbolica variable for every name in `*names`.
/// Create a Symbolica symbol for every name in `*names`. See `Expression.symbol` for more information.
///
/// Examples
/// --------
/// >>> f, x = Expression.symbols('x', 'f')
/// >>> e = f(1,x)
/// >>> print(e)
/// f(1,x)
#[pyo3(signature = (*args,is_symmetric=None,is_antisymmetric=None,is_linear=None))]
#[classmethod]
pub fn symbols(
Expand Down Expand Up @@ -3095,7 +3103,16 @@ impl PythonExpression {
}
}

/// A Symbolica term streamer.
/// A series expansion class.
///
/// Supports standard arithmetic operations, such
/// as addition and multiplication.
///
/// Examples
/// --------
/// >>> x = Expression.symbol('x')
/// >>> s = Expression.parse("(1-cos(x))/sin(x)").series(x, 0, 4)
/// >>> print(s)
#[pyclass(name = "Series", module = "symbolica")]
pub struct PythonSeries {
pub series: Series<AtomField>,
Expand Down
33 changes: 27 additions & 6 deletions symbolica.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ class Expression:
@classmethod
def symbol(_cls, name: str, is_symmetric: Optional[bool] = None, is_antisymmetric: Optional[bool] = None, is_linear: Optional[bool] = None) -> Expression:
"""
Create a new symbol from a `name`. Can be turned into a symmetric function
using `is_symmetric=True` or into an antisymmetric function using `is_antisymmetric=True`.
The function can be made multilinear using `is_linear=True`. If no attributes
Create a new symbol from a `name`. Symbols carry information about their attributes.
The symbol can signal that it is symmetric if it is used as a function
using `is_symmetric=True`, antisymmetric using `is_antisymmetric=True`, and
multilinear using `is_linear=True`. If no attributes
are specified, the attributes are inherited from the symbol if it was already defined,
otherwise all attributes are set to `false`.
Once attributes are defined on a function, they cannot be redefined later.
Once attributes are defined on a symbol, they cannot be redefined later.
Examples
--------
Expand All @@ -130,7 +131,7 @@ class Expression:
>>> print(e)
x**2 + 5
Define a regular symbol and use it as a function symbol:
Define a regular symbol and use it as a function:
>>> f = Expression.symbol('f')
>>> e = f(1,2)
>>> print(e)
Expand All @@ -154,7 +155,14 @@ class Expression:
@classmethod
def symbols(_cls, *names: str, is_symmetric: Optional[bool] = None, is_antisymmetric: Optional[bool] = None, is_linear: Optional[bool] = None) -> Sequence[Expression]:
"""
Create a Symbolica function for every name in `*names`.
Create a Symbolica symbol for every name in `*names`. See `Expression.symbol` for more information.
Examples
--------
>>> f, x = Expression.symbols('x', 'f')
>>> e = f(1,x)
>>> print(e)
f(1,x)
"""

@overload
Expand Down Expand Up @@ -1360,6 +1368,19 @@ class Transformer:


class Series:
"""
A series expansion class.
Supports standard arithmetic operations, such
as addition and multiplication.
Examples
--------
>>> x = Expression.symbol('x')
>>> s = Expression.parse("(1-cos(x))/sin(x)").series(x, 0, 4)
>>> print(s)
"""

def __add__(self, other: Series) -> Series:
"""Add two series together, returning the result."""

Expand Down

0 comments on commit bdc19e1

Please sign in to comment.