Skip to main content

Convenience imports and scientific functions.

Project description

fxy

Mnemonic imports and command fx with parameters to import libraries often used in research.

  • f (For CALC - Basic calculator)

  • x (For CAS software (“Numeric”) emulation)

  • y (For LAB software (“Symbolic”) emulation )

Introduction

The people coming from use of CAS tools like Maple, Mathematica or computing LAB languages Matlab and R may find that Python requires quite a few imports just to do equivalent computing.

This package fxy is a shorthand to do the imports packages to approximate these two domains (CAS, and LAB) you’ve got a command fx, 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.

Usage

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

  • $ fx -i[f|x|y]p - plain Python (i: “IPython on”, p: “Plotting on”)

Examples

In command line

  • $ fx – calculator (equivalent to $fx -f

  • $ fx -x– imports useful CAS functions (isympy+mpmath)

  • $ fx -y– imports useful LAB functions (Stats, ML, Physics)

Additions:

  • $ fx -i – calculator + IPython + explicit imports.

  • $ fx -ip – calculator + plotting, with IPython.

E.g.,:

  • $ fx -ip - calc with IPython, and plotting imports

  • $ fx -ipx - CAS with IPython, and plotting imports

  • $ fx -ipy - LAB with IPython, and plotting imports

Within notebooks and Python code

NB: This package does not assume versions of the imported packages, it just performs the basic imports, assuming that those namespaces within those packages will exist for a long time to come, so it is dependencies-agnostic.

CALC

>>> from fxy.calc import *
>>> pi
<pi: 3.14159~>

>>> 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 use some initialization commonly, we suggest adding ~/.zshrc, something like, for example:

alias f=". ~/.venv/bin/activate && fx -if"

Or, pass params:

function f() {
    . ~/.venv/bin/activate
    fx "$@"
}

This way, running something like f makes a project folder and starts Python environment with import sets often used.

Project details


Download files

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

Source Distribution

fxy-0.5.6.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fxy-0.5.6-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file fxy-0.5.6.tar.gz.

File metadata

  • Download URL: fxy-0.5.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for fxy-0.5.6.tar.gz
Algorithm Hash digest
SHA256 9b6d2c531cf7c6d18dee58490d3e547b74b7cd58cfe81a2cbeb421879bd1f07d
MD5 756843b119c872cfa98d8e43b1df63be
BLAKE2b-256 1eb26a08cd3440ea98c951eeba9f6190976db749f3114febe8520bc4db45437a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fxy-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 197048f74a870ec5dfe1aee842dd5539aa6c849a6466f4f06f34c0d6d21942d4
MD5 cf67f11861ac7b1a04282c24edeeab0f
BLAKE2b-256 ee0bfe2c7b9989e4812304ff1db1a34c3342bb551544f190fcd2121709bbe09a

See more details on using hashes here.

Supported by

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