File:Rosenbrock function.svg
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 720 × 540 pixels. Other resolutions: 320 × 240 pixels | 640 × 480 pixels | 1,024 × 768 pixels | 1,280 × 960 pixels | 2,560 × 1,920 pixels.
Original file (SVG file, nominally 720 × 540 pixels, file size: 2.28 MB)
File information
Structured data
Captions
Summary
[edit]DescriptionRosenbrock function.svg |
English: Rosenbrock function over . The Python code needs at least Matplotlib v0.99. The MATLAB/Octave code was tested with GNU Octave 4.2.2 and MATLAB R2016a.
Español: Funció de Rosenbrock definida sobre . |
Date | |
Source | Own work |
Author | Morn the Gorn |
Python source InfoField | click to expand
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = Axes3D(fig, azim=-128, elev=43)
s = .05
X = np.arange(-2, 2.+s, s)
Y = np.arange(-1, 3.+s, s)
X, Y = np.meshgrid(X, Y)
Z = (1.-X)**2 + 100.*(Y-X*X)**2
# ax.plot_surface(X, Y, Z, rstride=1, cstride=1, norm = LogNorm(),
# cmap="viridis")
# Without using `` linewidth=0, edgecolor='none' '', the code may produce a
# graph with wide black edges, which will make the surface look much darker
# than the one illustrated in the figure above.
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, norm=LogNorm(),
linewidth=0, edgecolor='none', cmap="viridis")
# Set the axis limits so that they are the same as in the figure above.
ax.set_xlim([-2, 2.0])
ax.set_ylim([-1, 3.0])
ax.set_zlim([0, 2500])
plt.xlabel("x")
plt.ylabel("y")
plt.savefig("Rosenbrock function.svg", bbox_inches="tight")
plt.show()
|
MATLAB/Octave source InfoField | click to expand
clear all;
close all;
hfig = figure(1);
s = 0.05;
X = [-2 : s : 2+s];
Y = [-1 : s : 3+s];
[X, Y] = meshgrid(X, Y);
Z = (1-X).^2 + 100*(Y-X.^2).^2;
% Use log scale of Z for a batter usage of the color spectrum
minZ = min(Z(:));
maxZ = max(Z(:));
C = minZ + (maxZ-minZ).*log(1+Z-minZ)./log(1+maxZ-minZ);
% See
% http://stackoverflow.com/questions/5073865/how-to-color-surface-with-stronger-contrast
% for how to color a surface with a even stronger contrast.
% The method is as follows:
%C = Z;
%[~, index] = sort(C(:));
%C(index) = 1 : numel(index);
colormap(jet);
surf(X, Y, Z, C, 'EdgeColor', 'none', 'LineStyle', 'none');
axis([-2, 2, -1, 3, 0, 2500]);
xlabel('x', 'fontsize', 18);
ylabel('y', 'fontsize', 18);
zlabel('f', 'fontsize', 18);
% Note that the `-dsvg' option is only supported for Simulink systems
print(hfig, '-dsvg', 'rosenbrock');
% To produce eps and pdf, use the following code. Notice that `epstopdf' may not work on Windows.
print(hfig, '-depsc', 'rosenbrock');
system('epstopdf rosenbrock.eps');
|
Licensing
[edit]Public domainPublic domainfalsefalse |
I, the copyright holder of this work, release this work into the public domain. This applies worldwide. In some countries this may not be legally possible; if so: I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law. |
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 01:19, 5 June 2020 | 720 × 540 (2.28 MB) | Zhangzk (talk | contribs) | The original colour looks much better (Reverted to version as of 11:52, 6 April 2010 (UTC)) | |
15:25, 15 August 2018 | 603 × 459 (1.21 MB) | Nicoguaro (talk | contribs) | Change colormap to viridis. Smaller file. | ||
11:52, 6 April 2010 | 720 × 540 (2.28 MB) | Morn (talk | contribs) | {{Information |Description={{en|1=Rosenbrock function}} |Source={{own}} |Author=Morn the Gorn |Date=2009-09-04 |Permission= |other_versions= }} Category:Functions in two variables |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
File usage on other wikis
The following other wikis use this file:
- Usage on ar.wikipedia.org
- Usage on ca.wikipedia.org
- Usage on de.wikipedia.org
- Usage on es.wikipedia.org
- Usage on fa.wikipedia.org
- Usage on fr.wikipedia.org
- Usage on he.wikipedia.org
- Usage on it.wikipedia.org
- Usage on ko.wikipedia.org
- Usage on no.wikipedia.org
- Usage on pl.wikipedia.org
- Usage on ru.wikipedia.org
- Usage on sr.wikipedia.org
- Usage on uk.wikipedia.org
- Usage on uk.wikibooks.org
- Usage on zh.wikipedia.org
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Width | 576pt |
---|---|
Height | 432pt |