Commands Submodule
Giac.Commands — Module
Giac.CommandsA submodule containing all exportable GIAC commands as functions.
This module provides access to ~2000+ GIAC commands while keeping the main Giac namespace clean. Commands can be accessed through three patterns:
Access Patterns
Qualified access (cleanest namespace):
using Giac Giac.Commands.factor(expr) Giac.Commands.diff(expr, x)Selective import (recommended for most use cases):
using Giac using Giac.Commands: factor, expand, diff factor(expr) # Works directlyFull import (for interactive exploration):
using Giac using Giac.Commands factor(expr) # All ~2000+ commands available ifactor(expr) # Works directly
Conflicting Commands
Commands that conflict with Julia keywords, builtins, or standard library functions (like eval, sin, det) are NOT exported from this module. Use invoke_cmd to call them:
using Giac
invoke_cmd(:eval, expr) # Works for any command
invoke_cmd(:sin, x) # Including conflicting onesExports
invoke_cmd: Universal command invocation function- All ~2000+ non-conflicting GIAC commands (runtime-generated)
See also
invoke_cmd: Call any GIAC command by nameGiac.JULIA_CONFLICTS: Commands that conflict with JuliaGiac.exportable_commands: List of exportable commands
The Giac.Commands submodule provides access to all exportable GIAC commands as Julia functions.
Usage
Selective Import (Recommended)
using Giac
using Giac.Commands: factor, expand, diff
expr = giac_eval("x^2 - 1")
factor(expr) # (x-1)*(x+1)Full Import
using Giac
using Giac.Commands
# All ~2000+ commands available
factor(giac_eval("x^2-1"))
ifactor(giac_eval("120"))Qualified Access
using Giac
Giac.Commands.factor(giac_eval("x^2-1"))Core Function
Giac.Commands.invoke_cmd — Function
invoke_cmd(cmd::Symbol, args...) -> GiacExprInvoke any GIAC command by name and return the result as a GiacExpr.
This is the core function for dynamic command invocation, enabling access to all 2200+ GIAC commands through a uniform interface. It works for all commands, including those that conflict with Julia builtins.
Arguments
cmd::Symbol: GIAC command name (e.g.,:factor,:sin,:integrate)args...: Command arguments (GiacExpr, String, Number, or Symbol)
Returns
GiacExpr: Result of command execution
Throws
GiacError(:eval): If command is unknown or execution failsArgumentError: If arguments cannot be converted to GIAC format
Examples
using Giac
# Single argument
expr = giac_eval("x^2 - 1")
result = invoke_cmd(:factor, expr) # Returns (x-1)*(x+1)
# Multiple arguments
x = giac_eval("x")
derivative = invoke_cmd(:diff, expr, x) # Returns 2*x
# Trigonometric functions (conflicts with Base)
result = invoke_cmd(:sin, giac_eval("pi/6")) # Returns 1/2
# Evaluation (conflicts with Base.eval)
result = invoke_cmd(:eval, giac_eval("2+3")) # Returns 5See also
giac_eval: Direct string evaluationGiac.search_commands: Find available commandsgiac_help: Get raw help for a command
Conflicting Commands
Commands that conflict with Julia keywords, builtins, or standard library functions are NOT exported from this module. Use invoke_cmd to call them:
# These conflict with Julia and are NOT exported:
# eval, sin, cos, det, inv, sum, prod, etc.
# Use invoke_cmd instead:
invoke_cmd(:eval, expr)
invoke_cmd(:sin, giac_eval("pi/6"))
invoke_cmd(:det, matrix)See JULIA_CONFLICTS for the complete list of conflicting commands.
Available Commands
Use exportable_commands() to get a list of all commands available in this module:
cmds = exportable_commands()
length(cmds) # ~2000+