4
$\begingroup$

I have the following expressions:

$$ \frac{1}{2} \Bigg [1 + \sqrt{a^2 + (b e^{-\gamma(\tau)})^2 + (c e^{-\gamma(\tau)})^2} \Bigg ]; $$

f1=1/2 (1 + Sqrt[
    a^2 + (b Exp[-γ (\[tau)])^2 + (c Exp[-γ (\[tau)])^2])

and

$$ \frac{1}{2} \Bigg [1 + a^2 + e^{-\gamma(t)}(b^2 + c^2) \Bigg ]. $$

f2=1/2 (1 + a^2 + Exp[-γ (\[tau)] (b^2 + c^2))

I have already found these expressions such that for all values of $a, b$ and $c$ such that

$$ a, b, c \in [0, 1] \quad \text{such that} \quad |a|^2 + |b|^2 + |c|^2 = 1, $$

the first expression will always yield a higher value for all times, $\tau$.

Now, I am interested in figuring out certain values of $a, b$ and $c$ meeting the aforementioned condition for which the difference between the first and the second expressions is the largest. I have tried working with some sample numbers based on qualitative reasons.

Is there a specific method to go about doing this in Mathematica. Also, the difference will be different at different times due to the exponential term, which I'll get by running a numerical integration.

I'm not quite sure how to tackle this problem in Mathematica, if there's a specific method for it.

Edit:

Note that the values of the parameters (to follow) and the expression for gamma is given by the code:

G = 0.1;
\[Omega]c = 10;
\[Beta] = 1;

integralgamma[\[Omega]_, \[Tau]_] := 
4 G \[Omega] Exp[-\[Omega]/\[Omega]c] ((1 - 
   Cos[\[Omega] \[Tau]])/\[Omega]^(2)) Coth[\[Beta] \[Omega]/2];

I would run a numerical integration over omega first and then plot the graph with respect to tau, which is the time. The domain for the time is technically $(0, \infty)$ but for almost all cases, the curves of both expressions level off when tau (time) is in the range 10-20 seconds.

P.S: The centered LaTeX-ed expressions aren't written in Mathematica code. Read them as mathematical expressions.

$\endgroup$
14
  • $\begingroup$ Can you post your code? $\endgroup$
    – Diogo
    Jul 15, 2016 at 15:18
  • $\begingroup$ @Diogo I haven't run a code to get something on this end thus far. I actually don't know how to approach the problem. $\endgroup$ Jul 15, 2016 at 15:19
  • $\begingroup$ Would anyone have any idea? $\endgroup$ Jul 15, 2016 at 15:35
  • $\begingroup$ Are you sure there are values for a,b, and c for which the entire function Abs[f2-f1](gamma,t) is greater than for any other values? $\endgroup$
    – Feyre
    Jul 15, 2016 at 15:45
  • $\begingroup$ @Feyre That's the problem which I have hinted/mentioned in the question as well. Since there's a time dependent exponential factor, the difference will be different/dynamical at each point. So I don't know if there's such a pair of values. I want to get as close as to making the difference as large as possible. The curves are well behaved for all cases; they decrease and then they eventually level off. I just don't know if there's a specific method to go about it other than playing around with such combinations of the said variables. $\endgroup$ Jul 15, 2016 at 15:55

3 Answers 3

2
$\begingroup$

Let us simplify your formulas manually first.

Let us denote $e^{-\gamma(t)}$ by e, and $a^2, b^2, c^2$ by a2, b2, c2.

Then

f1 = 1/2 (1 + Sqrt[a2 + b2 e^2 + c2 e^2]);

f2 = 1/2 (1 + a2 + e (b2 + c2));

You want to maximize f1 - f2 with the constraints $a^2+b^2+c^2=1$ and $a,b,c \in [0,1]$. From your notation, I also assume that $0 < e^{-\gamma(t)} < 1$.

result = Maximize[
  {f1 - f2, a2 + b2 + c2 == 1 && 0 < e < 1},
  {a2, b2, c2}
  ]

Refine[result, 0 < e < 1]

{(1 - 2 e + e^2)/(8 (1 + e)), 
 {a2 -> (1 + 3 e)/(4 (1 + e)), b2 -> 0, c2 -> (3 + e)/(4 (1 + e))}}

While I didn't give the constraints that $a,b,c \in [0,1]$, we can see that the result satisfies this.


If we use the method of Lagrange multipliers, and do the calculations with Mathematica, it turns out that the following is a solution for any 0 <= b2 <= 1/2:

{a2 -> (1 + 3 e)/(4 + 4 e), c2 -> (3 + e - 4 b2 (1 + e))/(4 (1 + e))}
$\endgroup$
2
  • $\begingroup$ What about the issue in $e^{- \gamma (\tau)}, \gamma(\tau)$ has to be numerically integrated first? $\endgroup$ Jul 15, 2016 at 17:06
  • $\begingroup$ @JunaidAftab I don't understand what you are asking. Perhaps you should make the question clearer, in addition to fixing the Mathematica notation. I showed how to maximize for a,b,c, treating the exponential term as a parameter. $\endgroup$
    – Szabolcs
    Jul 15, 2016 at 17:14
2
$\begingroup$

If you introduce a spherical coordinates parametrization

$a=\sin(q)$, $b=\cos(q)\cos(\phi)$, $c=\cos(q)\sin(\phi)$,

you can write your problem in much simpler terms:

f1 = 1/2 (1 + Sqrt[Sin[q]^2 + k^2 Cos[q]^2])
f2 = 1/2 (1 + Sin[q]^2 + k Cos[q]^2)

where $k=\exp(\gamma(t))$

Now for a given value of $k=\exp(\gamma(t))$ you can do the 1d numerical maximization:

NMaximize[f1 - f2 /. {k -> 1}, {q}]
(*{0., {q -> -6.96782}}*)

Notice, $f1-f2$ do not depend on $b$ and $c$ in an independent fashion. They always enter in $b^2+c^2\equiv\cos^2(q)$ combination.

Then running

n = NMaximize[(f1 - f2) /. {k -> 1}, {q}][[2]]
o = FindInstance[((Cos[q] Cos[\[Phi]])^2 + (Cos[q] Sin[\[Phi]])^2 + 
      Sin[q]^2 == 1 && 0 < Cos[q] Cos[\[Phi]] < 1 && 
    0 < Cos[q] Sin[\[Phi]] < 1) /. n, \[Phi], Reals][[1]]

{ϕ -> -83.9}

Giving us

{a, b, c} = {Sin[q], Cos[q] Cos[\[Phi]], Cos[q] Sin[\[Phi]]} /. n /. o

{0.58074, 0.491245, 0.649168}

$\endgroup$
11
  • $\begingroup$ Do you mean NMaximize[(f2 - f1) /. {k -> 1}, {q}][[2]]? But how do you get b and c from this expression, when you have no phi? $\endgroup$
    – Feyre
    Jul 15, 2016 at 17:07
  • $\begingroup$ What about $\phi$? $\endgroup$ Jul 15, 2016 at 17:09
  • $\begingroup$ @Feyre that's the point. It is irrelevant. band care not independent here. They enter in a combination $b^2+c^2=\cos^2(q)$ $\endgroup$
    – yarchik
    Jul 15, 2016 at 17:10
  • $\begingroup$ Do you agree with what I've added? $\endgroup$
    – Feyre
    Jul 15, 2016 at 17:31
  • $\begingroup$ @JunaidAftab How about now? This gives us three real values. {check the edit I'm proposing} $\endgroup$
    – Feyre
    Jul 15, 2016 at 17:33
1
$\begingroup$

For a given a, b, and t and changing gamma, we can see that the diference between the two functions stops changing for large values of gamma.

  f1[a_, b_, c_, t_] := 
     1/2 (1 + Sqrt[
         a^2 + (b Exp[-\[Gamma] (t)])^2 + (c Exp[-\[Gamma] (t)])^2])
    f2[a_, b_, c_, t_] := 1/2 (1 + a^2 + Exp[-\[Gamma] (t)] (b^2 + c^2))
    v = {10., 15., 7.}
    {a, b, c} = v/Norm[v]
    a^2 + b^2 + c^2
    Plot[{f1[a, b, c, 2.], f2[a, b, c, 2.]}, {\[Gamma], 0, 10}]
    Clear[a, b, c]

enter image description here

So assuming a big value to gamma, we obtain:

Simplify[f1[a, b, c, 1.] - f2[a, b, c, 1.]] /. \[Gamma] -> 
   100000 // Chop

-(a^2/2)

$\endgroup$
3
  • $\begingroup$ Yes, this is expected and all of my specific example show that this is the case. I'm interested in maximizing the difference in the region where the difference is changing. $\endgroup$ Jul 15, 2016 at 16:04
  • $\begingroup$ @JunaidAftab Wouldn't that be just before they stop changing? Looking at the plot above the difference seems monotonically increasing $\endgroup$
    – user129412
    Jul 15, 2016 at 16:48
  • $\begingroup$ @user129412 Yes, you're right. Sorry for the mistake. $\endgroup$ Jul 15, 2016 at 16:52

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.