# Message Boards

Posted 10 years ago
3191 Views
|
4 Replies
|
0 Total Likes
|
 Hi all,I am trying to solve the following system of two equations in order two obtain a value for the two parameters I am interested in.The two equations are the Real and the Imaginary part of the same function which I called pol, and both of the equations should be equal to zero.pol[M_, T_] =0.801526 - (M - (I*T)/2)^2 -0.198833 I (M - (I*T)/2)^2 ((1/((M - (I*T)/2)^6))0.0529229 ((-2.10673 + (M - (I*T)/2)^2) (-0.215392 + (M - (I*T)/2)^2))^(3/2)HeavisideTheta[-2.10673+(M-(I*T)/2)^2]^3+(1/((M - (I*T)/2)^6))0.947077 ((-1.08478 + (M - (I*T)/2)^2) (-0.00293504 + (M - (I*T)/2)^2))^(3/2)HeavisideTheta[-1.08478 + (M - (I*T)/2)^2]^3+(1/((M - (I*T)/2)^6))((-0.406049+(M-(I*T)/2)^2) (-0.128221 + (M - (I*T)/2)^2))^(3/2)HeavisideTheta[-0.406049 + (M - (I*T)/2)^2]^3)0.198833 I (M - (I*T)/2)^2 ((1/((M - (I*T)/2)^6))0.0529229 ((-2.10673 + (M - (I*T)/2)^2) (-0.215392 + (M - (I*T)/2)^2))^(3/2)HeavisideTheta[-2.10673 + (M - (I*T)/2)^2]^3 + (1/((M - (I*T)/2)^6))0.947077 ((-1.08478 + (M - (I*T)/2)^2) (-0.00293504 + (M - (I*T)/2)^2))^(3/2)HeavisideTheta[-1.08478 + (M - (I*T)/2)^2]^3 + (1/((M - (I*T)/2)^6))((-0.406049 + (M - (I*T)/2)^2) (-0.128221 + (M - (I*T)/2)^2))^(3/2)HeavisideTheta[-0.406049 + (M - (I*T)/2)^2]^3) NSolve[{ComplexExpand[Re[POL[M,T]]]==0,ComplexExpand[Im[POL[M,T]]]==0},{M,T}]Both equations depends on the parameters M and T whose values is  what I am interested to obtain by solving the system of equations through the NSolve mathematica command.After waiting lot of time trying to get an answer from mathematica I abort the computation because I think I am doing something wrong because to solve a system of two equations can not take such a long time. Notice that some HeavisideTheta of complex numbers appears and maybe I have to treat it in a specific manner I don't know by the way.Any help to solve it will be very acknowledged.All my best
4 Replies
Sort By:
Posted 10 years ago
 Thank you again Frank, but I need to solve a system of two equations because I have two variables. And I know that the system of equations should be the real and the imaginary part separetely of my function defined as pol[M_,T_]. So If I want to take the real part of this function I thought I need to take ComplexExpand and as well for the imaginary part.The values of M and T I want to obtain should be real. So the problem is how to select both the real and the imaginary part of the function pol and equating it to zero in order to solve my problem.I think that the problem is inside the HeavisideTheta function wich contains some imaginary part, but it should contain it.Thank you a lot again
Posted 10 years ago
 NSolve[x^2 == 1 + 2 I, x]{{x -> -1.27202 - 0.786151 I}, {x -> 1.27202 + 0.786151 I}}
Posted 10 years ago
 Hello Frank,when I have some variable I think I have to use the ComplexExpand command in order to take the required real and imaginary part of a complex number. Here and exemple:Imagine I have the complex number B = b + I*cand now I take the real part, it gives meRe[B]equal to -Im[c] + Re[b]OtherwiseComplexExpand[Re[B]]gives mebAnd as well for the imaginary part.Thanks a lot anyhow
Posted 10 years ago
 I don't think you need to ComplexExpand the function.  NSolve can handle complex functions and solutions.