MrMarc

3158 Reputation

18 Badges

16 years, 267 days

MaplePrimes Activity


These are answers submitted by MrMarc

Thanx alec !! You are the man !  It looks like it will do the trick ! I love this Maple forum ha ha

I think the biggest problem I have is to write the if function for the sequence elements.

restart:
randomize():
coin:=rand(0..1):
coin_1:=proc(n) seq(coin(),i=1..n) end:
x_1:=seq([coin_1(10)],i=1..1);

                       [1, 1, 0, 1, 0, 0, 1, 1, 0, 0]
 

randomize():
coin:=rand(1..10):
coin_1:=proc(n) seq(coin(),i=1..n) end:
x_2:=seq([coin_1(10)],i=1..1);

                       [2, 3, 5, 2, 5, 1, 7, 8, 8, 10]
 

I want to create a third sequence x_3 that have the same value as x_1 in the previous period if x_2 in this period is larger than 6 and is random ( 0 or 1) if x_2 in this period is smaller  than 6. 

I can then change the threshold (in this case 6) to control the amount of serial correlation                     

Any suggestions?

 

thanx Doug....I will have a try.... it looks like it might do the trick. Again thanx
my reasoning is as follows: Either I do all my mathematical derivations + ploting with Maple which means that I need more flexibility to do algebraically manipulation or I just do all my derivations with a pen and paper and only use Maple as a tool to plot differential equations.... humm...
ok, thanx for your input. I still find it a little bit strange that I can not manipulate the expression more with such a high-end mathematical software such as Maple... humm
ok, thanx for your input. I still find it a little bit strange that I can not manipulate the expression more with such a high-end mathematical software such as Maple... humm
again, thanx doug, very informative !
as I said you are the man doug ! Could not have done it without your help thanx.. Varphi is the consumption per capital ratio but the important thing is the plot. So I think we can treat varphi as an independent variable as you correctly assumed. I can derive the model for you if you are interested but it is going to take 20 A4 pages (I know since I have done it, he he). I am quite satisfied with your current solution without the bifurcation diagram but for your information varphi is given by: diff(varphi(t),t)=((1/theta)*(a*z-dep-p)*(z-dep-varphi))*varphi where theta is the risk aversion parameter that determind the curvature of the utility function, z is the average product of physical capital, dep is depreciation, a=0.3. The model acctual consits of three diff equations that are visualized on three panes. Again thanx for your help... // Alex
you are the man doug! Ok, in economics you have a model called the Uzawa-Lucas Model. You have one differential equation of the form. x_:=diff(u(t),t)=(B/a-B+B*u-varphi)*u; The isocline (diff(u(t),t)/u=u(dot)/u=0) for such a diff equation is given by: varphi_:=B/a-B+B*u; If we assume that B:=1: a:=0.3: we get: x_=diff(u(t),t)=(2.33+u-varphi)*u; # diff equation varphi_=2.33+u; # Isocline What I want to do is to plot the diff equation plus the isocline plus the arrows (stability) in a plot with varphi on the y-axis and u on the x-axis. The arrows below the 45 degree isocline should be pointing to the right and the arrows above the isocline to the left. I know how to plot the isocline restart; varphi_1:=B/a-B+B*u; B:=1: a:=0.3: varphi_1; plot(varphi_1,u=0..6,color=black,thickness=2, labels=["u", "varphi"]); but what code do I use so I get the arrows in the above plot ??
again thanx for your input... maybe I have to revaluate my position.... It is just that sometimes in economics you just have one single diff and one single isocline. In such a case it would be useful to be able to plot the corresponding arrows on each side of the isocline.......anyway... thanx
ok, thanx for your input.. It works (if you remove labels in display) but it is not perfect.. however I doubt it will get any better than this. I still thinks it is strange that I can’t plot a simple phase plane(one diff) in Maple
thanks for your input but can you be more specific ! Could you please give me some code that I can try. I have tried all kinds of combinations with deplots but I still cant get the result that I want which is a phase plot with k(dot) on the y-axis and k on the x-axis as I explained previously.. for example the code restart; dif1:= diff(k(t),t) = 0.7*k^0.3-0.13*k : with(DEtools): DEplot(dif1,[k(t)],t=-4..4, k=0..15,scene=[k(t),t] ); Does not give me the result I want.. I tried to change t in scene to k(dot) but that does not work
I think I have solve it myself ! I post the code so it can be useful for someone else... restart: randomize(): coin:=rand(0..1): coin_1:=proc(n) seq(coin(),i=1..n) end: x_1:=seq([coin_1(10)],i=1..5): x_2:=[seq(numboccur(1,x_1[i]),i=1..5)]: with(Statistics): Histogram(x_2,frequencyscale=relative,discrete = true ); Change the number 5 in the above code to 1000 and you will see the convergence from a binomial and random coin toss to a normal distribution
again thanx for your imput.. The code that I use right now is: restart: coin:=rand(0..1): coin_1:=proc(n) seq(coin(),i=1..n) end: L:=[coin_1(1000)]: x_1:=remove(Testzero, map(nops, [ListTools:-Split(`=`,L, 1)])): # Sequence 0 x_2:=remove(Testzero, map(nops, [ListTools:-Split(`=`,L, 0)])): # sequence 1 x_11:=x_1*(-1): # Transform to a -1 and 1 coin toss y:=[op(x_11),op(x_2)]:# with(stats[statplots]): histogram(y,area = count, numbars = 12 ); Its not beautiful but... I will try your version to see if its better. I also found another code that can be used to illustrate the law of large numbers by changing 2500: restart; with(Statistics): data := Sample(RandomVariable(Normal(0, 1)),2500): n_1:=Histogram(data,frequencyscale=relative): with(stats):with(plots): with(stats[statplots]):n_2:=plot(statevalf[pdf,normald[0,1]],-4..4): display( {n_1,n_2} );
thanx... I have no idea what the code mean but is seem to fulfil its purpose... I just have to figure out how I am going to plot it in a histogram.. humm
First 22 23 24 Page 24 of 24