# Defining a complex variable

Posted 8 years ago
5985 Views
|
14 Replies
|
0 Total Likes
|
 In the following two equations with two variables "b" and "c". In my theory if i solve these two equations then i dont get required results, BUT if i explicitly write both variables b and c as complex numbers,i.e,. "b=x1+i y1" and " c= x2+ i y2 " and solve 4 equations like below then i get my required results, but i need to have previous form as it reduces time. CAN ANYONE GUIDE ME ? THANKSeq1 = -2.6496569219504336+ 2.3827335619844803/( 1.29731758306921+ (0.7463275363988051 - b)^2) - ( 0.7684079898461433b)/( 1.29731758306921 + (0.7463275363988051- b)^2) + 2.3827335619844803/( 1.29731758306921+ (0.7463275363988051 - c)^2) - ( 0.7684079898461433c)/( 1.29731758306921 + (0.7463275363988051 - c)^2)eq2 = 0.37580644282399783+ 0.013774982050389344/( 0.21352891577655558+ (0.34484941659029344 - b)^2) + ( 0.1448494165902934b)/( 0.21352891577655558 + (0.34484941659029344- b)^2) + 0.013774982050389344/( 0.21352891577655558+ (0.34484941659029344 - c)^2) + ( 0.1448494165902934c)/( 0.21352891577655558 + (0.34484941659029344 - c)^2)
14 Replies
Sort By:
Posted 8 years ago Posted 8 years ago
 In your last reply, In and In represent set of values of b and c?
Posted 8 years ago
 ! Posted 8 years ago
 Once again thanks for your guidance, I have tried your suggestion in my file, but it is not working. I have attached the file, Please see and guide me if i am doing wrong.Thanks Attachments:
Posted 8 years ago Posted 8 years ago Posted 8 years ago
 Hello Sir,Thanks for your time, Can you please explain as defining first b and c then solving equations for the same b and c has not worked.Thanks
Posted 8 years ago
 In:= eq1 = -2.6496569219504336 + 2.3827335619844803/(1.29731758306921 + (0.7463275363988051 - b)^2) - (0.7684079898461433 b)/(1.29731758306921 + \ (0.7463275363988051 - b)^2) + 2.3827335619844803/(1.29731758306921 + (0.7463275363988051 - c)^2) - (0.7684079898461433 c)/(1.29731758306921 + \ (0.7463275363988051 - c)^2); In:= eq2 = 0.37580644282399783 + 0.013774982050389344/(0.21352891577655558 + (0.34484941659029344 - b)^2) + (0.1448494165902934 b)/(0.21352891577655558 + \ (0.34484941659029344 - b)^2) + 0.013774982050389344/(0.21352891577655558 + (0.34484941659029344 - c)^2) + (0.1448494165902934 c)/(0.21352891577655558 + \ (0.34484941659029344 - c)^2); In:= NSolve[{eq1 == 0, eq2 == 0}, {b, c}] Out= {{b -> 1.1021 + 0.316679 I, c -> 0.212341 + 0.538527 I}, {b -> 1.10218 - 0.316787 I, c -> 0.212354 - 0.538553 I}, {b -> 0.212358 + 0.538566 I, c -> 1.10216 + 0.316634 I}, {b -> 0.212382 - 0.538559 I, c -> 1.10227 - 0.316857 I}, {b -> 0.0481784 + 0.785998 I, c -> 0.0482403 - 0.78599 I}, {b -> 0.0482052 - 0.785916 I, c -> 0.0481275 + 0.785992 I}, {b -> 0.0134349 + 0.479927 I, c -> 0.0133104 - 0.479802 I}, {b -> 0.013324 - 0.479794 I, c -> 0.0134405 + 0.479929 I}} 
Posted 8 years ago
 The time required by NSolve increases exponentially with the complexity of the problem. For 10 equations and 10 variables, it would be better to use FindRoot.
Posted 8 years ago
 Ok Sir,Can you please guide me in the case of 2 equations and 4 equations case as discussed in my last mail. As "I have no problem in solving the 2 equations with 2 variables, but by solving, the results are not favorable, but if i write the variables b and c in equations in the form of "b=x1+i y1 " and "c=x2+i y2 " and choosing 4 equations involving variables x1,y1, x2 and y2, then Using NSolve[{eq1, eq2, eq3, eq4}, {x1, y1, x2, y2}, Reals]. I get my favoured results.How can i get same results.For better understanding, please see the attached file Attachments:
Posted 8 years ago
 if i use either NSolve[{eq1, eq2}, {b, c}]or NSolve[{eq1, eq2}, {a1, b, c}]Values of both variables b and c are same in both cases. You can see in the attached file.Also sir, if you see my question, it was little different, I have no problem in solving the 2 equations with 2 variables, but by solving, the results are not favorable, but if i write the variables b and c in equations in the form of "b=x1+i y1 " and "c=x2+i y2 " and making 4 equations which is easy in my theory, with 4 variables, then Using NSolve[{eq1, eq2, eq3, eq4}, {x1, y1, x2, y2}, Reals].I get my required results. But this way is not good for me as when i go for higher dimensions, i.e 10 equations and 10 variables , then i face problem that my system stucks and stop running oblem Attachments:
Posted 8 years ago
 First question: saw b and c, assumed there was an a. It's better to put Mathematica code into a code sample, as it's easier to read. Second question: NSolve used that equation to give an answer to a problem with an infinite number of solutions.
Posted 8 years ago
 NSolve says your equations have an infinite number of solutions. In:= eq1 = -2.6496569219504336 + 2.3827335619844803/(1.29731758306921 + (0.7463275363988051 - b)^2) - (0.7684079898461433 b)/(1.29731758306921 + \ (0.7463275363988051 - b)^2) + 2.3827335619844803/(1.29731758306921 + (0.7463275363988051 - c)^2) - (0.7684079898461433 c)/(1.29731758306921 + \ (0.7463275363988051 - c)^2); In:= eq2 = 0.37580644282399783 + 0.013774982050389344/(0.21352891577655558 + (0.34484941659029344 - b)^2) + (0.1448494165902934 b)/(0.21352891577655558 + \ (0.34484941659029344 - b)^2) + 0.013774982050389344/(0.21352891577655558 + (0.34484941659029344 - c)^2) + (0.1448494165902934 c)/(0.21352891577655558 + \ (0.34484941659029344 - c)^2); In:= NSolve[{eq1, eq2}, {a, b, c}] During evaluation of In:= NSolve::infsolns: Infinite solution set has dimension at least 1. Returning intersection of solutions with (171802 a)/178835-(113492 b)/178835-(121484 c)/178835 == 1. >> Out= {{a -> 1.91912 - 0.59005 I, b -> 1.10211 - 0.316715 I, c -> 0.212318 - 0.538566 I}, {a -> 1.91912 + 0.59005 I, b -> 1.10211 + 0.316715 I, c -> 0.212318 + 0.538566 I}, {a -> 1.10666 + 0.0365591 I, b -> 0.0480565 - 0.785901 I, c -> 0.0480565 + 0.785901 I}, {a -> 1.10666 - 0.0365591 I, b -> 0.0480565 + 0.785901 I, c -> 0.0480565 - 0.785901 I}, {a -> 1.05913 + 0.0223244 I, b -> 0.0133044 - 0.479901 I, c -> 0.0133044 + 0.479901 I}, {a -> 1.05913 - 0.0223244 I, b -> 0.0133044 + 0.479901 I, c -> 0.0133044 - 0.479901 I}, {a -> 1.96051 - 0.579729 I, b -> 0.212318 - 0.538566 I, c -> 1.10211 - 0.316715 I}, {a -> 1.96051 + 0.579729 I, b -> 0.212318 + 0.538566 I, c -> 1.10211 + 0.316715 I}} 
Posted 8 years ago
 Thanks for your Answer,Can you please explain, why you have taken " a" as this is not included in equationsIn := NSolve[{eq1, eq2}, {a, b, c}]And can you please explain the following (171802 a)/178835 - (113492 b)/ 178835 - (121484 c)/178835 == 1.