@@ -111,7 +111,12 @@ const symengine_classes = _get_symengine_classes()
111111const symengine_classes_val = [Val (c) for c in SymEngine. symengine_classes]
112112const symengine_classes_val_type = [Val{c} for c in SymEngine. symengine_classes]
113113
114- " Get SymEngine class of an object (e.g. 1=>:Integer, 1//2 =:Rational, sin(x) => :Sin, ..."
114+ """
115+ get_symengine_class(s)
116+
117+ Get SymEngine class of an object `s`.
118+ (e.g. `1=>:Integer`, `1//2 =>:Rational`, `sin(x) => :Sin`, ...)
119+ """
115120get_symengine_class (s:: Basic ) = symengine_classes[get_type (s) + 1 ]
116121get_symengine_class_val (s:: Basic ) = symengine_classes_val[get_type (s) + 1 ]
117122get_symengine_class_val_type (s:: Basic ) = symengine_classes_val_type[get_type (s) + 1 ]
@@ -128,8 +133,9 @@ _symbol(s::Symbol) = _symbol(string(s))
128133
129134# # use SymPy name here, but no assumptions
130135"""
136+ symbols(::Symbol)
131137
132- `symbols(::Symbol)` construct symbolic value
138+ Construct symbolic value.
133139
134140Examples:
135141```
@@ -255,28 +261,44 @@ BasicTrigFunction = Union{[SymEngine.BasicType{Val{i}} for i in trig_types]...}
255261
256262# ##
257263
258- " Is expression constant"
264+ """
265+ is_constant(ex)
266+
267+ Is expression constant
268+ """
259269function is_constant (ex:: Basic )
260270 syms = CSetBasic ()
261271 ccall ((:basic_free_symbols , libsymengine), Nothing, (Ref{Basic}, Ptr{Cvoid}), ex, syms. ptr)
262272 Base. length (syms) == 0
263273end
264274
265- " Is expression a symbol"
275+ """
276+ is_symbol(x::)
277+
278+ Is expression a symbol
279+ """
266280function is_symbol (x:: SymbolicType )
267281 res = ccall ((:is_a_Symbol , libsymengine), Cuint, (Ref{Basic},), x)
268282 Bool (convert (Int,res))
269283end
270284
271- " Does expression contain the symbol"
285+ """
286+ has_symbol(ex, x)
287+
288+ Does expression `ex` contain the symbol `x`
289+ """
272290function has_symbol (ex:: SymbolicType , x:: SymbolicType )
273291 is_symbol (x) || throw (ArgumentError (" Not a symbol" ))
274292 res = ccall ((:basic_has_symbol , libsymengine), Cuint, (Ref{Basic},Ref{Basic}), ex, x)
275293 Bool (convert (Int, res))
276294end
277295
278296
279- " Return free symbols in an expression as a `Set`"
297+ """
298+ free_symbols(ex)
299+
300+ Return free symbols in an expression `ex` as a `Set`
301+ """
280302function free_symbols (ex:: Basic )
281303 syms = CSetBasic ()
282304 free_symbols! (syms, ex)
@@ -294,7 +316,11 @@ _flat(A) = mapreduce(x->isa(x,Array) ? _flat(x) : x, vcat, A, init=Basic[]) # f
294316free_symbols (exs:: Array{T} ) where {T<: SymbolicType } = unique (_flat ([free_symbols (ex) for ex in exs]))
295317free_symbols (exs:: Tuple ) = unique (_flat ([free_symbols (ex) for ex in exs]))
296318
297- " Return function symbols in an expression as a `Set`"
319+ """
320+ function_symbols(ex)
321+
322+ Return function symbols in an expression `ex` as a `Set`
323+ """
298324function function_symbols (ex:: Basic )
299325 syms = CSetBasic ()
300326 function_symbols! (syms, ex)
@@ -309,15 +335,23 @@ function_symbols(ex::BasicType) = function_symbols(Basic(ex))
309335function_symbols (exs:: Array{T} ) where {T<: SymbolicType } = unique (_flat ([function_symbols (ex) for ex in exs]))
310336function_symbols (exs:: Tuple ) = unique (_flat ([function_symbols (ex) for ex in exs]))
311337
312- " Return name of function symbol"
338+ """
339+ get_name(ex)
340+
341+ Return name of function symbol
342+ """
313343function get_name (ex:: Basic )
314344 a = ccall ((:function_symbol_get_name , libsymengine), Cstring, (Ref{Basic}, ), ex)
315345 string = unsafe_string (a)
316346 ccall ((:basic_str_free , libsymengine), Nothing, (Cstring, ), a)
317347 return string
318348end
319349
320- " Return arguments of a function call as a vector of `Basic` objects"
350+ """
351+ get_args(ex)
352+
353+ Return arguments of a function call as a vector of `Basic` objects
354+ """
321355function get_args (ex:: Basic )
322356 args = CVecBasic ()
323357 get_args! (args, ex)
0 commit comments