Jump to content

File:Stirling error vs number of terms.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 736 × 499 pixels, file size: 80 KB)

This file supersedes the file StirlingError1.svg. It is recommended to use this file rather than the other one.

Bahasa Indonesia  davvisámegiella  Deutsch  English  español  français  italiano  magyar  Nederlands  polski  svenska  македонски  മലയാളം  português do Brasil  русский  slovenščina  日本語  中文(简体)  中文(繁體)  farsi  +/−

minor quality

Summary

Description
English: Plot of the error in the Stirling series for a fixed argument with increasing numbers of series terms.
Date
Source Own work
Author Glosser.ca
Other versions File:StirlingError.svg Image:StirlingError.png File:StirlingError1.svg
SVG development
InfoField
 
The SVG code is valid.
 
This diagram was created with Mathematica.
 
The file size of this SVG diagram may be irrationally large because its text has been converted to paths inhibiting translations.
Source code
InfoField

Mathematica code

b[0] = b[1] = 1;
b[n_] := b[n] = 
  1/(n + 1) (b[n - 1] - Sum[k b[k] b[n + 1 - k], {k, 2, n - 1}])
a[n_] := (2 n + 1)!! b[2 n + 1]

Approx[z_, n_] := Sqrt[2 \[Pi] z] (z/E)^z Sum[a[k] z^-k, {k, 0, n}]

err[z_, n_] := Abs[(Approx[z, n] - z!)/z!]

Block[{$MaxExtraPrecision = 150},
  ListLogPlot[
   {
    err[10, #] & /@ Range[0, 200],
    err[20, #] & /@ Range[0, 200],
    err[30, #] & /@ Range[0, 200]
    },
   Joined -> True,
   Frame -> True,
   ImageSize -> Large,
   PlotStyle -> Thick,
   FrameStyle -> Directive[Black],
   FrameLabel -> {"Number of terms", "Relative Error"},
   FrameTicks -> {{Automatic, Automatic}, {Range[0, 200, 25], 
      Automatic}},
   GridLines -> {Range[0, 200, 25], Automatic},
   GridLinesStyle -> Directive[LightGray, Dashed],
   PlotLegends -> Placed[
     LineLegend[{10, 20, 30}, LegendLabel -> "Argument, n:"],
     Top
     ]
   ]
  ]

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

23 April 2016

File history

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

Date/TimeThumbnailDimensionsUserComment
current18:04, 23 April 2016Thumbnail for version as of 18:04, 23 April 2016736 × 499 (80 KB)RayhemFix margins
13:35, 23 April 2016Thumbnail for version as of 13:35, 23 April 2016715 × 501 (80 KB)RayhemUser created page with UploadWizard

The following page uses this file:

Global file usage

The following other wikis use this file:

Metadata