How do we get the imaginary part?

  • MHB
  • Thread starter evinda
  • Start date
  • Tags
    Imaginary
In summary, evinda found that WolframAlpha incorrectly calculates the imaginary part of a complex function when treated as a real function. However, if we do not treat functions as complex, my result is correct.
  • #1
evinda
Gold Member
MHB
3,836
0
Hello! (Wave)

We have this: $y''+y=\frac{1}{\cos x} , y'(0)=0, y(\pi)=0$.

Using the Green function I got that $y(x)= x \sin x+ \cos x( -\ln |\cos \pi|+ \ln |\cos x|)=x \sin x+ \cos x (\ln |\cos x|)$.

But according to Wolfram: y'''''''+'y'='1'/'cosx , y''''('0')''='0, y'('pi')''='0 - Wolfram|AlphaHow do we get the imaginary part?
 
Physics news on Phys.org
  • #2
evinda said:
Hello! (Wave)

We have this: $y''+y=\frac{1}{\cos x} , y'(0)=0, y(\pi)=0$.

Using the Green function I got that $y(x)= x \sin x+ \cos x( -\ln |\cos \pi|+ \ln |\cos x|)=x \sin x+ \cos x (\ln |\cos x|)$.

But according to Wolfram: y'''''''+'y'='1'/'cosx , y''''('0')''='0, y'('pi')''='0 - Wolfram|Alpha

How do we get the imaginary part?

Hey evinda! (Smile)

Wolfram always treats functions as complex functions.
That has in particular impact on the natural logarithm.

Consider that if we're talking about real functions that we actually have:
$$
\int \frac{dx}{x} = \begin{cases}\ln(x) + C_1&\text{if }x>0 \\ \ln(-x) + C_2&\text{if }x<0\end{cases}
$$
That's because the domain is split into 2 disconnected intervals for which we have independent integration constants.
This is usually written as:
$$\int \frac{dx}{x} = \ln|x| + C$$
with the understanding that the integration constant $C$ can be different on each part of the domain. (Nerd)

However, with complex functions there is no such distinction - all of the domain is connected with only an undefined point at $z=0$. That is:
$$
\int \frac{dz}{z} = \ln z + C
$$
Furthermore, $\ln z$ is a so called multivalued function that behaves a bit different than a normal function.
That is, we can't just take the natural logarithm of a complex number. (Sweating)So instead of:
$$
-\ln|\cos\pi| + \ln|\cos x|
$$
we really have something like:
$$
-\ln(\cos\pi) + \ln(\cos x) = \ln\frac{\cos x}{\cos\pi} = \ln(-\cos x)
$$

Now let's define $z = \ln(-\cos x)$, so that we have $e^z = -\cos x$.
Since we're talking about complex numbers, we can write this as:
$$e^{z+2\pi ik} = -\cos x
\quad\Rightarrow\quad e^{z+i\pi+2\pi ik} = \cos x
\quad\Rightarrow\quad z+i\pi+2\pi ik = \ln(\cos x)
\quad\Rightarrow\quad z = \ln(\cos x)-i\pi-2\pi ik
$$
(Whew)
 
  • #3
I like Serena said:
Hey evinda! (Smile)

Wolfram always treats functions as complex functions.
That has in particular impact on the natural logarithm.

Consider that if we're talking about real functions that we actually have:
$$
\int \frac{dx}{x} = \begin{cases}\ln(x) + C_1&\text{if }x>0 \\ \ln(-x) + C_2&\text{if }x<0\end{cases}
$$
That's because the domain is split into 2 disconnected intervals for which we have independent integration constants.
This is usually written as:
$$\int \frac{dx}{x} = \ln|x| + C$$
with the understanding that the integration constant $C$ can be different on each part of the domain. (Nerd)

However, with complex functions there is no such distinction - all of the domain is connected with only an undefined point at $z=0$. That is:
$$
\int \frac{dz}{z} = \ln z + C
$$
Furthermore, $\ln z$ is a so called multivalued function that behaves a bit different than a normal function.
That is, we can't just take the natural logarithm of a complex number. (Sweating)So instead of:
$$
-\ln|\cos\pi| + \ln|\cos x|
$$
we really have something like:
$$
-\ln(\cos\pi) + \ln(\cos x) = \ln\frac{\cos x}{\cos\pi} = \ln(-\cos x)
$$

Now let's define $z = \ln(-\cos x)$, so that we have $e^z = -\cos x$.
Since we're talking about complex numbers, we can write this as:
$$e^{z+2\pi ik} = -\cos x
\quad\Rightarrow\quad e^{z+i\pi+2\pi ik} = \cos x
\quad\Rightarrow\quad z+i\pi+2\pi ik = \ln(\cos x)
\quad\Rightarrow\quad z = \ln(\cos x)-i\pi-2\pi ik
$$
Note that Wolfram's answer is actually incomplete, since it leaves out the $2\pi i k$. (Whew)

I see... (Yes)

But if we do not treat functions as complex functions, my result is correct, right?
 
  • #4
evinda said:
I see... (Yes)

But if we do not treat functions as complex functions, my result is correct, right?

Yes.
We can verify (and we should) by filling it in in the original equation, and by also checking the boundary conditions. (Nerd)
 
  • #5
I like Serena said:
Yes.
We can verify (and we should) by filling it in in the original equation, and by also checking the boundary conditions. (Nerd)

Ok... Thank you! (Smile)
 

Related to How do we get the imaginary part?

1. How do we determine the imaginary part of a complex number?

The imaginary part of a complex number is the coefficient of the imaginary unit, i, in the number's representation in the form of a+bi, where a is the real part and b is the imaginary part.

2. Can the imaginary part of a complex number be negative?

Yes, the imaginary part of a complex number can be negative. This simply means that the coefficient of the imaginary unit, i, is a negative number in the number's representation in the form of a+bi.

3. How do we add or subtract complex numbers with imaginary parts?

To add or subtract complex numbers with imaginary parts, we simply combine the real parts and the imaginary parts separately. For example, (3+5i) + (2+4i) = (3+2) + (5+4)i = 5+9i.

4. How do we multiply complex numbers with imaginary parts?

To multiply complex numbers with imaginary parts, we use the distributive property and remember that i^2 = -1. For example, (3+5i)(2+4i) = 3(2+4i) + 5i(2+4i) = 6+12i+10i+20i^2 = 6+22i-20 = -14+22i.

5. Can the imaginary part of a complex number be a decimal or fraction?

Yes, the imaginary part of a complex number can be a decimal or fraction. This simply means that the coefficient of the imaginary unit, i, is a decimal or fraction in the number's representation in the form of a+bi.

Similar threads

  • Differential Equations
Replies
11
Views
2K
  • Differential Equations
Replies
2
Views
1K
  • Differential Equations
Replies
5
Views
1K
  • Differential Equations
2
Replies
52
Views
1K
  • Differential Equations
Replies
7
Views
503
  • Differential Equations
Replies
3
Views
1K
  • Differential Equations
Replies
2
Views
2K
  • Differential Equations
Replies
16
Views
1K
Replies
4
Views
1K
  • Differential Equations
Replies
4
Views
754
Back
Top