1
$\begingroup$

I have the following two equations:

F=-((6 Sqrt[3]
k (1 - \[Lambda]n/Sqrt[
l^2 - 2 Sqrt[3] a^2 Cos[\[Theta]]]) Sin[\[Theta]] Sqrt[
l^2 - a^2 (2 + Sqrt[3] Cos[\[Theta]] + Sin[\[Theta]])])/(
Cos[\[Theta]] - Sqrt[3] Sin[\[Theta]]))

and

y=Sqrt[-(2 + Sqrt[3]) a^2 + l^2] - Sqrt[
l^2 - a^2 (2 + Sqrt[3] Cos[\[Theta]] + Sin[\[Theta]])]

my question is:how can I obtain a relation between F and y in order to plot F as a function of y? when a->7, l->18 and k->1

$\endgroup$
2
  • 1
    $\begingroup$ You could try ParametricPlot[{y, F}, {θ, 0, 2Pi}], but you will have to replace your variable λn with a number first. $\endgroup$
    – Carl Woll
    Commented Oct 10, 2018 at 15:36
  • $\begingroup$ You can simplify both equations by noticing that TrigFactor[Sqrt[3] Cos[\[Theta]] + Sin[\[Theta]]] == 2 Cos[\[Pi]/6 - \[Theta]]; next, you can use the second equation to solve for theta as a function of y and substitute back in the first equation. $\endgroup$ Commented Oct 10, 2018 at 16:51

3 Answers 3

1
$\begingroup$

Using ParametricPlot will allow you to plot will generate a curve using $f_x$ (in this case $F\left(\theta\right)$) and $f_y$ (in this case $y\left(\theta\right)$) which are both a function of another parameter ($\theta$).

Here we define the functions given in the original question. Because the user did not specify some of the variables, here I defined the functions such all of the variables may be entered as inputs.

F[a_,l_,k_,n_,\[Lambda]_,\[Theta]_] := ((6 Sqrt[3] k (1 - \[Lambda]* n/Sqrt[l^2 - 2 Sqrt[3] a^2 Cos[\[Theta]]]) Sin[\[Theta]] Sqrt[ l^2 - a^2 (2 + Sqrt[3] Cos[\[Theta]] + Sin[\[Theta]])])/(Cos[\[Theta]] - Sqrt[3] Sin[\[Theta]]))

y[a_, l_, k_, \[Theta]_] := Sqrt[-(2 + Sqrt[3]) a^2 + l^2] - Sqrt[l^2 - a^2 (2 + Sqrt[3] Cos[\[Theta]] + Sin[\[Theta]])]

Next using parametric plot we plot $F$ on the y-axis and $y$ on the x axis for multiple values of $n$, ranging from $n=\text{nMin}$ to $n=\text{nMax}$, with $\text{nP}$ controlling the number of desired $n$ values to plot.

plotFunction[a_, l_, k_, \[Lambda]_, nMin_, nMax_, nP_] := 
 ParametricPlot[
  Evaluate[
   Table[{
     y[a, l, k, \[Theta]],
     F[a, l, k, n, \[Lambda], \[Theta]]},
    {n, nMin, nMax, IntegerPart[(nMax - nMin)/(nP - 1)]}]],
  {\[Theta], 0, 2 \[Pi]},
  AspectRatio -> 1,
  PlotRange -> {Automatic, {-250, 250}},
  PlotTheme -> "Scientific",
  ImageSize -> If[\[Lambda] == 0, 450, 345],
  LabelStyle -> {FontFamily -> "Latex", FontSize -> 25},
  FrameLabel -> {"y(\[Theta])", 
    If[\[Lambda] == 0, "F(\[Theta])", None]},
  FrameTicks -> {Automatic, If[\[Lambda] == 0, Automatic, None]},
  PlotLegends -> 
   Placed[LineLegend[
     Table["n=" <> ToString[i], {i, nMin, nMax, 
       IntegerPart[(nMax - nMin)/(nP - 1)]}], 
     LegendLayout -> "Row"], {.5, .075}],
  PlotLabel -> "\[Lambda] = " <> ToString[\[Lambda]]]

For this example I plotted $a=7$, $l=18$, $k=1$, as requested in the original question. I plotted $4$ values of $\lambda$, $\lambda = \{0 ,15\}$, and $n=\{0,3,6\}$.

Row[Table[plotFunction[7, 18, 1, \[Lambda], 0, 6, 3], {\[Lambda], 0, 15, 5}]]

enter image description here

The user should be able to enter the desired values for $n$, and $\lambda$ into the function as desired.

$\endgroup$
0
$\begingroup$

This might be of help,

   F[\[Theta]_] := -((6 Sqrt[
   3] k (1 - \[Lambda]n/
     Sqrt[l^2 - 2 Sqrt[3] a^2 Cos[\[Theta]]]) Sin[\[Theta]] Sqrt[
   l^2 - a^2 (2 + Sqrt[3] Cos[\[Theta]] + 
       Sin[\[Theta]])])/(Cos[\[Theta]] - Sqrt[3] Sin[\[Theta]]))
   y[\[Theta]_] :=  Sqrt[-(2 + Sqrt[3]) a^2 + l^2] - Sqrt[l^2 - a^2 (2 + Sqrt[3] Cos[\[Theta]] + Sin[\[Theta]])]

you still need the value of $\lambda n$. To get the plot, you can just do

    ListPlot[Table[{y[\[Theta]], F[\[Theta]]}, {\[Theta], 0, 2 \[Pi], 0.1}]]
$\endgroup$
0
$\begingroup$

First, from your second equation, I express $\theta$ as a function of y.

 \[Theta][y_] := ArcSin[((l^2 - (Sqrt[-(2 + Sqrt[3]) a^2 + l^2] - y)^2)/a^2 - 2)/2] -Pi/3;

Then I write $f$ as a function of $y$.

f[y_] := -((6 Sqrt[
   3] k (1 - \[Lambda]n/
     Sqrt[l^2 - 2 Sqrt[3] a^2 Cos[\[Theta][y]]]) Sin[\[Theta][
    y]] Sqrt[
   l^2 - a^2 (2 + Sqrt[3] Cos[\[Theta][y]] + 
       Sin[\[Theta][y]])])/(Cos[\[Theta][y]] - 
  Sqrt[3] Sin[\[Theta][y]]))

1) $F$ should be a small letter as Capitals are reserved in mathematica.

2) Since is $\lambda n$ not given so I am taking it as 5.

a = 7; l = 18;  k = 1; \[Lambda]n = 5; 
Plot[f[y], {y, 0, 1}]

enter image description here

$\endgroup$

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