1
$\begingroup$

Quite new to Mathematica, and I have been trying to fix the code using online resources for the past few days now. I am trying to plot and minimise this equation to learn more about its properties:

(1) $t=a+b$
(2) $p=u+(1-u)(1-e^{-\lambda b})$
(3) $u = \frac{(1-e^{-\lambda a})\sigma}{(1-e^{-\lambda a})\sigma + (e^{-\lambda a})(1-\sigma)}$

$\sigma, \lambda \text{ and } p$ are constant terms and $b$ is determined uniquely by choice variable $a$ in equation (2)/(3). There are two other variables, $t$ and $a$ - I would like to explore the relationship between these.

I have tried to Plot this relationship for varying and specified levels of $\sigma, \lambda \text{ and } p$, but I get empty axes each time. This is what I have used.

t = a + b
p = u + (1 - u) (1 - E^{-λ b})
u = ((1 - 
E^{-λ a}) (σ))/((1 - 
 E^{-λ a}) (σ) + (E^{-λ a}) (1 - σ))
Manipulate[Plot[t, {a, 0, 1}], {λ, 0, 1}, {σ, 0.5, 1}, {p, 0, 1}]

Being unable to find a plot, I have also tried to minimize $t$ with respect to $k$, with $\sigma, \lambda \text{ and } p$ as constants. Essentially the minimisation problem is:

$\underset{k}\min t$ subject to $p=u+(1-u)(1-e^{-\lambda b})$ where $u = \frac{(1-e^{-\lambda a})\sigma}{(1-e^{-\lambda a})\sigma + (e^{-\lambda a})(1-\sigma)}$

I have tried different variations of this:

Assuming[a > 0 && t > 0 && b > 0 && λ > 0 && 0 < p < 1 && 0.5 < σ < 1, Minimize[{t, p == u + (1 - u) (1 - E^(-λ b))}, a]]

And I have also tried substituting the value of $u$ as per equation (3). However I am unable to output any meaningful results.

Does anyone have any ideas on how I can reformulate the plot or minimisation expressions so I can output meaningful results?

Thank you

$\endgroup$
  • $\begingroup$ First suggestions: use == (not =) in equations inside Minimize and simple () (not {}) for the exponents. $\endgroup$ – b.gates.you.know.what May 23 '18 at 11:47
  • $\begingroup$ Thank you – b.gatessucks I have included those suggestions and now I am getting an indeterminate result - definitely not something that I expected. This is what I used now: Assuming[a > 0 && t > 0 && b > 0 && \[Lambda] > 0 && 0 < p < 1 && 0.5 < \[Sigma] < 1, Minimize[{t, p == u + (1 - u) (1 - E^(-\[Lambda] b))}, a]] And this is the output {-\[Infinity], {a -> Indeterminate}} $\endgroup$ – Elke May 23 '18 at 11:59
  • $\begingroup$ You can try to solve (2) for u, substitute into (3) and solve for b; this way you will have an explicit expression to NMinimize. $\endgroup$ – b.gates.you.know.what May 23 '18 at 15:02
0
$\begingroup$

You can solve it for b, for given value of p.

       a = .1; σ = .2; λ = .2;
       p == (1 - Exp[-λ a]*σ)/(1 - 
       Exp[-λ a]*σ + 
       Exp[-λ a] (1 - σ)) + (1 - (1 - 
       Exp[-λ a]*σ)/(1 - Exp[-λ a]*σ + 
       Exp[-λ a] (1 - σ))) (1 - Exp[-λ *b])

      Solve[p == 0.506234 + 0.493766 (1 - E^(-0.2 b)), b]
      (*out put*)
      (*{{b -> -5. Log[-2.02525 (-1. + p)]}}*)
      or
      (*{{b -> -5. Log[-2.02525 (-1. + p)]}} /. Rule -> Equal*)
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Thank you for your answer. I have tried to keep $p$ a constant - perhaps it would be better the express that equation in terms of $a$? If I combine (2) and (3), then I get $p=\frac{(1-e^{-\lambda a})\sigma}{(1-e^{-\lambda a})\sigma + (e^{-\lambda a})(1-\sigma)}+(1-\frac{(1-e^{-\lambda a})\sigma}{(1-e^{-\lambda a})\sigma + (e^{-\lambda a})(1-\sigma)})(1-e^{-\lambda b})$ This leaves one degree of freedom, so when $a$ is chosen, $b$ should be pinned down. I have tried (unsuccessfully) to get Mathematica to form an expression for the above with a as the subject for my constraint $\endgroup$ – Elke May 23 '18 at 14:56
  • $\begingroup$ I have updated the answes. Is it helpful? $\endgroup$ – Gopal Verma May 23 '18 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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