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, 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.5.9-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fxy-0.5.9-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0ee7a3dea34199ae0255ecd42989da1dafceb0b9a41faa61ad71e7dcac684ee7
MD5 ba56d5cca9a27f339b58dbd9d8373d22
BLAKE2b-256 925460bcfb5d386709aa0c2e890c20a2b589df44bf3d419b73685e7f2cb25564

See more details on using hashes here.

Supported by

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