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.

Simple Usage

$ fx --calc starts Python with CALC imports (to emulate scientific calculator) (or from fxy.calc import *)

$ fx --cas starts Python with CAS (Computer Algebra System) imports (to emulate Maple, Matematica,..) (or from fxy.cas import *)

$ fx --lab starts Python with LAB (Linear AlgeBra system) imports (to emulate MATLAB, R,…) (or from fxy.lab import *)

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, and alias:

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

alias fx="f -ipx"  # for CAS with plotting
alias fy="f -ipy"  # for LAB with plotting

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.6.0-py3-none-any.whl (12.0 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