4d-symbolic-function-graphing

Description

Archived legacy real-time 4D graphing, symbolic manipulation of expressions, and N-dimensional functions, originally written in 2000 using Smalltalk-80 on the Squeak platform.

Details

Source
GitHub
Dialect
squeak (25% confidence)
License
MIT
Created
Sept. 7, 2026
Updated
Sept. 9, 2026

README excerpt

[![Previous: XYZ 3D Function Graphing](https://img.shields.io/badge/←_PREV-gray.svg?style=for-the-badge)](https://github.com/redgreenshift/XYZ-3d-graphing-utility/blob/main/README.md)
[![Next: Greenshift](https://img.shields.io/badge/NEXT_→-gray.svg?style=for-the-badge)](https://github.com/redgreenshift/Greenshift/blob/main/README.md)

# 4D Symbolic Function Graphing


[![Platform: Squeak](https://img.shields.io/badge/Squeak-F8F8F8?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iODAwIiB3aWR0aD0iMTIwMCIgdmVyc2lvbj0iMS4wIiB2aWV3Qm94PSItMjU2NS41OTQ3NSAtMjkxNy4yMjYyNSAyMjIzNS4xNTQ1IDE3NTAzLjM1NzUiPjxwYXRoIGQ9Ik0xMTUwMS4yMTIgNjQ1Ni42MmMuMjg0IDY2My4yNjgtNDMxLjMzIDEyMDEuMTQtOTYzLjg1NCAxMjAxLjE0LTUzMi41MjIgMC05NjQuMTM3LTUzNy44NzItOTYzLjg1My0xMjAxLjE0LS4yODQtNjYzLjI2NiA0MzEuMzMxLTEyMDEuMTM4IDk2My44NTMtMTIwMS4xMzggNTMyLjUyNCAwIDk2NC4xMzggNTM3Ljg3MiA5NjMuODU0IDEyMDEuMTM5eiIvPjxwYXRoIGQ9Ik0xMTIzNC42MjUgNjMzNy4zODdjMCAzMTkuMjQyLTE1Mi44NDEgNTc4LjA0LTM0MS4zOCA1NzguMDQtMTg4LjUzNSAwLTM0MS4zNzYtMjU4Ljc5OC0zNDEuMzc2LTU3OC4wNCAwLTMxOS4yNDEgMTUyLjg0MS01NzguMDQgMzQxLjM3Ni01NzguM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jYzLjAyIDAgMTIwMC41MDMgNDA0Ljc0IDEyMDAuNTAzIDkwNC4wMXoiLz48cGF0aCBkPSJNNjg5Ny43NzQgODgyNi43OTRDNDg3OS44IDgyOTQuOTY1IDI4MjMuNTg3IDgyODAuNzk0IDIzIDkxODMuMTM3bTY3NTYuOSAyMzQuODQxYy0yNDg1LjQ2NC0xNTYuNjkzLTQyMDguNTk2LTE5OS4zMjUtNjI4Mi42ODMgMTQyMy41NTRtNjI4Mi42ODMtNDczLjMwOWMtMjE0My4wMTctMjg4LjE3OC0yOTY1LjM0OC05OS44NDQtNDI2Ny45NDUgMTA2OC4xMm03Njk0LjQ1MS0yNDMwLjkyNGMyODk2LjExMi03NDkuMzc0IDUwMjkuNTkyLTIwNi43MzMgNjg3NS42NzkgMzU2LjM0Mm0tNjc1Ni44OTkgMjM1Ljc0OGMyNjU2LjA1LTE5OS4zMjUgNDIzMy4wNTgtMTI4LjQ4IDYyODIuNjgzIDE0MjIuNjQ4bS02MjgyLjY4My00NzUuMTIzYzIwMTkuMTA0LTI1My41NjQgMjg4NS4wNjQtMTc2LjIxMiA0MjY3Ljk0NSAxMDY4LjExOSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2Utd2lkdGg9IjE1MCIvPjwvc3ZnPg==)](https://squeak.org/)
[![Language: Smalltalk-80](https://img.shields.io/badge/Smalltalk--80-B8DAFD)](https://en.wikipedia.org/wiki/Smalltalk)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)

An archived Squeak/Smalltalk `change set`—a self-contained collection of Smalltalk code—demonstrating symbolic expression evaluation, symbolic differentiation, N-dimensional functions, transformations, and real-time 4D graphing.

Its expressions can be evaluated numerically using supplied variable values, while its differentiation operations produce new symbolic expressions rather than numeric results.

It runs on the [Squeak](https://squeak.org/) platform, which uses a _dialect_ of the [Smalltalk-80 programming language](https://wiki.squeak.org/squeak/373).

## Examples

<p><table border="1">
<tr><td>Plane</td><td>3D Sine curve</td><td>3D polar graph</td></tr>
<tr><td><img src="assets/plane.gif" width="320" height="240"></td><td><img src="assets/3d_sin.gif" width="320" height="240"></td><td><img src="assets/sphere.gif" width="320" height="240"></td></tr>
<tr><td>z(x,y) = 0</td><td>z(x,y) = sin(x) + sin(y)</td><td>r(&theta;, &phi;) = 3</td></tr>
</table>

<p><table border="1"><tr><td>2D Function (in 3d space)</td><td>2D Function + Transform = 3D Graph</td></tr>
<tr><td><img src="assets/sin.gif" width="320" height="240"></td><td><img src="assets/sin_transform.gif" width="320" height="240"></td></tr>
<tr><td>y(x) = sin(x)</td><td><code>FunctionTransform</code> rotates it about the x-axis</td></tr>
<tr><td><img src="assets/semicircle.gif" width="320" height="240"></td><td><img src="assets/semicircle_transform.gif" width="320" height="240"></td></tr>
<tr><td>y(x) = (25 - x^2)^0.5</td><td><code>FunctionTransform</code> rotates it about the x-axis</td></tr>
</table>



<table bgcolor="#ffffff" border="1">
   <tr bgcolor="#000000">
      <td>4D Function</td>
   <td><img src="assets/sine-wave.gif" width="160" height="120"></td>
   <td><img src="assets/sine-not.gif" width="160" height="120"></td>
   <td><img src="assets/polar5.gif" width="160" height="120"></td>
   </tr>
<tr>
   <td>&nbsp;</td>
   <td>z(x,y,t) = sin(x) + sin(t + y)</td>
   <td>z(x,y,t) = sin(t + x) + sin(t * y)</td>
   <td>r(&theta;,&phi;,t) = sin(&phi;) - sin(t)</td>
</tr>

<tr>
   <td>4D Function + Transform</td>
   <td><img src="assets/sine-wave-transform.gif" width="160" height="120"></td>
   <td><img src="assets/sine-not-transform.gif" width="160" height="120"></td>
   <td><img src="assets/polar6.gif" width="160" height="120"></td>
</tr>

<tr bgcolor="#000000">
   <td>&nbsp;</td>
   <td><code>FunctionTransformTwist</code></td>
   <td><code>FunctionTransformTurn</code></td>
   <td><code>FunctionTransformTilt</code></td>
</tr>
</table>

### Miscellaneous 4D functions
<table bgcolor="#ffffff" border="1">
<tr>
   <td><img src="assets/cartesian-hypersphere.gif" width="160" height="120"></td>
   <td><img src="assets/hypersphere.gif" width="160" height="120"></td>
   <td><img src="assets/polar1.gif" width="160" height="120"></td>
</tr>
<tr bgcolor="#000000">
   <td>r(&theta;,&phi;,t) = 3</td>
   <td>r(&theta;,&phi;,t) = (10 sin(t &theta;) * sin(t &phi;))<sup>&frac12;</sup></td>
   <td>r(&theta;,&phi;,t) = &theta;</td>
</tr>

<tr>
   <td><img src="assets/polar2.gif" width="160" height="120"></td>
   <td><img src="assets/polar3.gif" width="160" height="120"></td>
   <td><img src="assets/polar4.gif" width="160" height="120"></td>
</tr>
<tr bgcolor="#000000">
   <td>r(&theta;,&phi;,t) = (10 sin(&theta; 2t) * sin(&phi; 2t))<sup>&frac12;</sup></td>
   <td>r(&theta;,&phi;,t) = (10 sin(t &theta;) * sin(t &phi;))<sup>&frac12;</sup></td>
   <td>z(x,y,t) = (30 - x<sup>2</sup> - y<sup>2</sup> - t<sup>2</sup>)<sup>&frac12;</sup></td>
</tr>
</table>


## Contents

The change set includes:

- Symbolic mathematical expressions
- Expression evaluation and symbolic differentiation
- Constants and variables
- Arithmetic, exponential, logarithmic, and trigonometric expressions
- Two-, three-, and four-dimensional functions
- Polar and cylindrical coordinate functions
- Function transformations and rotations
- Real-time graphing of 4D functions

## Loading the Change Set

1. Open the project in a compatible Squeak image.
2. Import or file in the change set:

   ```text
   Expression-FunctionNd-FunctionGraph-4DgraphingInRealtime.1.cs

## Project History

This project was developed using Squeak 2.8alpha around 2000. It is preserved as an example of exploratory mathematical programming written in Smalltalk-80 and is not under active development. It may require modifications to work with current Squeak versions, but it is expected to work without modification in a Squeak 2.8 environment.

The `.cs` file is a Squeak change set, not C# source code.

### Successor Projects

[`Greenshift`](https://github.com/redgreenshift/Greenshift) is the direct successor to `4D Symbolic Function Graphing`. The original plan was to rewrite `XYZ` in Visual C++, using DirectX, in 4 dimensions, as a **screensaver**. However, I ran into complications when trying to design a more robust expression engine that could support symbolic manipulation and evaluation, so I took a detour through the Smalltalk-80 programming language, writing a 4D graphing utility in Squeak/Smalltalk first. Using what I learned, I was able to complete the robust Expression engine in C++ and decided to make a Winamp visualization instead of a simple "screensaver"

### Predecessor Projects

[`XYZ - 3D Graphing Utility`](https://github.com/redgreenshift/XYZ-3d-graphing-utility) is the direct precursor to `4D Symbolic Function Graphing`, as the fourth dimension is the next logical step, and I wanted to design a more robust expression engine that could support symbolic manipulation and evaluation, which could be much more extensible than the RPN implementation in `XYZ`.


## License
This project is licensed under the MIT License - see the [`LICENSE`](LICENSE) file for details.
← Back to results