Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Part of complex plot disappears [mathematica]

  1. Apr 19, 2017 #1
    I have a very large expression:

    Code (Text):

        j - Sqrt[q^2 + qp^2 -
           2 q qp Cos[\[Theta]]] - \[Sqrt](qp^2 +
             1/2 (16 m5^2 + ma^2 + mp^2 -
                Sqrt[(-(16 m5^2) - ma^2 - mp^2)^2 -
                 4 (ma^2 mp^2 - 16 m5^2 qp^2)])) == 0
     

    where
    Code (Text):

        \[Theta] = Pi/6; ma = 980; mp = 139;
         j = \[Sqrt](q^2 +
            1/2 (16 m5^2 + ma^2 + mp^2 +
               Sqrt[(-(16 m5^2) - ma^2 - mp^2)^2 -
                4 (ma^2 mp^2 - 16 m5^2 q^2)]))
     
    And qp, m5, q is real and positive.


    There is two method to solve it, but they give some different result.
    Namely, let's look at both methods

    First solution

    Code (Text):

        eqn = j -
            Sqrt[q^2 + qp^2 -
              2 q qp Cos[\[Theta]]] - \[Sqrt](qp^2 +
               1/2 (16 m5^2 + ma^2 + mp^2 -
                  Sqrt[(-(16 m5^2) - ma^2 - mp^2)^2 -
                    4 (ma^2 mp^2 - 16 m5^2 qp^2)])) == 0;
        With[{gensol = Solve[eqn , qp]},
          Block[{\[Theta] = Pi/6, ma = 980, mp = 139,
            j},(*subs vals when gensol is evaluated*)
           j = \[Sqrt](q^2 +
               1/2 (16 m5^2 + ma^2 + mp^2 +
                  Sqrt[(-(16 m5^2) - ma^2 - mp^2)^2 -
                    4 (ma^2 mp^2 - 16 m5^2 q^2)]));
           sols = gensol]];
        qpC13 = Compile[{{q, _Complex}, {m5, _Complex}},
           Evaluate[qp /. sols[[3]]],
           RuntimeOptions -> "EvaluateSymbolically" -> False] ;
           Plot3D[Re@qpC13[q, m5], {q, 0, 10000}, {m5, 0, 2000},
         AxesLabel -> Automatic]
     

    1.jpg

    Second solution


    Code (Text):

        eqn = j -
            Sqrt[q^2 + qp^2 -
              q qp Cos[\[Theta]]] - \[Sqrt](qp^2 +
               1/2 (16 m5^2 + ma^2 + mp^2 -
                  Sqrt[(-(16 m5^2) - ma^2 - mp^2)^2 -
                    4 (ma^2 mp^2 - 16 m5^2 qp^2)])) == 0;
     
        With[{gensol = Solve[eqn, qp]},
          Block[{\[Theta] = Pi/6, ma = 980, mp = 139, j},
           j = \[Sqrt](q^2 +
               1/2 (16 m5^2 + ma^2 + mp^2 +
                  Sqrt[(-(16 m5^2) - ma^2 - mp^2)^2 -
                    4 (ma^2 mp^2 - 16 m5^2 q^2)]));
           sols = gensol]];
        opt = Experimental`OptimizeExpression[qp /. sols[[3]]];
        Block[{\[Theta] = Pi/6, f},
         f[q0_, m50_] :=
          Block[{q = SetPrecision[q0, 40], m5 = SetPrecision[m50, 40], qp},
           qp = First@opt;
           Re@qp /; Im@qp == 0];
         Plot3D[f[q, m5], {q, 0, 10000}, {m5, 0, 1000}, MaxRecursion -> 3,
          AxesLabel -> Automatic]]
     

    2.jpg


    The part of plot disappears in second solution! Why is this happening?
     
    Last edited: Apr 19, 2017
  2. jcsd
  3. Apr 24, 2017 #2
    Thanks for the thread! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post? The more details the better.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Part of complex plot disappears [mathematica]
  1. Mathematica plot (Replies: 1)

  2. Plot in mathematica (Replies: 2)

Loading...