0
$\begingroup$

I have the following code which produces a plot of the variables m vs U, from U=2.24 to U=10. First it defines a hexagonal region over which an integration is carried out, and then it finds the values of m which satisfy a particular equation (for a range of values of U):

f1[x_] = 2 Pi/Sqrt[3]/(-2 Pi/3 - (-4 Pi/3)) (x + 4 Pi/3)

f2[x_] = -2 Pi/Sqrt[3]/(-2 Pi/3 - (-4 Pi/3)) (x + 4 Pi/3)

f3[x_] = 2 Pi/Sqrt[3]

f4[x_] = -2 Pi/Sqrt[3]

f5[x_] = -2 Pi/Sqrt[3]/(-2 Pi/3 - (-4 Pi/3)) (x - 4 Pi/3)

f6[x_] = 2 Pi/Sqrt[3]/(-2 Pi/3 - (-4 Pi/3)) (x - 4 Pi/3)

func1[x_] = 
 Piecewise[{{f1[x], -4 Pi/3 <= x <= -2 Pi/3}, {f3[x], -2 Pi/3 < x < 
     2 Pi/3}, {f5[x], 2 Pi/3 <= x <= 4 Pi/3}}, 0]

func2[x_] = 
 Piecewise[{{f2[x], -4 Pi/3 <= x <= -2 Pi/3}, {f4[x], -2 Pi/3 < x < 
     2 Pi/3}, {f6[x], 2 Pi/3 <= x <= 4 Pi/3}}, 0]

Plot[{func1[x], func2[x]}, {x, -5, 5}, Epilog -> Point[Identity @@ R]]

A = Sqrt[3]/(16 Pi^2)

f[x_, y_] = (Cos[y/Sqrt[3]] + 2 Cos[x/2] Cos[y/(2 Sqrt[3])])^2

g[x_, y_] = 
 3 + 2 Cos[Sqrt[3]/2 y + x/2] + 2 Cos[Sqrt[3]/2 y - x/2] + 2 Cos[x]

int[U_?NumericQ, m_?NumericQ] := 
 NIntegrate[
   1/Sqrt[U^2 (m/2)^2 + g[x, y]], {x, -4 Pi/3, 4 Pi/3}, {y, func2[x], 
    func1[x]}, MaxRecursion -> 100] // Quiet

mfr[U_] := 
 m /. FindRoot[A U int[U, m] == 1, {m, 0, 10}, MaxIterations -> 2000]

Manipulate[
 Plot[{1, A U int[U, m]}, {m, -6, 6}, PlotRange -> {0, 3}], {U, 10, 0}]

FindRoot[A U int[U, 0] == 1, {U, 0, 1}, MaxIterations -> 2000]

pl = Plot[{mfr[U]}, {U, 2.24, 10}, PlotRange -> {{0, 10}, {0, 1.1}}]

However, I now want to obtain a table of coordinates of the plotted (U,m) values, from U=2.24 to U=10, in steps of 0.1 for example. Is there a way this can be done?

$\endgroup$
3
  • 1
    $\begingroup$ You mean like Table[{U,mfr[U]},{U,2.24,10,0.1}]? $\endgroup$
    – SPPearce
    May 3, 2017 at 12:52
  • $\begingroup$ Possible duplicate of mathematica.stackexchange.com/questions/125222/… $\endgroup$
    – Alan
    May 3, 2017 at 13:25
  • $\begingroup$ Which plot you are referring to? The final one? $\endgroup$
    – zhk
    May 3, 2017 at 14:48

1 Answer 1

2
$\begingroup$

You have this command at the end of your code (removing the plot range option and take mfr[U] out of { } )...

pl = Plot[mfr[U], {U, 2.24, 10}]

Just rewrite as a Table[ ] command with spacing at steps of 0.1, and ListPlot[ ] it to verify...

tableCoords=Table[mfr[U], {U, 2.24, 10, 0.1}];
ListPlot[tableCoords]
$\endgroup$

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