UsingMathLink
It convert the MathLink output to Julia function and symengine function. The functions are used to perform the integral by Cuba
Install / Use
/learn @AmplitudeGravity/UsingMathLinkREADME
usingMathLink
It convert the MathLink output to Julia function and symengine function. The functions are used to in Cuba which is a numerical integration package. It depends on the following packages: SymEngine MathLink SyntaxTree, SpecialFunctions
Example: define the mathlink symbol for variable or mathematica functions
using UseMathLink, MathLink
@wvar Solve Flatten #import the mathematica function 当心函数重名
@wvars c 2
sol=Solve((c1+0.2+0.2im==0,c1+(-1)*c2+0.1==0),(c1,c2))|>weval|>Flatten|>weval|>math2Expr
The output result is
2-element Array{Expr,1}:
:(Rule(c1, Complex(-0.2, -0.2)))
:(Rule(c2, Complex(-0.1, -0.2)))
math2Expr("OutPut of MathLink")
transform the mathematica Expression to Julia Expr
expr2fun("Julia Expr")
transform the Julia Expr to a julia function. This function is used in the CUBA.
math2symEngine("OutPut of MathLink")
transform the mathematica Expreesion to symEngine function. To get julia function, you can use the lambdify function in SymEngine.
lambdify(math2symEngine("OutPut of MathLink"),(symbol variables))
To get value of the symEngine function, you can also use the evalSym() function
MLExpr=W`List[polygamma[n,x],gamma[y],gamma[z]]`|>weval
SEExpr=math2symEngine(MLExpr)
@vars n x y
subs(SEExpr[1],n=>2,x=>0.2)|>evalSym
-251.47803611443592
Add the OPFunctor: it can transform a function into an Funtor
ObFunctor("function name", variable numbers)
Power() function to replace the power function ^ in Julia. The fraction Power fucntion is fixed to the canonical branch.
Power(-2-0.0im,-0.2)
0.7042902001692478 - 0.5116967824803669im
define the symbol variables by the macro
@jvars x 3 3 3
@jvars x 16
@jvar x1 x2 x3 y4
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
