SymbolicUtils.jl icon indicating copy to clipboard operation
SymbolicUtils.jl copied to clipboard

@rule for Rewriting Arithmetic Operations on Functions

Open hiiroo opened this issue 1 year ago • 2 comments

Hello everyone,

I looked for this use case but couldn't find it. I wonder if writing a rule that will compose a new function is possible. Is this a valid use case of SymbolicUtils.jl?

f1(x,y,z)=x^2
f2(x,y,z)=y^2
r1 = @rule a(~x,~y,~z)::Function*b(~x,~y,~z)::Function=>(~x,~y,~z)->a(~x,~y,~z)*b(~x,~y,~z)
f12 = r1(f1(x,y,z)*f2(x,y,z)) # so that it would be possible call it like f12(x,y,z)

hiiroo avatar Nov 05 '22 09:11 hiiroo