You can name a symbol any string you want, so Symbol(r'\nabla') will create a symbol named \nabla.
To test if a symbol is in an expression, use .has(): >>> (x + 1).has(x) True >>> (y + 1).has(x) False Aaron Meurer On Fri, Sep 16, 2022 at 6:26 AM Yang Liu <[email protected]> wrote: > > Hi, > > I want to represent the \nabla symbolically without calculation. Is there a > way to declare such a symbol? Also for \triangle? > > Moreover, I want to write a function say F(\nabla u) take \nabla*u as an > input. Is there a way to detect if I pass the "\nabla" into the function? > Pseudo code would be something like: > > F(expression): > if \nabla in expression: > do something > else: > > Many Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/cab2a16d-8fa0-4875-971e-7e39a10077d2n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Lv_RRVG6OaC14tn-bj5vBYNiuekqbkVebHx1RXbwbUiw%40mail.gmail.com.
