Skip to main content

Convenience imports and scientific functions.

Project description

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

Installation

  • pip install fxy to get the import shortcuts.

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.

Usage

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

  • fx (e.g., fx -ip) for quick CALC - Basic calculator

  • fx -x (e.g., fx -ipx) for basic CAS software (“Numeric”) emulation

  • fx -y (e.g., fx -ipy) for LAB software (“Symbolic”) emulation

In command line

  • $ fx -i – to use IPython + explicit imports.

  • $ fx -p – to import plotting.

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 Distributions

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

Built Distribution

fxy-0.5.8-py3-none-any.whl (10.9 kB view hashes)

Uploaded Python 3

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