Skip to main content

pythonic desmos

Project description

[!NOTE]

See a live view as a Jupyter notebook.

demospy 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.1.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.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: desmospy-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ab7d0ea5420c7e5be16419f7e77afbf49ed8e491c9b09162d6a3b6581864bb27
MD5 1f5e35914cfe49d4f66c57a0ae3ad454
BLAKE2b-256 3523feea567a5e2752cd5c750bfc43ec292af7d9c5697d1d2f3c7f4e911fb758

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desmospy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24bd4404d6fd5e7ebf2a99d0b256834ee04b576c7fd4c8d8bea7bacd3ca5bc97
MD5 f204fdd624612934d6943c864caeae16
BLAKE2b-256 8b9737f3828f85bac735a75d02efad9c3685893b5fae1d790e8b521babec3759

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