Skip to main content

pythonic desmos

Project description

[!NOTE]

See a live view as a Jupyter notebook.

See source code and more examples on github.

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 .set() method:

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

c.set(y < a*x)
c.set(y >= a*x**2)
c.set(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.set(A | B)
c.show()

Figure 3

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

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

Figure 4

This leaves the logical XOR ^ operation.

c.set(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.4.tar.gz (5.1 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.4-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: desmospy-0.0.4.tar.gz
  • Upload date:
  • Size: 5.1 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.4.tar.gz
Algorithm Hash digest
SHA256 b0e4278d342148a1d5aa27d36dad5aa6fcc6bc6f926d029bb2b9fea17458702e
MD5 23bb551d4c7c6dcc509d3535f25cac13
BLAKE2b-256 1534c87011753eb309719872eae14a0740b75b53fef77b87f46161d075f581bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desmospy-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4ec3d0098090e3ce59d50c8af5a1526d8622c62879840ae226f1b76edd7bca0c
MD5 125a7b62211e8c2911c291a5fdf6f76f
BLAKE2b-256 c18b788e4cd5be2c8cfd5844ae49be0fc8ceb6162d9becc712ce67fddfc4225e

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