wolfram-mathematicamathematica-8

Using conditions to find imaginary and real part


I have used Solve to find the solution of an equation in Mathematica (The reason I am posting here is that no one could answer my question in mathematica stack.)The solution is called s and it is a function of two variables called v and ro. I want to find imaginary and real part of s and I want to use the information that v and ro are real and they are in the below interval:

$ 0.02 < ro < 1 , 40

The code I used is as below:

ClearAll["Global`*"]
d = 1; l = 100; k = 0.001; kk = 0.001;ke = 0.0014;dd = 0.5 ; dr = 0.06; dc = 1000; p = Sqrt[8 (ro l /2 - 1)]/l^2;

m = (4 dr + ke^2 (d + dd)/2) (-k^2 + kk^2) (1 - l ro/2) (d - dd)/4 - 
I v p k l (4 dr + ke^2 (d + dd)/2)/4 - v^2 ke^2/4 + I v k dr l p/4;
xr = 0.06/n; 
tr = d/n;

dp = (x (v I kk/2 (4 dr + ke^2 (d + dd)/2) - I v kk ke^2 (d - dd)/8 - dr l p k kk (d - dd)/4) + y ((xr I kk (ro - 1/l) (4 dr + ke^2 (d + dd)/2)) - I v kk tr ke^2 (1/l - ro/2) + I dr xr 4 kk (1/l - ro/2)))/m;
a = -I v k dp/4 - I xr y kk p/2 + l ke^2 dp p (d + dd)/8 + (-d + dd)/4 k kk x + dr l p dp;
aa = -v I kk dp/4 + xr I y k p/2 - tr y ke^2 (1/l - ro/2) - (d - dd) x kk^2/4 + ke^2 x (d - dd)/8;
ca = CoefficientArrays[{x (s + ke^2 (d + dd)/2) + 
  dp (v I kk - l (d - dd) k p kk/2) + y (tr ro ke^2) - (d - 
     dd) ((-kk^2 + k^2) aa - 2 k kk a)/(4 dr + ke^2 (d + dd)/2) == 0, y (s + dc ke^2) + n x == 0}, {x, y}];
mat = Normal[ca];
matt = Last@mat;
sha = Solve[Det[matt] == 0, s];
shaa = Assuming[v < 100 && v > 40 && ro < 1 && ro > 0.03,Simplify[%]];
reals = Re[shaa];
ims = Im[shaa];
Solve[reals == 0, ro]

but it gives no answer. Could anyone help? I really appreciate any solution to this problem.


Solution

  • I run your code down to this point

    mat = Normal[ca]
    

    and look at the result.

    There are lots of very tiny floating point coefficients, so small that I suspect most of them are just floating point noise now. Mathematica thinks 0.1 is only known to 1 significant digit of precision and your mat result is perhaps nothing more than zero correct digits now.

    I continue down to this point

    sha = Solve[Det[matt] == 0, s]
    

    If you look at the value of sha you will see it is s->stuff and I don't think that is at all what you think it is. Mathematica returns "rules" from Solve, not just expressions.

    If I change that line to

    sha = s/.Solve[Det[matt] == 0, s]
    

    then I am guessing that is closer to what you are imagining you want.

    I continue to

    shaa = Assuming[40<v<100 && .03<ro<1, Simplify[sha]];
    reals = Re[shaa]
    

    And I instead use, because you are assuming v and ro to be Real and because ComplexExpand has often been very helpful in getting Re to provide desired results,

    reals=Re[ComplexExpand[shaa]]
    

    and I click on Show ALL to see the full expanded value of that. That is about 32 large screens full of your expression.

    In that are hundreds of

    Arg[-1. + 50. ro]
    

    and if I understand your intention I believe all those simplify to 0. If that is correct then

    reals=reals/.Arg[-1. + 50. ro]->0
    

    reduces the size of reals down to about 20 large screen fulls.

    But there are still hundreds of examples of Sqrt[(-1.+50. ro)^2] and ((-1.+50. ro)^2)^(1/4) making up your reals. Unfortunately I'm expecting your enormous expression is too large and will take too long for Simplify with assumptions to be able to be practically effective.

    Perhaps additional replacements to coax it into dramatically simplifying your reals without making any mistakes about Real versus Complex, but you have to be extremely careful with such things because it is very common for users to make mistakes when dealing with complex numbers and roots and powers and functions and end up with an incorrect result, might get your problem down to the point where it might be feasible for

    Solve[reals == 0, ro]
    

    to give you a meaningful answer.

    This should give you some ideas of what you need to think carefully about and work on.