File:Catastrophic cancellation.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 600 × 500 pixels, file size: 1.45 MB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: catastrophic cancellation or Loss of significance
Date
Source Own work
Author Adam majewski
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Gnuplot.
 
 This plot uses embedded text that can be easily translated using a text editor.

Summary[edit]

Question ( Stackoverflow )[1] about exercise 13.3 from Numerical Linear Algebra - Lloyd N. Trefethen, David Bau.[2]


There are 2 forms of the same function :

  • factored :
  • expanded :

One can check that :

e:x^9 - 18*x^8 + 144*x^7 -672*x^6 + 2016*x^5 - 4032*x^4 + 5376*x^3 - 4608*x^2 + 2304*x - 512$
factor(e);
(x−2)^9
a:(x−2)^9;
expand(a);
x^9−18*x^8+144*x^7−672*x^6+2016*x^5−4032*x^4+5376*x^3−4608*x^2+2304*x−512


" (x−2) is small by definition of x, (x−2)^9 is even much smaller but can be computed with small relative error.

The single terms of the expanded polynomial are much larger and therefore you will suffer from catastrophic cancellation"

Is it chaotic ?[3]

Maxima CAS src code[edit]

/* Maxima CAS src code */

load(draw);
draw2d(
   file_name = "f",
   color = gray,
   key = "expanded ",
   explicit(x^9 - 18*x^8 + 144*x^7 -672*x^6 + 2016*x^5 - 4032*x^4 + 
5376*x^3 - 4608*x^2 + 2304*x - 512 ,x, 2-0.0000005,2.0000005),
   color = red,
   key = " factored ",
   explicit((x-2)^9, x, 2-0.0000005,2.0000005),
   xtics  = 0.0000005,
   title      = "Plot of 2 forms of polynomial function : (x-2)^9",
   terminal = 'svg) $


One can also check horner form, but it looks similar to expanded :


kill(all);
remvalue(all);


f: (x-2)^9;
e: expand(f);
h: horner(horner:(e));





/* http://riotorto.users.sourceforge.net/gnuplot/multiplots/index.html */

load(draw);




scn1:gr2d(title       = "y = x^9−18*x^8+144*x^7−672*x^6+2016*x^5−4032*x^4+5376*x^3−4608*x^2+2304*x−512 ",
          color = gray,
          explicit(e, x ,2-0.0000005,2.0000005),
          xtics  = 0.0000005
         )$

scn2:gr2d(title       = " y = (x−2)^9 ",
          color = red,
          explicit(f, x, 2-0.0000005,2.0000005),
          xtics  = 0.0000005
         )$


scn3:gr2d(title       = "y = x*(x*(x*(x*(x*(x*(x*((x−18)*x+144)−672)+2016)−4032)+5376)−4608)+2304)−512 ",
          color = blue,
          explicit(h, x ,2-0.0000005,2.0000005),
          xtics  = 0.0000005
         )$



draw(terminal   = 'svg,
     file_name = "i",
     columns    = 1,
     dimensions=[600,1800], /* Since Maxima 5.23, pic_width and pic_height are deprecated.  */
     scn1, scn2, scn3)$

Licensing[edit]

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.

References[edit]

  1. Stackoverflow question
  2. Numerical Linear Algebra - Lloyd N. Trefethen, David Bau. Archived from the original on 2014-01-24. Retrieved on 2014-11-02.
  3. math.stackexchange question : is-loss-of-significance-chaotic

File history

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

Date/TimeThumbnailDimensionsUserComment
current16:27, 1 November 2014Thumbnail for version as of 16:27, 1 November 2014600 × 500 (1.45 MB)Soul windsurfer (talk | contribs)change title
15:42, 1 November 2014Thumbnail for version as of 15:42, 1 November 2014600 × 500 (1.45 MB)Soul windsurfer (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

Metadata