Skip to main content

Convenience imports and scientific functions.

Project description

Imports and command fxy with parameters to import libraries often used in research to emulate CAS software, or LAB software.

Introduction

  1. People coming from R, love that you can start quickly using it as a CALCulator,

  2. People coming from use of CAS tools like Maple, Mathematica have isympy, that is narrowly focused,

  3. People coming from computing LAB languages Matlab and R may find that Python requires quite a few imports just to do equivalent computing in Python.

This package fxy is a shorthand to do the imports packages to approximate these domains (CALC, CAS, and LAB) you’ve got a command fxy, that starts Python with needed packages pre-imported: so, you can start using Python like a calculator right away.

Installation

  • pip install fxy to get the import shortcuts.

Use as a calculator

`` $ fxy `` (pass, -i for IPython)

Usage as imports

  • from fxy.calc import * for quick CALC - basic mpmath calculator, and eday for time

  • from fxy.cas import * for basic CAS software (“Symbolic”) emulation

  • from fxy.lab import * for LAB software (“Numeric”) emulation

  • from fxy.plot import * for plotting imports.

Usage as command

The package defines the fxy command, if you just want Python with something, run:

  • $ fxy --calc starts Python with CALC imports (basic mpmath calculator)

  • $ fxy --cas (or -x) starts Python with CAS (Computer Algebra System) imports (to emulate Maple, Matematica,..)

  • $ fxy --lab (or -y) starts Python with LAB (Linear AlgeBra system) imports (to emulate MATLAB, R,…)

  • $ fxy --plot (or -p) for plotting imports

So, for example, if you want LAB imports with plotting and in IPython, then you’d:

  • $ fxy -ip --lab

You can also run the equivalent of –calc environment, that imports mpmath and eday, like this:

`` python -m fxy “pi**2” ``

The following are usage examples.

CALC

>>> from fxy.calc import *
>>> pi
<pi: 3.14159~>
>>> mp.dps = 250
>>> print(pi)

>>> from fxy.plot import *
>>> plt.plot([1, 2, 3, 4])
>>> plt.ylabel('some numbers')
>>> plt.show()

CAS

>>> from fxy.cas import *
>>> f = x**4 - 4*x**3 + 4*x**2 - 2*x + 3
>>> f.subs([(x, 2), (y, 4), (z, 0)])
-1
>>> plot(f)
>>> plot3d(x**2-y**2)

LAB

>>> from fxy.lab import *
>>> df = pandas.DataFrame({'x': numpy.arange(10), 'y': np.random.random(10)})
>>> df.sum()
x    45.000000
y     4.196558
dtype: float64

>>> X = [[0], [1], [2], [3]]
>>> y = [0, 0, 1, 1]
>>> neigh = sklearn.neighbors.KNeighborsClassifier(n_neighbors=3)
>>> neigh.fit(X, y)
>>> print(neigh.predict([[1.1]]))
[0]
>>> print(neigh.predict_proba([[0.9]]))
[[0.66666667 0.33333333]]

Suggestions

If you envy R users being able to start their ‘calculator’ with just one key, add something like the below to your ~/.zshrc:

function f() {
    . ~/.venv/bin/activate
    fxy "$@"
}
function F() {
    f -ix # (your custom pre-configuration you often use)
}

Aliasing fxy as f command as simplest generic, and commonly used specific as F command makes it possible to:

  • Use f to start Python with just mpmath for fastest scientific calculations without IPython.

  • Use F to start Python with some specific other pre-configuration that you often use (e.g., f -ix emulates isympy).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

fxy-0.7.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file fxy-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: fxy-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for fxy-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 790dadb952f9a3854330d2601234f7d1396c71637fa02a215e4ff28d41b76ade
MD5 3898a7269d207a3ebaa480ccfbfb8b22
BLAKE2b-256 3daf4afdfe682679ff3e71d629398eb775f41c337e401b2107223b2952d715dc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page