Adding zero to an expression and avoiding simplification

asked 2017-02-10 23:34:49 +0200

NahsiN gravatar image

updated 2017-02-10 23:49:02 +0200

Hi, I have an expression of the form

pol_y = chi_yyyy*Ey*Ey*Ey + (chi_yyxx + chi_yxyx + chi_yxxy)*Ey*Ex*Ex - (chi_yyxx + chi_yxyx + chi_yxxy)*Ey*Ex*Ex + (chi_yyxx + chi_yxyx + chi_yxxy)*Ey*Ex*Ex

Now the last two terms add 0 to the expression. The goal is to substitute complicated expressions for Ey, Ex (complex quantities) and compare the results of two different reformulations (with and without the 0 terms). So for my work, I need the last two terms to be there but sagemath is simplifying this expression automatically. How do I avoid this?

edit retag flag offensive close merge delete

Comments

But after a substitution those two terms are always going to add to zero, right?

paulmasson gravatar imagepaulmasson ( 2017-02-11 03:15:01 +0200 )edit

Yes as they should. But when expressions are of the form $E_x =
\frac{1}{2} \, {\left({{E}_x^-} e^{\left(i \, k x\right)} + {E_x^+} e^{\left(-i \, k x\right)}\right)} e^{\left(i \, \omega t\right)} + \frac{1}{2} \, {\left(\overline{{E_x^+}} e^{\left(i \, k x\right)} + \overline{{{E}_x^-}} e^{\left(-i \, k x\right)}\right)} e^{\left(-i \, \omega t\right)}$ and $ E_y = \frac{1}{2} \, {\left({{E}_y^-} e^{\left(i \, k x\right)} + {E_y^+} e^{\left(-i \, k x\right)}\right)} e^{\left(i \, \omega t\right)} + \frac{1}{2} \, {\left(\overline{{E_y^+}} e^{\left(i \, k x\right)} + \overline{{{E}_y^-}} e^{\left(-i \, k x\right)}\right)} e^{\left(-i \, \omega t\right)}$. This can yield to two different expressions for pol_y that might seem different at first but are equivalent.

NahsiN gravatar imageNahsiN ( 2017-02-11 17:48:28 +0200 )edit