why does `substitute()` not work with `canonicalize_radical()`
With a symbolic expression, i take two attempts to substitute a term within the expression. In the first, which was simplified with canonicalize_radical()
, substitution is not working, but in the second, without canonicalize_radical()
, the substitution is working.
Why is it?
This is the smallest example i could think at this moment, but it reproduces the behavior
t,u,v = var('t,u,v')
phi(u,v) = cos(u)*v
g_x(t) = function(r'\gamma_x')(t)
g_y(t) = function(r'\gamma_y')(t)
vs = diff(phi(g_x(t), g_y(t)), t)
vs
"-\gamma_y(t)sin(\gamma_x(t))diff(\gamma_x(t), t) + cos(\gamma_x(t))*diff(\gamma_y(t), t)"
conds = [cos(g_x(t))==1, sin(g_x(t)) ==0]
vs.canonicalize_radical().substitute(conds)
"-\gamma_y(t)sin(\gamma_x(t))diff(\gamma_x(t), t) + cos(\gamma_x(t))*diff(\gamma_y(t), t)"
vs.substitute(conds)
︡"diff(\gamma_y(t), t)"
The way you (ab)use "symbolic functions" (callable symbolic expressions) definition bit you :
why not :
i didnt know it made a difference. thanks!