You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# replace an expression with a variableusing Symbolics
@variables t
@symsω(t) Pg(t) Pge(t) Pgc(t)
@variables A R a b Γ ρ U J Q
expr = (0.5A*R*a*Γ*ρ*(U^2)) / (J*ω(t)) - J*((0.5A*Γ*ρ*(U^3)*(b + (R*a*ω(t)) / U) -Pgc(t) -Pge(t)) / ((J^2)*(ω(t)^2)))
# Q = 0.5A*R*a*Γ*ρ# how to substitute 0.5A*R*a*Γ*ρ by Q in expr?
expr2 =substitute(expr, Dict([0.5A*R*a*Γ*ρ => Q]))
The following code does not work:
Result:
Expected result:
Related: #988
Discussion on Discourse: https://discourse.julialang.org/t/how-to-simplify-a-symbolic-expression/104381
The text was updated successfully, but these errors were encountered: