@@ -164,12 +164,12 @@ end
164
164
# ODE gives the first order ODE a special function op satisfies,
165
165
# RHS is the right hand side
166
166
# growth says what to use to choose a good point to impose an initial condition
167
- for (op, ODE, RHS, growth) in (
168
- (:(exp), " D-f'" , " 0" , :(real)),
167
+ for (op, ODE, RHS, growth) in ((:(exp), " D-f'" , " 0" , :(real)),
169
168
(:(asinh), " sqrt(f^2+1)*D" , " f'" , :(real)),
170
169
(:(acosh), " sqrt(f^2-1)*D" , " f'" , :(real)),
171
170
(:(atanh), " (1-f^2)*D" , " f'" , :(real)),
172
- )
171
+ (:(erfcx), " D-2f*f'" , " -2f'/sqrt(π)" , :(real)),
172
+ (:(dawson), " D+2f*f'" , " f'" , :(real)))
173
173
L,R = Meta. parse (ODE), Meta. parse (RHS)
174
174
@eval begin
175
175
# depice before doing op
@@ -208,12 +208,16 @@ function specialfunctionnormalizationpoint2(op, growth, f, T = cfstype(f))
208
208
xmin, xmax, opfxmin, opfxmax, opmax
209
209
end
210
210
211
- for (op,ODE,RHS,growth) in (
211
+ for (op,ODE,RHS,growth) in ((:(erf)," f'*D^2+(2f*f'^2-f'')*D" ," 0" ,:(imag)),
212
+ (:(erfi)," f'*D^2-(2f*f'^2+f'')*D" ," 0" ,:(real)),
212
213
(:(sin)," f'*D^2-f''*D+f'^3" ," 0" ,:(imag)),
213
214
(:(cos)," f'*D^2-f''*D+f'^3" ," 0" ,:(imag)),
214
215
(:(sinh)," f'*D^2-f''*D-f'^3" ," 0" ,:(real)),
215
216
(:(cosh)," f'*D^2-f''*D-f'^3" ," 0" ,:(real)),
216
- )
217
+ (:(airyai)," f'*D^2-f''*D-f*f'^3" ," 0" ,:(imag)),
218
+ (:(airybi)," f'*D^2-f''*D-f*f'^3" ," 0" ,:(imag)),
219
+ (:(airyaiprime)," f'*D^2-f''*D-f*f'^3" ," airyai(f)*f'^3" ,:(imag)),
220
+ (:(airybiprime)," f'*D^2-f''*D-f*f'^3" ," airybi(f)*f'^3" ,:(imag)))
217
221
L,R = Meta. parse (ODE),Meta. parse (RHS)
218
222
@eval begin
219
223
function $op (fin:: Fun )
@@ -230,6 +234,8 @@ for (op,ODE,RHS,growth) in (
230
234
end
231
235
end
232
236
237
+ erfc (f:: Fun ) = 1 - erf (f)
238
+
233
239
234
240
exp2 (f:: Fun ) = exp (log (2 )* f)
235
241
exp10 (f:: Fun ) = exp (log (10 )* f)
271
277
sinpi (f:: Fun ) = sin (π* f)
272
278
cospi (f:: Fun ) = cos (π* f)
273
279
280
+ function airy (k:: Number ,f:: Fun )
281
+ if k == 0
282
+ airyai (f)
283
+ elseif k == 1
284
+ airyaiprime (f)
285
+ elseif k == 2
286
+ airybi (f)
287
+ elseif k == 3
288
+ airybiprime (f)
289
+ else
290
+ error (" invalid argument" )
291
+ end
292
+ end
293
+
294
+ besselh (ν,k:: Integer ,f:: Fun ) = k == 1 ? hankelh1 (ν,f) : k == 2 ? hankelh2 (ν,f) : throw (Base. Math. AmosException (1 ))
295
+
296
+ for jy in (:j , :y )
297
+ bjy = Symbol (:bessel , jy)
298
+ for ν in (0 ,1 )
299
+ bjynu = Symbol (bjy, ν)
300
+ @eval SpecialFunctions.$ bjynu (f:: Fun ) = $ bjy ($ ν,f)
301
+ end
302
+ end
303
+
274
304
# # Miscellaneous
275
- for op in (:(expm1),:(log1p),:(sinc),:(cosc))
305
+ for op in (:(expm1),:(log1p),:(lfact),:(sinc),:(cosc),
306
+ :(erfinv),:(erfcinv),:(beta),:(lbeta),
307
+ :(eta),:(zeta),:(gamma),:(lgamma),
308
+ :(polygamma),:(invdigamma),:(digamma),:(trigamma))
276
309
@eval begin
277
310
$ op (f:: Fun ) = Fun ($ op ∘ f,domain (f))
278
311
end
@@ -424,18 +457,41 @@ for (funsym, exp) in Calculus.symbolic_derivatives_1arg()
424
457
funsym == :sign && continue
425
458
funsym == :exp && continue
426
459
funsym == :sqrt && continue
427
- if isdefined (Base, funsym)
428
- @eval begin
429
- $ (funsym)(z:: Fun{<:ConstantSpace,<:Real} ) =
430
- Fun ($ (funsym)(Number (z)),space (z))
431
- $ (funsym)(z:: Fun{<:ConstantSpace,<:Complex} ) =
432
- Fun ($ (funsym)(Number (z)),space (z))
433
- $ (funsym)(z:: Fun{<:ConstantSpace} ) =
434
- Fun ($ (funsym)(Number (z)),space (z))
460
+ @eval begin
461
+ $ (funsym)(z:: Fun{<:ConstantSpace,<:Real} ) =
462
+ Fun ($ (funsym)(Number (z)),space (z))
463
+ $ (funsym)(z:: Fun{<:ConstantSpace,<:Complex} ) =
464
+ Fun ($ (funsym)(Number (z)),space (z))
465
+ $ (funsym)(z:: Fun{<:ConstantSpace} ) =
466
+ Fun ($ (funsym)(Number (z)),space (z))
467
+ end
468
+ end
469
+
470
+ # Other special functions
471
+ for f in [:logabsgamma ]
472
+ @eval function $f (z:: Fun{<:ConstantSpace, <:Real} )
473
+ t = $ f (Number (z))
474
+ Fun (t[1 ], space (z)), t[2 ]
475
+ end
476
+ end
477
+ function loggamma (z:: Fun{<:ConstantSpace} )
478
+ t = loggamma (Number (z))
479
+ Fun (t, space (z))
480
+ end
481
+ for f in [:gamma , :loggamma ]
482
+ @eval begin
483
+ function $f (a, z:: Fun{<:ConstantSpace} )
484
+ t = $ f (a, Number (z))
485
+ Fun (t, space (z))
435
486
end
436
487
end
437
488
end
438
489
490
+ for f in [:besselj , :besselk , :besselkx , :bessely , :besseli ,
491
+ :hankelh1x , :hankelh2x , :hankelh1 , :hankelh2 ]
492
+ @eval $ f (nu, x:: Fun{<:ConstantSpace} ) = Fun ($ f (nu, Number (x)), space (x))
493
+ end
494
+
439
495
# Roots
440
496
441
497
for op in (:(argmax),:(argmin))
0 commit comments