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.3.tar.gz (4.4 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.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: desmospy-0.0.3.tar.gz
  • Upload date:
  • Size: 4.4 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.3.tar.gz
Algorithm Hash digest
SHA256 1e5497734ab73ef207022ab50f34df0e054bf2a8b2c6baed99e47f214fd1b256
MD5 fe2363c7be15cef4642a1cfc5ef21855
BLAKE2b-256 8bf2b5b75b59a94deb7aceaf52525d18de981af75bd5782e0b2c9a1bb1f3d3e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desmospy-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8699e542ce1ee4a4e5a0bc0a82dc75ce842e0c9e5b9f857303b5a2fefbbc03ed
MD5 6dc8062cf3ddec230b525810bf802710
BLAKE2b-256 e733f354048fa3bad8ce152475fd44662fc5230184866a9e9dce89d7024dd2a0

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