Following functions kept:
```pycon
>>> import inspect
... with_args = []
... with_kwargs = []
... for n in dir(mpmath):
... m = getattr(mpmath, n)
... try:
... s = inspect.signature(m)
... except:
... continue
... if any(_.kind == inspect._ParameterKind.VAR_POSITIONAL for _ in s.parameters.values()):
... for name in s.parameters:
... if s.parameters[name].kind == inspect._ParameterKind.VAR_POSITIONAL and name == 'args':
... with_args.append(n)
... break
... if any(_.kind == inspect._ParameterKind.VAR_KEYWORD for _ in s.parameters.values()):
... with_kwargs.append(n)
... print(with_args)
... print(with_kwargs)
...
['arange', 'ellipe', 'ellippi', 'linspace', 'matrix', 'ones', 'timing', 'zeros']
['multiplicity', 'timing']
```
We need support for multiple signatures in the first case. In the
second - it's impossible to implement these functions without kwargs.
Closes#1056
That should work at lest for 32-bit integers. Though, I think that
the repr/str representation loses all sence for precisions much
less than that ;-)
Closes#1116
* Weierstrass $\wp$: `weierp`
* inverse Weierstrass $\wp$: `weierpinv`
* derivative of Weierstrass $\wp$: `weierpprime`
* Weierstrass zeta: `weierzeta`
* Weierstrass sigma: `weiersigma`
Also adds parameter conversion functions:
* Weierstrass invariants $g_2, g_3$: `weierinvariants`
* half-periods $\omega_1, \omega_2$: `weierhalfperiods`
The idea for this PR was inspired by the `pyweierstrass` package by @stla / Stéphane Laurent:
* https://pyweierstrass.readthedocs.io/en/latest/
* https://github.com/stla/pyweierstrass
The code implementation in this PR is different to that in `pyweierstrass` although both packages derive from similar well known mathematical formulas. Differences between `pyweierstrass` and this `mpmath` implementation include but are not limited to:
* function names adapted to `mpmath` conventions;
* tau normalization: `tau` specifies the normalized period lattice `(1, tau)`, corresponding to half-periods `(1/2, tau/2)`; this differs from `pyweierstrass`, where `tau` denotes half-periods `(1, tau)`;
* support for disambiguating inverse values of Weierstrass $\wp$ by optionally passing the corresponding derivative value;
* internal refactoring of helper functions for integration with `mpmath`.
Dedicated to Stéphane Laurent who opened the original PR to request this functionality in `mpmath` and whose `pyweierstrass` package provided great utility to the author of this PR in the years since.
Co-authored-by: Stéphane Laurent <stla@users.noreply.github.com>
Closes#612
Adjusted function parameters to include an independent variable, t. Added other variations of each wave function. For square wave, added functions "squarew_floor" and "squarew_floorex". For triangle wave, added "trianglew_saw" function. For sawtooth, added functions "sawtoothw_mod" and "sawtoothw_floor".
The following things:
Added definitions, descriptions, and examples to functions "squarew", "squarew_floor", "squarew_floorex", "trianglew", "trianglew_saw", "sawtoothw", "sawtoothw_mod", "sawtooth_floor". Also added order of increasing run time for each type of signal wave.
Added logistic sigmoid function to signal.py file as well as the signal.txt file. Corrected examples in the signal.py file so that the period of each example is 2. Also, the last example of each function was correct so that input parameter t is 2 rather than 1.
Fixed typo from squarew_floorex to squarew_floor_ex
Tested the run time of all functions using 200 dps with t = 1.111111... Results were written under each function, giving both the function's return value as well as the run times.
Added type hints to all functions.
Added test file for signal.py.
Added unit triangle function to signal.txt and signal.py. Also added type hints to signal.txt and corrected sigmoid function in signal.py.
Added back signal.txt.
Changed signal files to be named signals.py and signals.txt.
Added unit triangle to test.py and fixed minor typos in docstrings.
Added 'triangle_wave' and 'sawtooth_wave'. Corrected sawtooth functions.
Removed extra wave functions and named remaining functions as squarew, trianglew, and sawtoothw. Added minor edits to function docstrings.
Removed test.py.
Corrected arguments to match those in signals.py.
Changed 'return 0' to 'return ctx.zero' and changed 'sigmoidw' to 'sigmoid'. Also changed 'signals.txt' to an rst file to match original repository.
square wave, triangle wave, sawtooth wave as a function of amplitude and period, but with really just meant as a template (largely copied from bessel.txt) from which Tina can do her work.
Added the following to mpmath/__init__.py
squarew = mp.squarew
trianglew = mp.trianglew
sawtoothw = mp.sawtoothw
unit_triangle = mp.unit_triangle
sigmoidw = mp.sigmoidw
This block was added to the bottom of the list of functions which began with "sqrt = mp.sqrt" and went up to "stirling2 = mp.stirling2".
Structure now more closely follow https://packaging.python.org/
To build docs:
python setup.py build_sphinx -c docs -b html,latex
make -C build/sphinx/latex all-pdf