File:Stirling series relative error.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 740 × 530 pixels, file size: 109 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

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

    العربية ∙ dansk ∙ Deutsch ∙ English ∙ español ∙ فارسی ∙ français ∙ magyar ∙ Bahasa Indonesia ∙ italiano ∙ 日本語 ∙ 한국어 ∙ македонски ∙ മലയാളം ∙ Nederlands ∙ polski ∙ prūsiskan ∙ português do Brasil ∙ русский ∙ slovenščina ∙ svenska ∙ Tiếng Việt ∙ 中文 ∙ 中文(简体) ∙ 中文(繁體) ∙ +/−

    minor quality

    Summary

    Description
    English: Plot of the relative error in the Stirling series as compared with the gamma function. Recursion relation for the an coefficients taken from Mathworld
    Date
    Source Own work
    Author Glosser.ca
    SVG development
    InfoField
     The SVG code is valid.
     This diagram was created with Mathematica.
    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_] := Exp[-z] z^(z - 1/2) Sqrt[2 \[Pi]] Sum[a[k] z^-k, {k, 0, n}]
    
    LogLinearPlot[
     Evaluate@Table[Log[10, Abs[(Approx[x, n] - Gamma[x])/Gamma[x]]], {n, 0, 5}],{x, 1, 10^9}, 
     PlotRange -> All,
     WorkingPrecision -> 120, 
     Frame -> True,
     FrameTicks -> {Table[{10^k, Superscript[10, k]}, {k, 0, 9}], Automatic}, 
     FrameLabel -> {"Argument", Log["Relative Error"]}, 
     PlotLegends -> LineLegend[Range[0, 5], LegendLabel -> "Number of terms"], 
     ImageSize -> Large, 
     PlotStyle -> Thick, 
     FrameStyle -> Directive[Black], 
     GridLines -> {10^Range[0, 9], Automatic}, 
     GridLinesStyle -> Directive[LightGray, Dashed]
    ]
    

    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

    22 April 2016

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current19:02, 23 April 2016Thumbnail for version as of 19:02, 23 April 2016740 × 530 (109 KB)wikimediacommons>RayhemAdd 10px margin

    There are no pages that use this file.