github.com/gopherd/gonum@v0.0.4/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 "github.com/gopherd/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 // y'' - y*z = 0. 12 // See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information. 13 func AiryAi(z complex128) complex128 { 14 // id specifies the order of the derivative to compute, 15 // 0 for the function itself and 1 for the derivative. 16 // kode specifies the scaling option. See the function 17 // documentation for the exact behavior. 18 id := 0 19 kode := 1 20 air, aii, _, _ := amos.Zairy(real(z), imag(z), id, kode) 21 return complex(air, aii) 22 } 23 24 // AiryAiDeriv returns the value of the derivative of the Airy function at z. The 25 // Airy function here, Ai(z), is one of the two linearly independent solutions to 26 // y'' - y*z = 0. 27 // See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information. 28 func AiryAiDeriv(z complex128) complex128 { 29 // id specifies the order of the derivative to compute, 30 // 0 for the function itself and 1 for the derivative. 31 // kode specifies the scaling option. See the function 32 // documentation for the exact behavior. 33 id := 1 34 kode := 1 35 air, aii, _, _ := amos.Zairy(real(z), imag(z), id, kode) 36 return complex(air, aii) 37 }