special functions in mathematica
play

Special Functions in Mathematica Part I: general overview Oleksandr - PDF document

Special Functions in Mathematica Part I: general overview Oleksandr Pavlyk Wolfram Research Inc. pavlyk@wolfram.com 2 Talk - Part I.nb Table of Contents Mathematica rules Special functions Functions in Mathematica Defining your own


  1. Special Functions in Mathematica Part I: general overview Oleksandr Pavlyk Wolfram Research Inc. pavlyk@wolfram.com

  2. 2 Talk - Part I.nb Table of Contents Mathematica rules… Special functions… Functions in Mathematica Defining your own functions

  3. Talk - Part I.nb 3 Mathematica rules » Capitalized function names, e.g. Plot, Solve, Integrate » Square brackets around the arguments, i.e. Sin � x � , not Sin � x � » Curly brackets for lists and ranges » � + � to evaluate » Take advantage of pallettes � Examples: Stand-alone commands In[1]:= Fibonacci � 36 � Out[1]= 14 930 352 In[2]:= Sin � 36 Degree � 5 5 8 � Out[2]= 8 In[3]:= Sum � x ^ k � k ^ 2, � k, 1, Infinity �� Out[3]= PolyLog � 2, x � In[4]:= Series � Sin � Tan � x �� � Tan � Sin � x �� , � x, 0, 12 �� Out[4]= � x 7 30 � 29 x 9 756 � 1913 x 11 � O � x � 13 75 600 In[5]:= DSolve � y '' � x � � x y � x � � x , y, x � Out[5]= �� y � Function �� x � , Π AiryAiPrime � x � AiryBi � x � � Π AiryAi � x � AiryBiPrime � x � � AiryAi � x � C � 1 � � AiryBi � x � C � 2 ���� Examples: Command interaction In[6]:= sol � Solve �� 4 � x � 1 � ^ 2 � 3 y ^ 2 � 28, 2 x � 3 y � 4 � , � x, y �� Out[6]= �� x � � 1, y � � 2 � , � x � 7 2 , y � 1 ��

  4. 4 Talk - Part I.nb In[7]:= ContourPlot �� 4 � x � 1 � ^ 2 � 3 y ^ 2 � 28, 2 x � 3 y � 4 � , � x, � 2, 4 � , � y, � 4, 4 � , Epilog � � PointSize � Large � , Red, Point �� x, y � � . sol ��� 4 2 0 Out[7]= � 2 � 4 � 2 � 1 0 1 2 3 4

  5. Talk - Part I.nb 5 Examples: Interactive exploration In[8]:= Manipulate � Plot �� Exp � x � , Sum � x ^ k � k � , � k, 0, n ��� , � x, � 3, 3 �� , � n, 0, 6, 1, SetterBar �� n 0 1 2 3 4 5 6 20 15 Out[8]= 10 5 � 3 � 2 � 1 1 2 3

  6. 6 Talk - Part I.nb Special functions… … are particular mathematical functions which have more or less established names and notations due to their importance in mathematical analysis, functional analysis, physics, or other applications. There is no general formal definition, but the list of mathematical functions contains functions which are commonly accepted as special. In particular, elementary functions are also considered as special functions . The above is a quote from wikipedia [link] Comment

  7. Talk - Part I.nb 7 … and why study them? » to solve the problem they appeared in (physics, chemistry, statistics, engineering, etc.) » because they provide a language to solve other problems with sin � x � The integral � � x is not expressible in elementary functions, see Liouville’s theorem x But expand the language and the integral becomes doable: Integrate � Sin � x � � x, x � SinIntegral � x � Sine integral provides a language to express answers to other problems as well: Sum � � � 1 � ^ k x 2 k � 1 , � k, 0, � �� � 2 k � 1 � � 2 k � 1 SinIntegral � x � Integrate � Exp � � x t � , � t, 0, Infinity � , Assumptions � x � 0 � 1 � t ^ 2 CosIntegral � x � Sin � x � � 1 2 Cos � x � � Π � 2 SinIntegral � x ��

  8. 8 Talk - Part I.nb … and why study them? » just for the fun of it Example 1 Comparison of quantum and classical probability distributions for a harmonic oscillator: Block �� n � 20 � , Plot �� � � x 2 HermiteH � n, x � 2 , Piecewise � 2 n n � Π 1 �� , x 2 � 2 n � 1 ���� , � x, � 3 n ��� 3 n , 2 n � 1 � x 2 Π 0.20 0.15 0.10 0.05 � 5 5 Example 2 Given a word with character counts � n 1 , … , n k � the number of anagrams with no fixed letter: DerangementsCount � nvec_List � : � Integrate � Exp � � x � Product �� � 1 � n LaguerreL � n, x � , � n, nvec �� , � x, 0, � �� For “LHCPhenoNet”: LHCPhenoNet 1211 221 1

  9. Talk - Part I.nb 9 DerangementsCount �� 1, 2, 1, 1, 2, 2, 1, 1 �� 989 660 totalPermutationCount � Multinomial � 1, 2, 1, 1, 2, 2, 1, 1 � 4 989 600

  10. 10 Talk - Part I.nb Special functions in Mathematica The chart of 180+ functions q � functions Polynomials � , B , Ψ Statistical Functions Hypergeometric Zeros : Ρ k , j Ν , k functions Holonomic Zeta, PolyLogs Number Theory Elliptic intergals Functions Elliptic Mathieu, Spheroidal Functions � Landscape of special function groups, supported in Mathematica »

  11. Talk - Part I.nb 11 Hypergeometric function Geometric series � � x k k � 0 1 1 � x Generalized hypergeometric series � � c k x k k � 0 � k � a 1 � � k � a 2 � � � � � k � a p � 1 � here c k is such that c k � 1 � c k � k � b 1 � � k � b 2 � � � � � k � b q � . k � 1 The non-terminating series converges absolutely for p � q � 1, or for p � q � 1 and � x � � 1. The series terminates if one � a i � is a non-positive integer. A function defined by an analytic continuation of the above series is denoted as p F q � a 1 , a 2 , …, a p ; b 1 , b 2 , …, b q ; z � and in Mathematica as HypergeometricPFQ �� a 1 , a 2 , …, a p � , � b 1 , b 2 , …, b q � , x � Many elementary and special functions are hypergeometric functions. Comment Hypergeometric functions enjoy many nice properties warranting closer look in part II.

  12. 12 Talk - Part I.nb Special functions in Mathematica extent of the support » Numeric evaluation » Exact evaluation » Differentiation » Series expansion » Simplification rules, functional expansion » Support in solvers (input & output)

  13. Talk - Part I.nb 13 Special functions in Mathematica Exact evaluation Sequences: BernoulliB � 60 � � 1 215 233 140 483 755 572 040 304 994 079 820 246 041 491 � 56 786 730 Binomial � 52, 6 � 20 358 520 LegendreP � 4, x � 8 � 3 � 30 x 2 � 35 x 4 � 1 Evaluation at special points: Erf � Infinity � 1 Zeta ' � � 1 � 12 � Log � Glaisher � 1 Hypergeometric2F1 � n, n, 2 n � 1, 1 � 2 2 n Gamma � 1 2 � n � Π Gamma � 1 � n � HermiteH � n, 0 � 2 n Π Gamma � 1 � n 2 � JacobiSN � EllipticK � m � � 2, m � 1 1 � 1 � m

  14. 14 Talk - Part I.nb Evaluation to simpler functions: Hypergeometric2F1 � 1, 1, 4, x � 2 x 3 3 � 2 x � 3 x 2 � 2 Log � 1 � x � � 4 x Log � 1 � x � � 2 x 2 Log � 1 � x �� 1 � LegendreQ � 3, 2, x � � 1 � x 2 � � � 8 � 25 x 2 � 15 x 4 � � � � 1 � x 2 � 2 15 x � 1 � x 2 � � � 1 2 Log � 1 � x � � 1 2 Log � 1 � x �� Parity transformations, argument reduction make expression canonical: Erf � � x � � Erf � x � Sin � 127 Degree � Cos � 37 ° � JacobiSN � u � I EllipticK � 1 � m � � 2 EllipticK � m � , m � � JacobiNS � u, m � m

  15. Talk - Part I.nb 15 Special functions in Mathematica Numeric evaluation: maximally extended domain Special functions are functions complex variable . Mathematical consistency — choices of branch-cuts, and continuity at them, are consistent with functional relations between functions, and evaluation semantics. Implications of argument reduction z 2 � z , because in Mathematica argument is automatically reduced to �Π � arg � z � � Π arg � f � Φ �� Π Arg � Exp � � Φ �� Π Exp � � Φ � 2 � Arg � 2 Φ Π Π �Π Π � 2 2 Explanation Π � 2 �Π 1 1 z , log � 1 z � � � log � z � , etc. Likewise � z 1 1 � , � Log � 1 �� � , � Log � z ��� � . z � � 1 , z z z �� � , �� � , � � Π , �� Π ��

  16. 16 Talk - Part I.nb ExpIntegralE � 1, x � �� FunctionExpand � ExpIntegralEi � � x � � 1 2 � � Log � � 1 x � � Log � � x �� � Log � x � Refine � � , x � 0 � � ExpIntegralEi � � x � Visualizing branch-cuts 2 � z � over a complex plane shows singularities , and Plot of Legendre function Q 3 branch-cuts : � , � , LegendreQ � 3, 2, z � � 8 � 25 z 2 � 15 z 4 � 15 z � � 1 � z 2 � ArcTanh � z � � 1 � z 2

  17. Talk - Part I.nb 17 2 � z � is continuous at branch line z � 1 from below and at z � � 1 from above: Q 3 TableForm � Table � Limit � LegendreQ � 3, 2, z � , z � p, Direction � dir � �� FullSimplify, � dir, � � I, I, 1 �� , � p, � � 2, 2 ��� , TableHeadings � �� "from above", "from below", "at the point" � , � z � � 2, z � 2 ��� z � � 2 z � 2 � 45 � � 45 Log � 3 � � 45 � � 45 Log � 3 � 148 148 from above 3 3 � 45 � � 45 Log � 3 � � 45 � � 45 Log � 3 � 148 148 from below 3 3 � 45 � � 45 Log � 3 � � 45 � � 45 Log � 3 � 148 148 at the point 3 3

Recommend


More recommend