File:Kolmogorov-Arnold grid.svg

From testwiki
Jump to navigation Jump to search
Original file (SVG file, nominally 1,440 × 576 pixels, file size: 688 KB)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

Summary

Description
English: Construction of a grid system for the Kolmogorov-Arnold representation theorem.

Matplotlib

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

def psi(x):
    return np.exp(x) - 1

def phi(x, N):
    intervals = np.linspace(0, 1, 5*N+1)
    values = []
    for i in range(N):
        x_min = intervals[5*i]
        x_max = intervals[5*i+4]
        constant_value = np.floor(50 * psi(x_min)) / 50
        values.extend([constant_value] * 5)
    values.append(values[-1])  # Add last value to make it the same length as intervals
    return np.interp(x, intervals, values)
N = 10

# Create figure with two subplots
fig = plt.figure(figsize=(15, 6))
ax1 = fig.add_subplot(121)

# Subplot 1: psi(x) and phi(x)
x = np.linspace(0, 1, 1000)
ax1.plot(x, psi(x), label='ψ(x)')
ax1.plot(x, phi(x, N), label='φ(x)', linestyle='--')
# ax1.set_xlabel('x')
# ax1.set_ylabel('y')
ax1.legend()
# ax1.set_title('ψ(x) and φ(x)')

# Subplot 2: 3D plot of phi(x) + t*phi(y)
x = y = np.linspace(0, 1, 100)
X, Y = np.meshgrid(x, y)
t = (np.sqrt(5) - 1) / 2
Z = phi(X, N) + t * phi(Y, N)

ax2 = fig.add_subplot(122, projection='3d')
ax2.plot_surface(X, Y, Z, cmap='viridis')
ax2.set_xlabel('x')
ax2.set_ylabel('y')
# ax2.set_zlabel('φ(x) + t·φ(y)')
ax2.set_title('φ(x) + t·φ(y) on [0, 1]²')
# remove axes
# ax2.set_axis_off()

plt.tight_layout()
plt.savefig('Kolmogorov-Arnold grid.svg')
plt.show()

Date
Source Own work
Author Cosmia Nebula

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

20 September 2024

704,308 byte

image/svg+xml

a5a06d5625a465dfcc735095f88eda41872c4844

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current10:05, 20 September 2024Thumbnail for version as of 10:05, 20 September 20241,440 × 576 (688 KB)wikimediacommons>Cosmia NebulaUploaded while editing "Kolmogorov–Arnold representation theorem" on en.wikipedia.org

The following page uses this file: