2
$\begingroup$

I am trying to solve a system of two equations with two unknowns. In these equations I have, a part from constants:

  • Unknown nr 1, $$D_{\perp}$$
  • Unknown nr 2, $$\omega_C$$
  • Known function of r: $$\mu(r)$$

The full system looks like:

equation1: $$ D_{||}= \frac 1 {2 \omega_0}(-\alpha-1)\sqrt{(-\omega_C+\mu(r)D_{||})^2+(\mu(r)D_{\perp})^2}+ \frac{\alpha}{2\omega_0}\sqrt{(-2\omega_0-\omega_C+\mu(r)D_{||})^2+(\mu(r)D_{\perp})^2}+ \frac{1}{2\omega_0}\sqrt{(2\omega_0-\omega_C+\mu(r)D_{||})^2+(\mu(r)D_{\perp})^2} $$ and

equation2: $$ 1= \mu(r) \frac{\alpha}{2\omega_0} \ln{\left[\frac{-2\omega_0-\omega_C+\mu(r)D_{||}+\sqrt{(-2\omega_0-\omega_C+\mu(r)D_{||})^2+(\mu(r)D_{\perp})^2}}{-\omega_C+\mu(r)D_{||}+\sqrt{(-\omega_C+\mu(r)D_{||})^2+(\mu(r)D_{\perp})^2}}\right]}+ \frac{\mu(r)}{2\omega_0} \ln{\left[\frac{2\omega_0-\omega_C+\mu(r)D_{||}+\sqrt{(2\omega_0-\omega_C+\mu(r)D_{||})^2+(\mu(r)D_{\perp})^2}} {-\omega_C+\mu(r)D_{||}+\sqrt{(-\omega_C+\mu(r)D_{||})^2+(\mu(r)D_{\perp})^2}}\right]} $$

So the solution of the system of equations will be $$D_{\perp}(r),\;\omega_C(r)$$.

What I've tried to do is simply

    Solve[{equation1, equation2},{Dorthogonal, omegaC}]

but Mathematica keeps on running forever without any output. I have also tried:

    DorthFun[r_]:=Solve[{equation1, equation2},{Dorthogonal, omegaC}][[1,1]]
    omegaCFun[r_]:=Solve[{equation1, equation2},{Dorthogonal, omegaC}][[1,2]]

and it just keeps on running... It doesn't return any errors. Just...eternal running. Forrest Gump Syndrome...

I have also tried to solve the system putting $$\mu(r)=1$$ without any change.

I have given Mathematica about 20 minutes. Should I give it more time or does this mean that Mathematica cannot solve this? Or is there something I could do differently?

Thank you for your help!

My code looks like this:

    NSolve[{
    Dparallel==1/(2 omega0) Sqrt[(-omegaC + Dparallel)^2 + (Dorth)^2] (-alpha-1)+alpha/(2omega0)Sqrt[(-2omega0-omegaC+Dparallel)^2+(Dorth)^2]+1/(2omega0)Sqrt[(2omega0-omegaC+Dparallel)^2+(Dorth)^2],
    1 == alpha/(2omega0)Log[(-2omega0-omegaC+Dparallel+Sqrt[(-2omega0-omegaC+Dparallel)^2+(Dorth)^2])/(-omegaC+Dparallel+Sqrt[(-omegaC+Dparallel)^2+(Dorth)^2])]+1/(2omega0)Log[(2omega0-omegaC+Dparallel+Sqrt[(2omega0-omegaC+Dparallel)^2+(Dorth)^2])/(-omegaC+Dparallel+Sqrt[(-omegaC+Dparallel)^2+Sqrt[(-omegaC+Dparallel)^2+(Dorth)^2]])]
    }, {Dorth, omegaC}]
$\endgroup$
4
  • $\begingroup$ I think your problem are the "_". You can't use them as variables, those are used to define types of expressions. Check it out. Just change D_orthFun to DorthFun and D_orthogonal to Dorthogonal $\endgroup$
    – Arcotick
    Mar 9, 2014 at 19:56
  • $\begingroup$ I seem to have slipped when writing, my actual code has no underscores in the variable names. Thank you for the input though! I edited my question to include my code. I also tried NSolve as you can see but still with no end to the iterations. $\endgroup$
    – user12291
    Mar 9, 2014 at 20:05
  • $\begingroup$ What is the definition/value of omega0? $\endgroup$
    – m_goldberg
    Mar 9, 2014 at 20:46
  • $\begingroup$ omega0=0.03. Why? $\endgroup$
    – user12291
    Mar 9, 2014 at 21:11

1 Answer 1

3
$\begingroup$

I'm not sure what the correct way of showing an answer to a question I myself asked. But here is how I did anyway:

I used ContourPlot3D

Manipulate[ContourPlot[{
(*29*)
Dparallel==1/(2 omega0) Sqrt[(-omegaC + mu[r] Dparallel)^2 + (mu[r] Dorth)^2] (-alpha - 1) + 
  alpha/(2 omega0) Sqrt[(-2 omega0 - omegaC + mu[r] Dparallel)^2 + (mu[r] Dorth)^2] +
  1/(2 omega0) Sqrt[(2 omega0 - omegaC + mu[r] Dparallel)^2 + (mu[r] Dorth)^2],
(*30*)
1 == 
  alpha mu[r]/(2 omega0)*
  Log[(-2 omega0 - omegaC + mu[r] Dparallel + Sqrt[(-2 omega0 - omegaC + mu[r] Dparallel)^2 + (mu[r] Dorth)^2])/
    (-omegaC + mu[r] Dparallel + Sqrt[(-omegaC + mu[r] Dparallel)^2 + (mu[r] Dorth)^2])] +
  mu[r]/(2 omega0)*
  Log[(2 omega0 - omegaC + mu[r] Dparallel + Sqrt[(2 omega0 - omegaC + mu[r] Dparallel)^2 + (mu[r] Dorth)^2])/
    (-omegaC + mu[r] Dparallel + Sqrt[(-omegaC + mu[r] Dparallel)^2 + Sqrt[(-omegaC + mu[r] Dparallel)^2 + (mu[r] Dorth)^2]])]
}, {Dorth, -5, 5}, {omegaC, -5, 5}], {r, 0, 150}]

Where the solution to the system of equations would be where the surfaces intersect.

Unfortunately mine do not intersect... But now I know where to start!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.