> For the complete documentation index, see [llms.txt](https://wiki.solids.group/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.solids.group/computing/python-on-windows.md).

# Python on Windows

{% hint style="warning" %}
This is old and kind of dated and should probably be cleaned or replaced.
{% endhint %}

## Option 1: Google Colaboratory

Google Colaboratory is the preferred option for many course and research-adjacent Python tasks. Go to [Google Colab](https://colab.research.google.com/) to create an interactive Python Jupyter notebook.

## Option 2: WinPython and Spyder

If you need to run Python locally on Windows, you can use Spyder through WinPython.

1. Download [WinPython](https://winpython.github.io/).
2. Install it on your PC.
3. Open the Spyder application.

Spyder provides a script editor and an output panel.

![Spyder on Windows](/files/fXv1oMg2zmMdtlKxvcNa)

## Plotting Example: sin(x)

Use the following code to plot a simple trigonometric function:

```python
import numpy
import pylab

X = numpy.linspace(0, 1, 100)
Y = numpy.sin(2 * X * numpy.pi)

pylab.plot(X, Y)
pylab.show()
```

To save a figure instead of showing it interactively:

```python
# pylab.show()
pylab.savefig(r'C:\Users\brunnels\Desktop\myfile.png')
```

The output format is determined by the file extension.

## Plotting Example: Singularity Brackets

The following script plots functions using singularity brackets by defining a `bracket` function.

```python
import numpy
import pylab

def bracket(x, n):
    return 0.5 * (numpy.sign(x) + 1) * (x**n)

L = 1
X = numpy.linspace(0, 2, 1000)

Y0 = bracket(X - L, 0)
Y1 = bracket(X - L, 1)
Y2 = bracket(X - L, 2)

pylab.plot(X, Y0, label="^0")
pylab.plot(X, Y1, label="^1")
pylab.plot(X, Y2, label="^2")

pylab.legend()
pylab.show()
```

Example output:

![Singularity bracket plot](/files/3Hs4fi53Z3PQPoSRLFNa)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.solids.group/computing/python-on-windows.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
