gonum.org/v1/gonum@v0.15.1-0.20240517103525-f853624cb1bb/mathext/airy.go (about)

     1  // Copyright ©2016 The Gonum Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package mathext
     6  
     7  import "gonum.org/v1/gonum/mathext/internal/amos"
     8  
     9  // AiryAi returns the value of the Airy function at z. The Airy function here,
    10  // Ai(z), is one of the two linearly independent solutions to
    11  //
    12  //	y′′ - y*z = 0.
    13  //
    14  // See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
    15  func AiryAi(z complex128) complex128 {
    16  	// id specifies the order of the derivative to compute,
    17  	// 0 for the function itself and 1 for the derivative.
    18  	// kode specifies the scaling option. See the function
    19  	// documentation for the exact behavior.
    20  	id := 0
    21  	kode := 1
    22  	air, aii, _, _ := amos.Zairy(real(z), imag(z), id, kode)
    23  	return complex(air, aii)
    24  }
    25  
    26  // AiryAiDeriv returns the value of the derivative of the Airy function at z. The
    27  // Airy function here, Ai(z), is one of the two linearly independent solutions to
    28  //
    29  //	y′′ - y*z = 0.
    30  //
    31  // See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
    32  func AiryAiDeriv(z complex128) complex128 {
    33  	// id specifies the order of the derivative to compute,
    34  	// 0 for the function itself and 1 for the derivative.
    35  	// kode specifies the scaling option. See the function
    36  	// documentation for the exact behavior.
    37  	id := 1
    38  	kode := 1
    39  	air, aii, _, _ := amos.Zairy(real(z), imag(z), id, kode)
    40  	return complex(air, aii)
    41  }