File:HornerandNewton.gif
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
HornerandNewton.gif (500 × 350 pixels, file size: 851 KB, MIME type: image/gif, looped, 109 frames, 22 s)
File information
Structured data
Captions
Summary[edit]
DescriptionHornerandNewton.gif |
Português: Gif mostrando como encontrar raízes de um polinômio usando o método de Newton para aproximar as raízes e o método de horner para fazer deflexões no polinômio. English: Animation demonstrating how to find the roots of a polynomial using Newton's method and Horner's method together. |
|||
Date | 20 May 2009 (original upload date) | |||
Source | Own work | |||
Author | Philten at English Wikipedia | |||
Permission (Reusing this file) |
|
Source[edit]
Made using GNU Octave and compiled with the GIMP.
clear
epsilon = 0.01;
a = [1 4 -72 -214 1127 1602 -5040];
color = [0 0 0; 255 0 0; 255 255 0; 0 255 0; 0 0 255; 255 0 255]/255;
grad = [fliplr(0:0.1:1) 0:0.1:1];
xlim = [-9 8];
ylim = [-2000 2000];
x0 = 10;
x = [xlim(1):.01:xlim(2)];
roots(1) = newton(a,x0,epsilon);
b = a;
for i = 2:length(a)-1
[y a] = horner(b(i-1,:),roots(i-1));
b(i,:) = [0 a];
roots(i) = newton(b(i,:),roots(i-1),epsilon);
endfor
b(length(a),:) = b(1,:);
for i = 1:length(a)
# fancy graphics
for j = 1:length(grad)
shade = grad(j)*([1 1 1]-color(i,:));
hold off
plot(x,polyval(b(i,:),x),'color',color(i,:)+shade,'linewidth',3)
hold on
plot(x,polyval(b(1,:),x),'color',color(1,:),'linewidth',3)
plot(x,zeros(size(x)),'--k','linewidth',3)
for k = 1:i-1
plot(roots(k),0,'o','color',color(k,:),'markersize',1,'linewidth',3)
endfor
if j < length(grad)/2
plot(roots(i),0,'o','color',color(i,:)+shade,'markersize',1,'linewidth',3)
else
plot(roots(i),0,'o','color',color(i,:),'markersize',1,'linewidth',3)
endif
axis([xlim ylim])
print(strcat("frame",num2str(j+length(grad)*(i-1)),".eps"))
endfor
endfor
function z = newton(a,x0,epsilon)
x1 = epsilon*2+x0;
loops = 0;
for i = 1:length(a)-1
b(i) = a(i)*(length(a)-i);
endfor
while abs(x0-x1) > epsilon && loops < 500
x0 = x1;
f = horner(a,x0);
fp = horner(b,x0);
x1 = x0 - f/fp;
loops++;
endwhile
z = x1;
endfunction
function [y b] = horner(a,x)
b(1) = a(1);
for i = 2:length(a)
b(i) = a(i)+x*b(i-1);
endfor
y = b(length(a));
b = b(1:length(b)-1);
endfunction
Original upload log[edit]
The original description page was here. All following user names refer to en.wikipedia.
- 2009-05-20 01:30 Philten 500×350× (871553 bytes) made using GNU Octave and compiled with the GIMP clear epsilon = 0.01; a = [1 4 -72 -214 1127 1602 -5040]; color = [0 0 0; 255 0 0; 255 255 0; 0 255 0; 0 0 255; 255 0 255]/255; grad = [fliplr(0:0.1:1) 0:0.1:1]; xlim = [-9 8]; ylim = [-2000 2000];
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 15:42, 1 June 2013 | 500 × 350 (851 KB) | OgreBot (talk | contribs) | (BOT): Uploading old version of file from en.wikipedia; originally uploaded on 2009-05-20 01:30:29 by Philten | |
06:07, 27 May 2013 | 225 × 158 (382 KB) | Mvsosorio (talk | contribs) | {{Information |Description ={{en|1=http://en.wikipedia.org/wiki/Horner_scheme}} {{pt|1=http://en.wikipedia.org/wiki/Horner_scheme Gif mostrando como encontrar raízes de um polinômio usando o método de Newton para aproximar as raízes e o método ... |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
File usage on other wikis
The following other wikis use this file:
- Usage on en.wikipedia.org
- Usage on hu.wikipedia.org
- Usage on pt.wikipedia.org
- Usage on sr.wikipedia.org
- Usage on vi.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.
GIF file comment | Created with GIMP |
---|
Hidden categories: