Message Boards Message Boards

0
|
6642 Views
|
14 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Defining a complex variable

Posted 9 years ago

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 ? THANKS

eq1 = -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)

POSTED BY: Kashif Nazar
14 Replies

enter image description here

POSTED BY: Simon Cadrin

In your last reply, In[8] and In[10] represent set of values of b and c?

POSTED BY: Kashif Nazar

!enter image description here

POSTED BY: Simon Cadrin

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 BY: Kashif Nazar

enter image description here

POSTED BY: Simon Cadrin

enter image description here

POSTED BY: Simon Cadrin

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 BY: Kashif Nazar
In[1]:= 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[2]:= 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[3]:= NSolve[{eq1 == 0, eq2 == 0}, {b, c}]

Out[3]= {{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 BY: Frank Kampas

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 BY: Frank Kampas

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 BY: Kashif Nazar

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 BY: Kashif Nazar

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 BY: Frank Kampas

NSolve says your equations have an infinite number of solutions.

In[1]:= 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[2]:= 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[4]:= NSolve[{eq1, eq2}, {a, b, c}]

During evaluation of In[4]:= 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[4]= {{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 BY: Frank Kampas

Thanks for your Answer,

Can you please explain, why you have taken " a" as this is not included in equations

In[4] := NSolve[{eq1, eq2}, {a, b, c}]

And can you please explain the following

(171802 a)/178835 - (113492 b)/ 178835 - (121484 c)/178835 == 1.

POSTED BY: Kashif Nazar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract