home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / CCOMMON.PAK / SUPPORT.M
Encoding:
Text File  |  1992-07-29  |  4.0 KB  |  131 lines

  1.  
  2. (*:Version: Mathematica 2.0 *)
  3.  
  4. (*:Context: Calculus`Support` *)
  5.  
  6. (*:Title: Support *)
  7.  
  8. (*:Author: Eran Yehudai *)
  9.  
  10. (*:Summary: Implements functions used in both Laplace and Fourier transforms.  
  11. *)
  12.  
  13. (*:Keywords: Laplace, Fourier, transform, differential equations
  14. *)
  15.  
  16. (*:Requirements: None *)
  17.  
  18. (*:Sources:
  19.     Fritz Oberhettinger and Larry Badii (1973), "Tables of Laplace
  20.     Transforms", New-York: Springer-Verlag.
  21. *)
  22.  
  23. (*:History:
  24.     Version 1.1 by Eran Yehudai, November 1990.
  25.     Modified by ECM (Wolfram Research), December 1990.
  26.     Delta support modified by ECM (Wolfram Research), February 1992.
  27. *)
  28.  
  29. (*:Warning: Expands definition of Sign. *)
  30.  
  31. BeginPackage["Calculus`Common`Support`"]
  32.  
  33. ZeroLimit::usage =
  34. "ZeroLimit is an option of Laplace transform.  It determines how the limit  t
  35. -> 0, Direction -> 1 is treated in the transform definition.  ZeroLimit ->
  36. All uses the Limit function only.  ZeroLimit -> Automatic (default) is the
  37. same as  ZeroLimit -> All unless the Limit fails to evaluate.  In this case,
  38. the result is the expression evaluated at 0."
  39.  
  40. ComposedFunctionQ::usage =
  41. "ComposedFunctionQ[expr, x] returns a list of the smallest subexpressions
  42. containing x in expr."
  43.  
  44. ThomsonBei::usage =
  45. "ThomsonBei[nu, z] is the Thomson bei function."
  46.  
  47. ThomsonBer::usage =
  48. "ThomsonBer[nu, z] is the Thomson ber function."
  49.  
  50. ParabolicCylinderD::usage =
  51. "ParabolicCylinderD[nu, z] is the D parabolic cylinder function."
  52.  
  53. NumericPart::usage =
  54. "NumericPart[expr] is the numeric coefficient of N[expr]."
  55.  
  56. SimplifyErf::usage =
  57. "SimplifyErf[expr] attempts to simplify Erf in expr."
  58.  
  59. (************************************************************************)
  60. Begin["`Private`"]
  61. (************************************************************************)
  62.  
  63. (* =========================== Thomson Functions ========================= *)
  64.  
  65. ThomsonBei[n_, z_] :=
  66.   (BesselJ[n, z Exp[3 Pi I/4]] - BesselJ[n, z Exp[-3 Pi I/4]]) / (2I)
  67.  
  68. ThomsonBei[z_] := ThomsonBei[0, z]
  69.  
  70. ThomsonBer[n_, z_] :=
  71.   (BesselJ[n, z Exp[3 Pi I/4]] + BesselJ[n, z Exp[-3 Pi I/4]]) / 2
  72.  
  73. ThomsonBer[z_] := ThomsonBer[0, z]
  74.  
  75. (* ============================ SimplifyErf =============================== *)
  76.  
  77. SimplifyErf[expr_] := expr //. {
  78. Erf[a_] :> Module[{aa = Expand[a]}, Erf[aa] /; aa =!= a],
  79. Erf[a_] :> -Erf[Expand[-a]] /; OrderedQ[{Expand[-a], Expand[a]}]
  80. }
  81.  
  82. (* ================================ Sign =================================== *)
  83.  
  84. Unprotect[Sign]
  85. Sign/: Abs[x_]Sign[x_] := x
  86. Sign/: Abs[x_] Sign[xx_] := -x /; Expand[x+xx]==0
  87. Protect[Sign]
  88.  
  89. (* ========================== ParabolicCylinderD ========================== *)
  90.  
  91. ParabolicCylinderD[-1,z_] := Sqrt[Pi/2]Exp[z^2/4](1-Erf[z/Sqrt[2]])
  92.  
  93. ParabolicCylinderD[-1/2,z_] := Sqrt[z/(2Pi)] BesselK[1/4,z^2/4] 
  94.  
  95. ParabolicCylinderD[n_Integer, z_] :=
  96.   2^(-n/2) Exp[-z^2/4] HermiteH[n,z/Sqrt[2]] /; n >= 0
  97.  
  98. ParabolicCylinderD[p_, z_] := 2^(p/2)Exp[-z^2/4] (
  99.   Sqrt[Pi]Hypergeometric1F1[-p/2,1/2,z^2/2]/Gamma[(1-p)/2] -
  100.   Sqrt[2Pi] z Hypergeometric1F1[(1-p)/2,3/2,z^2/2]/Gamma[-p/2])
  101.  
  102.  
  103. (* ============================== NumericPart ============================= *)
  104.  
  105. NumericPart[expr_] := NN[N[expr]]
  106. NN[n_Integer x_.] := n
  107. NN[n_Real x_.] := n
  108. NN[n_Rational x_.] := n
  109. NN[n_Complex x_.] := n
  110. NN[n_DirectedInfinity x_.] := n
  111. NN[_] = 1
  112.  
  113.  
  114. (* =========================== ComposedFunctionQ ========================== *)
  115.  
  116. ComposedFunctionQ[f_, s_Symbol] :=
  117.   If[FreeQ[f, s] || f===s,
  118.     False,
  119.     (Drop[#,-1]& /@ Position[f, s]) /. {a___Integer} :> f[[a]]
  120.   ]
  121.  
  122. (************************************************************************)
  123. End[]             (* end `Private` Context                              *)
  124. (************************************************************************)
  125.  
  126.  
  127.  
  128. (************************************************************************)
  129. EndPackage[]      (* end package Context                                *)
  130. (************************************************************************)
  131.