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.5.tar.gz (8.5 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.5-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: desmospy-0.0.5.tar.gz
  • Upload date:
  • Size: 8.5 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.5.tar.gz
Algorithm Hash digest
SHA256 dec448ad0fc766a7620aaced10cf7a5f304fc53a0dfbd02b370bef3a88e4e706
MD5 c81cac627f06469ab4ed1da6acab0d57
BLAKE2b-256 716a7549e023a4e13204b6e1a93266af72f1a2225549e8502fcfd7585e2f3144

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desmospy-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.8 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9e42c73bae9462d453a9f7ceae40c3c7e1a66e4116cb15e5a6cbb16d199342a0
MD5 f9e71fd7b5212fd9328db6a3e322fcc8
BLAKE2b-256 2594e32a37a270b833890afc79e11527439cde7241616d563745e54c36a9e23b

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