Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help with Manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131863] Re: Help with Manipulate
  • From: "Eduardo M. A. M. Mendes" <emammendes at gmail.com>
  • Date: Sat, 19 Oct 2013 04:11:56 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20131018084448.7272A6A0D@smc.vnet.net> <COL126-W4600561A7754C522BE329DF070@phx.gbl>

Hello

Many many thanks.

I have not noticed that the semicolon was there.  My bad!   I should have noticed it.

As for the improvements in my code, many many thanks.

I have noticed one thing though, Mathematica hangs pretty bad on my mac when parameter is set to one.

Ed



On Oct 18, 2013, at 9:27 PM, Tomas Garza <tgarza10 at msn.com> wrote:

> First, remove the semicolon at the end of your code. This may be interfering with the displaying process.
> Second, bear in mind that the calculation takes a very long time if the values of your parameters get too large.
> Third, try to fix the PlotRange so that the plot doesn't jump all over the place as you move the controls.
> Lastly, I suggest a smoother way to compute the sum.
>
> I tried the following code and it works fine:
>
> Clear[flist];flist[par1_,par2_]:=RandomVariate[FRatioDistribution[2,2 par1],par2];
> Manipulate[
> sum=Fold[Plus,0,Table[flist[\[CurlyPhi],np],{nr}]];
> =
Histogram[sum,{Min[sum],Max[sum],1},"PDF",AspectRatio->1/3,PlotRange->{{Min[sum],Max[sum]},All},ImageSize->Large],{{\[CurlyPhi],5,"parameter"},1,50,Appearance->"Labeled"},{{np,1000,"number of data points"},1,10000,Appearance->"Labeled"},{{nr,20,"number of replications"},5,200,Appearance->"Labeled"}]
>
> -Tomas
>
>
>
> > From: emammendes at gmail.com
> > Subject: Help with Manipulate
> > To: mathgroup at smc.vnet.net
> > Date: Fri, 18 Oct 2013 04:44:48 -0400
> >
> > Hello
> >
> > Although I have been using Mathematica for a while I still consider myself a rookie. Could someone explain what I am doing wrong with the following code, please?
> >
> > Manipulate[
> > sum=RandomVariate[FRatioDistribution[2,2 \[CurlyPhi]],np];
> > Do[sum=sum+RandomVariate[FRatioDistribution[2,2 =
> > \[CurlyPhi]],np],{i,2,nr}];
> > =
Histogram[sum,{Min[sum],Max[sum],1},"PDF",AspectRatio->1/3,PlotRange-> =
{{Min[sum],Max[sum]},All},ImageSize->Large],
> > {{\[CurlyPhi],5,"parameter"},1,1000, Appearance->"Labeled"},
> > {{np,1000,"number of data points"},1,1000000, =
Appearance->"Labeled"},{{nr,20,"number of replications"},5,10000, =
Appearance->"Labeled"}];
> >
> > Nothing shows up.
> >
> > Is there a faster way to implement the summation?
> >
> > Many many thanks
> >
> > Ed
> >
> >
> >


--Apple-Mail=_6697C8C4-1F35-47F5-8B19-391526CBA827
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=iso-8859-1

<html><head><meta http-equiv="Content-Type" content="text/html =
charset=iso-8859-1"><base href="x-msg://9/"></head><body =
style="word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; ">Hello<div><br></div><div>Many =
many thanks.</div><div><br></div><div>I have not noticed that the =
semicolon was there. &nbsp;My bad! &nbsp; I should have noticed =
it.</div><div><br></div><div>As for the improvements in my code, many =
many thanks.</div><div><br></div><div>I have noticed one thing though, =
Mathematica hangs pretty bad on my mac when parameter is set to =
one.</div><div><br></div><div>Ed</div><div><br></div><div><br></div><div><=
br><div><div>On Oct 18, 2013, at 9:27 PM, Tomas Garza &lt;<a =
href="mailto:tgarza10 at msn.com">tgarza10 at msn.com</a>&gt; =
wrote:</div><br class="Apple-interchange-newline"><blockquote =
type="cite"><div class="hmmessage" style="font-size: 12pt; =
font-family: Calibri; font-style: normal; font-variant: normal; =
font-weight: normal; letter-spacing: normal; line-height: normal; =
orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: =
none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div =
dir="ltr"><font face="Verdana" size="3" style="font-size: 12pt; =
">First, remove the semicolon at the end of your code. This may be =
interfering with the displaying process.</font><div><font face="Verdana"=
 size="3" style="font-size: 12pt; ">Second, bear in mind that the =
calculation takes a very long time if the values of your parameters get =
too large.</font></div><div><font face="Verdana"><font size="3">Third,=
 try to fix the PlotRange so&nbsp;</font>that the plot doesn't jump all =
over the place as you move the controls.</font></div><div><font =
face="Verdana">Lastly, I suggest a smoother way to compute the =
sum.</font></div><div><font face="Verdana"><br></font></div><div><font =
face="Verdana">I tried the following code and it works =
fine:</font></div><div><font =
face="Verdana"><br></font></div><div><div><font =
face="Verdana">Clear[flist];flist[par1_,par2_]:=RandomVariate[FRatioDi=
stribution[2,2 par1],par2];</font></div><div><font =
face="Verdana">Manipulate[</font></div><div><font =
face="Verdana">sum=Fold[Plus,0,Table[flist[\[CurlyPhi],np],{nr}]];</fo=
nt></div><div><font =
face="Verdana">Histogram[sum,{Min[sum],Max[sum],1},"PDF",AspectRatio-&gt=
;1/3,PlotRange-&gt;{{Min[sum],Max[sum]},All},ImageSize-&gt;Large],{{\[Curl=
yPhi],5,"parameter"},1,50,Appearance-&gt;"Labeled"},{{np,1000,"number of =
data points"},1,10000,Appearance-&gt;"Labeled"},{{nr,20,"number of =
replications"},5,200,Appearance-&gt;"Labeled"}]</font></div><div><font =
face="Verdana"><br></font></div><div><font =
face="Verdana">-Tomas</font></div><div><br></div><div><br></div><br><div=
>&gt; From:<span class="Apple-converted-space">&nbsp;</span><a =
href="mailto:emammendes at gmail.com">emammendes at gmail.com</a><br>&gt; =
Subject: [mg131863] Help with Manipulate<br>&gt; To:<span =
class="Apple-converted-space">&nbsp;</span><a =
href="mailto:mathgroup at smc.vnet.net">mathgroup at smc.vnet.net</a><br>&gt; =
Date: Fri, 18 Oct 2013 04:44:48 -0400<br>&gt;<span =
class="Apple-converted-space">&nbsp;</span><br>&gt; Hello<br>&gt;<span =
class="Apple-converted-space">&nbsp;</span><br>&gt; Although I have =
been using Mathematica for a while I still consider myself a rookie. =
Could someone explain what I am doing wrong with the following code, =
please?<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt;=
 Manipulate[<br>&gt; sum=RandomVariate[FRatioDistribution[2,2 =
\[CurlyPhi]],np];<br>&gt; =
Do[sum=sum+RandomVariate[FRatioDistribution[2,2 =<br>&gt; =
\[CurlyPhi]],np],{i,2,nr}];<br>&gt; =
Histogram[sum,{Min[sum],Max[sum],1},"PDF",AspectRatio-&gt;1/3,PlotRange-&g=
t; {{Min[sum],Max[sum]},All},ImageSize-&gt;Large],<br>&gt; =
{{\[CurlyPhi],5,"parameter"},1,1000, Appearance-&gt;"Labeled"},<br>&gt; =
{{np,1000,"number of data points"},1,1000000, =
Appearance-&gt;"Labeled"},{{nr,20,"number of replications"},5,10000, =
Appearance-&gt;"Labeled"}];<br>&gt;<span =
class="Apple-converted-space">&nbsp;</span><br>&gt; Nothing shows =
up.<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; =
Is there a faster way to implement the summation?<br>&gt;<span =
class="Apple-converted-space">&nbsp;</span><br>&gt; Many many =
thanks<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt; =
Ed<br>&gt;<span class="Apple-converted-space">&nbsp;</span><br>&gt;<span=
 =
class="Apple-converted-space">&nbsp;</span><br>&gt;</div></div></div></d=
iv></blockquote></div><br></div></body></html>=

--Apple-Mail=_6697C8C4-1F35-47F5-8B19-391526CBA827--



  • Prev by Date: Re: Extract columns based on their the title in
  • Next by Date: Re: Finding branches where general solution is possible
  • Previous by thread: Re: Help with Manipulate
  • Next by thread: A law of small sines?