# Some help for rewriting this complex function [closed]

I have here a complex function in which z =x+ I y must be filled in

f[z_] := E^(-z^2)

By hand : (-E^(-x^2))*E^y^2*(Cos[2*x*y]-I*Sin[2*x*y]) Can this be derived in MMA ?

I tried to use z= x+Iy and the formula of Euler, but don't get the manual outcome?

By hand inference the answer should come out listed here. Unfortunately, I am not yet getting to this manual derivation.

I wonder if this is really so important now because there are further calculations to be made.

But yes I am trying to follow a math text.

• Simplify@ComplexExpand@f[x + I y]?
– kglr
Mar 28 at 21:16
• @kglr, how easy can it be :) ComplexExpand command was not present by me Mar 28 at 21:37
• @janhardo please have a look at the edit. I am hoping that now is clear that there's a loose sign in your expression.
– bmf
Mar 28 at 21:43
• You haven't accept many, if any, answers. It's polite to thank people by doing so. Please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Mar 29 at 19:53
• @bmf no problem. For that matter, I like to comment in terms of politeness because it tends to get the attention of new users that they are participants in a community that has norms. I think it helps the community if answerers feel appreciated, whatever other benefits there are too accepting answers. And I think become better community members as they figure out how to participate in better ways. Mar 29 at 22:03

The following works if I am not mistaken

E^(-z^2) /. z -> x + I y // ComplexExpand // Factor


E^(-x^2 + y^2) (Cos[2 x y] - I Sin[2 x y])

Edit: I believe there's a small typo in the OP. An overall sign, i.e this

Just to make it clearer

In the OP this is written

janhardo = (-E^(-x^2))*E^y^2*(Cos[2*x*y] - I*Sin[2*x*y]);


Mathematica gives us this

mma = E^(-z^2) /. z -> x + I y // ComplexExpand // Factor;


If I subtract I should get zero, but I don't.

janhardo - mma // FullSimplify


-2 E^-(x + I y)^2

janhardo + mma


0

hence an overall minus sign missing.

Better understanding, just divide

janhardo/mma // FullSimplify


-1.

Edit: final comment. This is not really related to Mathematica, but Maths.

The expression after substitution is

Exp[-x^2 + y^2]


which can be written as Exp[-x^2] Exp[y^2]. Verification:

Exp[-x^2 + y^2]/(Exp[-x^2] Exp[y^2]) // FullSimplify


1

But in the OP it is written as -Exp[-x^2]*Exp[y^2].

Exp[-x^2 + y^2]/(-Exp[-x^2]*Exp[y^2]) // FullSimplify


-1

• thanks, it was ComplexExpand needed. Unfortunately it was not yet ready with me I'm so used to Expand...i forget ComplexExpand I checked my typed in manually obtained formula, but don't see the typo? Mar 28 at 21:35
• @janhardo it's easy enough to understand why I suggested it. You gave a formula. I copied, pasted and subtracted from the expression after ComplexExpand//Factor. It should give zero, but it does not. When I sum them, you get a zero, hence there must be an overall minus sign. You can check for yourself
– bmf
Mar 28 at 21:39
• thanks . Indeed a typo then : a minus sign before the e power manual formula. MMA gives the right answer now: now doubt abou tthis . Mar 28 at 22:17
• @janhardo glad I was able to help. If you found this answer useful, you can consider accepting it by clicking the checkmark sign :-)
– bmf
Mar 28 at 22:46
• bmf, i did now choose for your excellent answer for rating: useful and as best answer too (although there is one answer, its a best one ) Mar 29 at 21:52