Message Boards Message Boards

GROUPS:

Plotting graphs with manipulate: empty plots

Posted 4 months ago
775 Views
|
4 Replies
|
0 Total Likes
|

Hello Together,

I am currently working on visualizing my results with the help of Mathematica. There is mainly one Problem (I think) and that has to do with the manipulate order.

1.) What do I have to calculate? Physics apart the formulas I have to calculate look like this

Now I know that the last 3 Integrals can not be calculated by the System because they have unspecified parameters. So I calculated it one time for g=w=1 and d=0.5. I just defined the Functions:

l[x_]=ArcCos[0.9841229182759271+0.0158770817240729*Cos[x]]

(wich is o for the parameters above)

g[t_]=Sqrt[-1/8 (-1+Sqrt[1-0.5^2])(3-Cos[2 *t])]

(which is Sqrt[k] for the parameters above)

and evaluated the Integral of g with

f

Then I plotted my wanted function

Plot[x*l[x]/f[x],{x,0,10}]

image

Now the stuff I need help with:

The thing is that I would like a shortcut to the plot and the option to manipulate the parameters g, w and d afterwards. I tried the following:

But I don't get any results. I think the parameters are the problem so the system cannot solve the numerical Integral for n. I am grateful for any help.

Regards,

Henrie

4 Replies
Posted 4 months ago

Not clear what you are trying to accomplish. A Manipulate is being passed to Plot.

k[y_] := Manipulate[NIntegrate[...
Manipulate[Plot[k[x]...
Posted 4 months ago

Thank you for your answer.

I think the problem that I have lies within the computation of the Integral of n[x]:k[x]. I need k[x] to plot the Graph but there are some parameters in k[x] (g and w) that I would like to be able to manipulate because I want to look at this time evolution for as many different parameter sets as possible. But I cannot compute the general Integral k[x] without specifying g and w in advance because the NIntegrate option gives me errors for the unspecified parameters. I plotted the whole thing for the parameters {g,w,d}={1,1,1/2}) but I don't want to manually change all the parameters in all the calculations every time.

I need to plot this situation for many different Parameter sets of g,w and d so I thought about using a program where I only need to specify my 3 parameters in advance and all the steps necessary to get to the plot were taken without me having to manually change the parameters all the time. Am I right in the assumption that the Manipulate option can do this?

It does not necessarily have to be Manipulate, if there is an Option like specifying a table of sets of parameters and the plot is then made for all of them I would be happy too.

Posted 4 months ago

The controls in a Manipulate are localized. Changing the value of the controls for g, w or d updates only the references to g, w or d that explicitly appears in the first argument to Manipulate. No other updates are done.

An example that works, a Manipulate plotting your function n:

n[x_, g_, w_, d_] := Sqrt[-1/8 (-1 + Sqrt[1 - d^2]) (2 g^2 + w^2 - w^2 Cos[2 g * x])]

Manipulate[
    Plot[n[t, g, w, d], {t, 0, 10}],
    {{g, 1}, 0, 20, Appearance -> "Labeled"},
    {{w, 1}, 0, 2 Pi, Appearance -> "Labeled"},
    {{d, 0.5}, 0, 1, Appearance -> "Labeled"}
 ]
Posted 4 months ago

I somehow got it to work. I send you my code so If anyone is interested you can just look at what I did.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract