JuliaSymbolics / Symbolics.jl

Symbolic programming for the next generation of numerical software
https://docs.sciml.ai/Symbolics/stable/
Other
1.36k stars 151 forks source link

`sinc` function has not been registered #73

Open B-LIE opened 3 years ago

B-LIE commented 3 years ago

The sinc function has not been registered in Symbolics.

┆Issue is synchronized with this Trello card by Unito

YingboMa commented 3 years ago

Do you mind to check a few other functions and make a PR?

ChrisRackauckas commented 3 years ago

I'm surprised it's not in DiffRules. Is there a set of rules for them somewhere?

B-LIE commented 3 years ago

I can check some functions. Do you have anyone in mind, or should I just set up a list and test them?

I'm not super good with GitHub... I had to get help from a colleague to make a PR for the documentation (macros for variables vs. parameters), and I understand that a PR is a proposal for change in code or text. I'm probably not qualified to make a PR for functions... I certainly don't want to mess up your code :-o

B-LIE commented 3 years ago

OK -- I did the following:

using Symbolics
#
@variables x
D = Differential(x)
# 
# Vector of math functions with single arguments found in Julia Documentation
vf = [sin,cos,sincos,tan,sind,cosd,tand,sinpi,cospi,sinh,cosh,asin,acos,atan,asind,acosd,atand,sec,csc,cot,secd,cscd,cotd,
    asec,acsc,acot,asecd,acscd,acotd,sech,csch,coth,asinh,acosh,atanh,asech,acsch,acoth,sinc,cosc,deg2rad,rad2deg,
    log,log2,log10,log1p,exp,exp2,exp10,expm1,abs,abs2,sqrt,cbrt];
# 
[try
        vf[i](x)
catch
        println("Not defined: #$(i)")
end
        for i in 1:length(vf)]
;

leading to:

Not defined: #3
Not defined: #39
Not defined: #40

Thus, the following functions appear to be not defined properly in Symbolics:

julia> vf[[3,39,40]]
3-element Array{Function,1}:
 sincos
 sinc
 cosc

I also did something similar wrt. differentiation, and found that abs doesn't handle differentiation.