Jump to content

File:Lagrange very simple-1b.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 767 × 682 pixels, file size: 63 KB)

Summary

Description
English: Illustration of the constrained optimization problem 1b
Date
Source Own work
Author Abdullah512

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.

Source code

The graph was made in Matlab with the following source code.

% Function data
[X,Y] = meshgrid(-1.2:0.1:1.2, -1.2:0.1:1.2);
Z = (X+Y).^2;

% Constraint data
t = -pi:0.01:pi;
xc = cos(t);
yc = sin(t);
zc = (xc+yc).^2;

% Plot graph and 'constraint'
figure();
surfc(X,Y,Z);
hold on;
plot3(xc, yc, zc, 'k', 'LineWidth', 2);
plot3(xc, yc, 0*ones(1,length(t)), 'k', 'LineWidth', 1);

set(1, 'Color', [1 1 1]);
set(1, 'Position', [46 107 767 682]);
% Axis labels
text(0.0, -2.2, 0, 'x');
text(2.0, -.3, 0, 'y');
text(-1.5, -1.5, 3, 'z');

% Annotations of the max and min points
% Points indicating max
plot3(sqrt(2)/2, sqrt(2)/2, 2, 'kx', 'MarkerSize', 10, 'LineWidth', 1);
plot3(sqrt(2)/2, sqrt(2)/2, 0, 'kx', 'MarkerSize', 10, 'LineWidth', 1);
text('Interpreter', 'latex', 'String', '$$\left(\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}, 2\right)$$',...
        'Position', [+.3 .6 2.4], 'FontSize', 9);

plot3(-sqrt(2)/2, -sqrt(2)/2, 2, 'kx', 'MarkerSize', 10, 'LineWidth', 1);
plot3(-sqrt(2)/2, -sqrt(2)/2, 0, 'kx', 'MarkerSize', 10, 'LineWidth', 1);
text('Interpreter', 'latex', 'String', '$$\left(\frac{-\sqrt{2}}{2}, \frac{-\sqrt{2}}{2}, 2\right)$$',...
        'Position', [-0.9 -0.5 +2.2], 'FontSize', 9);

% Points indicating min
plot3(-sqrt(2)/2, sqrt(2)/2, 0, 'kx', 'MarkerSize', 10, 'LineWidth', 1);
text('Interpreter', 'latex', 'String', '$$\left(\frac{\sqrt{2}}{2}, \frac{-\sqrt{2}}{2}, 2\right)$$',...
        'Position', [+0.8 -1.3 +1.1], 'FontSize', 9, 'Color', 'white');

plot3(sqrt(2)/2, -sqrt(2)/2, 0, 'kx', 'MarkerSize', 10, 'LineWidth', 1);
text('Interpreter', 'latex', 'String', '$$\left(\frac{-\sqrt{2}}{2}, \frac{\sqrt{2}}{2}, 2\right)$$',...
        'Position', [-0.2 -0.5 +1.0], 'FontSize', 9, 'Color', 'white');

hold off

view([34 24]);

%interpolate for improved rendering
shading interp;

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

20 June 2020

File history

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

Date/TimeThumbnailDimensionsUserComment
current22:34, 20 June 2020Thumbnail for version as of 22:34, 20 June 2020767 × 682 (63 KB)Abdullah512fixed the x and y coordinates of the min points
06:12, 20 June 2020Thumbnail for version as of 06:12, 20 June 2020767 × 682 (63 KB)Abdullah512Cross-wiki upload from en.wikipedia.org

Metadata