Skip to main content

pythonic desmos

Project description

[!NOTE]

See a live view as a Jupyter notebook.

desmospy has these immediate goals:

  • present the Desmos API with consistent terminology
  • keep it simple, keep it pythonic

Basic usage is very simple. Create an instance of Calculator, then assign to one of its members.

from desmospy import Calculator

c = Calculator()
c.y = 1/2 * c.x + 3
c.show()

Figure 1

More advanced plots can be created with comparisons and the .define() method:

c.a = 0.3
a,x,y = c.a,c.x,c.y

c.define(y < a*x)
c.define(y >= a*x**2)
c.define(a*x*y == 1)
c.show()

Figure 2

Equations and inequalities can also be combined; first let's define two ellipse regions.

A = (x**2 / 49 + y**2 / 16 <= 1)
B = (x**2 / 16 + y**2 / 49 <= 1)

We can then take the union, also known as a logical OR | of the regions.

c.define(A | B)
c.show()

Figure 3

We can also take the intersection of the same regions, with the logical AND & operation.

c.define(A & B)
c.show()

Figure 4

This leaves the logical XOR ^ operation.

c.define(A ^ B)
c.show()

Figure 5

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

desmospy-0.0.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

desmospy-0.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file desmospy-0.0.2.tar.gz.

File metadata

  • Download URL: desmospy-0.0.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for desmospy-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9730bfd7417bc5034a47836f267a175f4038455d78b8149f351ee89b2237bf96
MD5 128edbe8a98b4f994d93d633e81d3c7f
BLAKE2b-256 5128dbda6fbe949e782b06d5949951bf416e85f72f49d78882f5709c718c3da1

See more details on using hashes here.

File details

Details for the file desmospy-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: desmospy-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for desmospy-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6c946a88339e866eea2d68e912c1f5f906fbafc9fd9a440d3ea9e5fbc7a427a1
MD5 acd45900b9b617eab4da4b99fd38976a
BLAKE2b-256 dd540e29b088ca1f88387e09f7cea80808a6996820345ab3d46be340b8d6c3c4

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