Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have the following equation: \begin{equation} (y-1)^{b1} - C~~ y~~ \exp(a x)=0 \end{equation}

where $a, b$ are real constants, $C$ may be a complex number. I need to find the real solution of the above equation for each choice of $x$, with $x \in [-100, 100]$.
I tried with $\mathbf{fzero, fsolve}$ in Matlab. But it does not work. I also tried to solve with the Newton - Raphson method. The outcome is negative.

Is it possible to solve it in any other way. Any help/suggestion/advice, will be very useful. I tried with the below given mathematica code, but it almost give up as I increase the range of $x$.

Here is my mathematica code:

k  = 0.5;   (*k is positive*)
b  = 0.01;  (*b is a positive number not greater than 1*)
a1 = bk;
b1 = 1 + b;
a2 = b1 + k;
a  = a1 / a2;
y0 = 0.5;
z  = ConstantArray[0, 11];
For[x = −5; i = 1,
    x < 6,
    x = x++; i++,
 t = Solve[y0 (1 − y)^b1 − y (1 − y0)^b1 Exp[a x] == 0, y];
 z[[i]] = y /. t]

I need the real solution, not the real part of the solution. Secondly my constants are dependent on parameters $k, b$ as stated in the code. And $C = \frac{(1-y0)^{b1}}{y0}$.

Hope my question make sense in the mathematica category. Any further query / suggestions/ feedback, please let me know.

Thank you all who show concern; I require your help.

share|improve this question
    
do you realise this is a mathematica site? If so show the mathematica code you tried. In any case its not clearly posed, do you mean the real part of the complex solution, or do you expect to find a real y? I suspect the later generally does not exist. –  george2079 Jun 6 at 13:00
4  
This question appears to be off-topic because it is not about Mathematica. –  Szabolcs Jun 6 at 14:02
    
Please post real Mathematica code that can be cut and pasted, not a TeXed version. x=x++ looks like nonsense to me. It doesn't do anything. –  Sjoerd C. de Vries Jun 9 at 11:12
1  
you want FindRoot not Solve. It should work no problem for this case since C is real. Give an example with complex C if that is the real problem. Total aside, use Table not For –  george2079 Jun 9 at 11:49
    
Solve in fact works for this, however FindRoot is way faster. I'm assuming a1=b "times" k (?). In any case you can readily rearrange your equation to eliminate the complex value issue that appears with y0>1. –  george2079 Jun 9 at 15:49

2 Answers 2

up vote 0 down vote accepted

FindRoot works just fine and in fact yields a real solution in the case of a complex coefficient on the second term:

 b1 = 1.01;
 a = 0.0033;
 y0 = 3;
 x = -3;
 FindRoot[y0 (1-y)^b1 - y (1-y0)^b1 Exp[a x] == 0, {y, y0}]

{y -> 2.94367 + 9.34896*10^-17 I}

You can eliminate the numerically small complex part with 'Chop[%]`

{y -> 2.94367}

Better yet, write your equation like this so that you directly get the real solution:

 FindRoot[((y0/y) ((1-y)/(1 - y0))^b1) == Exp[a x], {y, y0}]

{y -> 2.94367}

maybe even matlab can handle that form :)

share|improve this answer
    
But it works for a single choice of $x$. I need to find the solution for values of $x$ lies in the range $[-100, 100]$. –  MathCFD Jun 10 at 10:29
    
Table[Findroot[], {x,-100, 100}] –  george2079 Jun 10 at 11:01
    
Thank you. It works. –  MathCFD Jun 10 at 14:54

As pointed out in the comments, Solve is inappropriate for this. A better solution is Reduce which allows you to program in all the additional conditions you have specified. Unfortunately, with the condition

c = (1 - y0)^(1 + b)/y0

this

Reduce[(1 \[Minus] y)^b \[Minus] (1 - y0)^(1 + b)/y0 y Exp[a x] == 0 
   && {a, b, x, y, y0} \[Element] Reals && -100 <= x <= 100,
 {x, y, y0, a, b, c}]

returns unevaluated and emits the message:

Reduce::nsmet: This system cannot be solved with the methods available to Reduce. >>

However, just specifying c gets you much further,

Reduce[(1 \[Minus] y)^b \[Minus] c y Exp[a x] == 0 
   && {a, b, x, y} \[Element] Reals && -100 <= x <= 100, 
 {x, y, a, b, c}]
(*
  (a \[Element] Reals && -100 <= x <= 100 && y == 1 && b > 0 && c == 0) 
|| ((a | b) \[Element] Reals && -100 <= x <= 100 && (y < 0 || 0 < y < 1 || y > 1) 
  && c == E^(-a x + b Log[1 - y])/y)
*)

The important thing to note is the Or (||) present in the solution as it gives you two independent solution regimes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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