Solving a system of equations (complex variable)

Normal
0
21

false
false
false

MicrosoftInternetExplorer4

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Normale Tabelle";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}

Hello!

Could you help me solving a system of two equations with two variables, one of them being a complex variable?

The system has the general form:

f(U,V)=0

Re(g(U,V))=0

Here, f and g are given functions with variables U and V. V has a real value, whereas U takes a complex value, such that U=Re(U)+i Im(U). Thus, the numeric solution of the system is expressed in numeric values for V and U=Re(U)+i Im(U).

Thank you very much in advance,

Willie

epostma's picture

Assumptions

Hi Willie,

In general, Maple will assume that any variable you use can have a complex value. If one of them is real (as in your example) then you can specify this using the "assuming" facility. So you could use something like:

solve({f(U, V) = 0, Re(g(U, V)) = 0}) assuming V :: real;

If this does not give the desired answer, feel free to post again with more details about your system of equations.

Best,

Erik Postma
Maplesoft

To Erik Postma from Willie

Dear Erik, I thank you very much for your assistance. Indeed, your help gave me some solution. But now I can not understand something again.

 

So, I need to solve the following system of two equations

 

Re(ikV+α(U))=0,        iV+d α(U)/dU = 0,                                                                             (1)

 

with  V the real variable, U the imaginary variable, and the known functions

 

α(U)=U^2(a-(1-U^2)^2),                   d α(U)/dU=2U(a-(1-U^2)^2+2U^2(1-U^2)),            (2)

 

where a is the constant.

 

For the system of equations (1)-(2), I write the following (very short) program on MAPLE:

 

> restart;

#                                    WILLIES PROGRAM CODE No. 1

> Digits:=6;

# VARIABLES:        U the imagimary variable, V the real variable

Initial data :                  a the constant

 

> a:=0.5;

> ####################################################

> # BEGINNING OF COMPUTATIONS                        #

> #      COMPUTATIONS FOR alpha(U)                   #

> alph:= (U) -> U^2*(a-(1-U^2)^2);

 

> # Derivative of alph(U) with respect to U #

> dadU:= (U) -> 2*U*(a-(1-U^2)^2+2*U^2*(1.0-U^2));

 

> solve({ Re(I*U*V+alph(U))=0, -V+I*dadU(U)=0 })  assuming V :: real;                                        

> solve({ Re(I*U*V+alph(U))=0, I*V+dadU(U)=0 })  assuming V :: real;

 

 

 

 

 

 

 

 

 

 

 

 

 

Could you please answer the following questions:

  1. pre-last and last operators (of the above program code) describe, respectively,  absolutely the same second equation from the system (1) written in a different manner, i.e.:

-V+I*dadU(U)=0 gives -V+id α(U)/dU = 0 ,               (3)

and

I*V+dadU(U)=0 gives iV+d α(U)/dU = 0.                     (4)

 

Obviously, from the algebraic view point, Eqs. (3) and (4) are equivalent to the second equation from the system (1). But not for the MAPLE: I have got different roots in solution of this system of equations.

 

  1. We define above V as the real variable but the obtained solution for V looks like imaginary ...
  2. After finding values for V and U, I need to calculate the following value Kf=Im(iUV+ α(U))/V using the ontained values for V and U. How, one could do this using MAPLE?

 

Thanking in advance.

 

Best regards,

Willie

 

 

 

 

epostma's picture

Hi Willie, Sorry for the

Hi Willie,

Sorry for the delay in my reply. I only just saw your message.

It turns out that my initial advice was actually not the best. The situation where some of the variables represent real quantities and some are complex is actually not very common, and the way to solve this in Maple is not very straightforward (although it is quite possible).

The best approach is to split U, the complex variable, into UR + I * UI, where UR and UI are real numbers representing the real and imaginary parts of U. Then we can transform the problem into one that has only real variables, and solve that using the routines for real solving. This would work as follows; I'm including your problem definition as well:

> a := 0.5;

> alph := U -> U^2*(a-(1-U^2)^2);

> dadU := D(alph); # Let Maple do the work of determining the derivative! :)

> equations := {Re(I*U*V + alph(U)) = 0, -V+I*dadU(U)=0};

> equations := eval(equations, U = UR + I * UI); # Split U into real and imaginary parts

> equations := map(Re, eqns) union map(Im, eqns); # Equate real and imaginary parts of right- and lefthand sides

> equations := evalc(equations); # Simplify the equations assuming that all occurring *variables* are real (which they are, now)

> solutions := {RealDomain[solve](equations)}; # Use Maple's real domain solver explicitly. (Note there is a double root at the origin.)

> solutions := map2(s -> {U = eval(UR + I*UI, s), V = eval(V, s)}, solutions); # 'Reassemble' the complex value for U

> KfValues := map(s -> eval(Im(I*U*V + alph(U))/V, s), solutions);

You also asked three specific questions in your last email. I think the answer to the first two lies in this being an artifact of Maple's solve command not using the assumptions placed on variables in an optimal way, and not really having an automatic solution for the case where some variables are complex and others are real. I added the answer to the second one to the program listing above.

One more note. I saw that you chose to use floating point numbers in some places; one for a := 0.5 and one in the definition of dadU. That means that you get floating point answers. I already removed the one in dadU; if you replace the definition of a by a := 1/2, you will get exact answers. I wouldn't recommend it for this problem, though; the answers are very long (on the order of a page or so).

I hope this helps! I'll check here again in the next couple of days to see if you have any more questions.

 

Erik Postma
Maplesoft

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}