Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Help with Manipulate
Replies: 4   Last Post: Oct 19, 2013 3:49 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
emammendes@gmail.com

Posts: 143
Registered: 8/22/05
Re: Help with Manipulate
Posted: Oct 19, 2013 3:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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@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@gmail.com
> > Subject: Help with Manipulate
> > To: mathgroup@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@msn.com">tgarza10@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@gmail.com">emammendes@gmail.com</a><br>&gt; =
Subject: Help with Manipulate<br>&gt; To:<span =
class="Apple-converted-space">&nbsp;</span><a =
href="mailto:mathgroup@smc.vnet.net">mathgroup@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--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.