acer

33193 Reputation

29 Badges

20 years, 225 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

I should qualify my off-the-cuff answer. Programming simple things in a rich language like maple is often straightforward. But in this case, if one is not careful enough, then the program might simulate the "wrong" game, leading to the wrong conclusion about switching. Someone might post such a program, but you'll have to give them a little while to write it. Note that your original statement of the game is not precise, or usual, and may represent a "wrong" game here. It is usually stated more somethign like this: The player gets to pick any of the three doors. Monty then shows him behind one of the remaining doors, and that door will not have the prize. The player then has the choice to stick with the first choice, or to switch to the other unopened door. I remember back in grad school, that one or two colleagues were obsessed with this game. A lot of the dispute centered on the exact description. Not so long ago I saw it come up in practice, I believe. It was in one of Zia's newspaper columns on Bridge. South had to make some choices (finesses, say). The good play was to choose one path of three, then put the opponent on play in such a way that he was forced to disclose one of the others. The idea was then that the odds were better to then switch to the other plan. acer
In Maple 11.00, this worked for me, textplot([0.6,0.8,typeset(`#msubsup(mi("p"),mi("gt"),mo("*"))`)]); Now, you might well ask how one produces such a beast as `#msubsup(mi("p"),mi("gt"),mo("*"))` in the first place. I used the Layout palette, and was in 2D Maple notation mode (in a Worksheet, but it probably works in a Document too). I selected the first entry in that palette, which looks like A raised to the b. For A, I entered, p_gt , and then I hit tab to get to fill in the b. For b, I entered, \* . Then I hit return. That gave me the nice looking 2D input object. But I found that I could not enter that, by simply copy 'n pasting the 2D object, in the typeset() call within textplot. So instead I selected all of that nice looking 2D object, and used the 2-D Math -> Convert To -> Atomic Identifier choice in its context-menu. Once having toggled it as an atomic name, I cut and pasted it into another blank line. I then used the context-menu on that, to convert it to 1-D maple notation input. That is to say, 2-D Math -> Convert To -> 1-D Math Input was the context-menu choice. The result was that funny piece of MathML-wannabe. Hope that helps some. acer
Here's how I see what you've tried. You want to solve the position of the rocket, {X3,Y3,Z3}, out to 1 year's worth of 1-seconds (ie. problem is scaled so that independent variable t is in seconds). The derivatives of the rocket's motion/position w.r.t will depend on the position of the two planets, {X,Y,Z} and {X1,Y1,Z1}. Instead of building one large differential system to encapsulate all three objects (where only "influence" is of two upon the third) you instead solve each of the two planets' positions separately, using listprocedure output. Then you embed those resulting on-the-fly calls (to solve the planets' positions) into the differential equations for the rocket's motion/position. Doesn't that force maple to do more work than if the three systems were rolled up together? You're using dsolve/numeric method=lsode throughout, a hard working (if somewhat antiquated) stiff solver. Is that the best idea here? (You may want routines for dX/dt, dX1/dt, etc, depending on how you go here.) acer
Perhaps it was 16*x = y^2+4*z^2 that was meant instead? acer
Vo/Vs isn't (technically) a subexpression of the original equation. But you can substitute for something like it, then isolate, and then substitute back again. eval(normal(isolate(eval(Vs/R1=(Vs-Vo)/R2,Vo=Z*Vs),Z)),Z=Vo/Vs); acer
eq1 := x^2+y^2+z^2=1: eq2 := z=y: # Now substitute eq2 into eq1. neweq := eval(eq1,{eq2}); # You want a parametrization that has x=cos(t). # But that forces what y (and z) must be. You can # ask maple to solve for the y, after the # substitution of x=cos(t). eq_subsforx := eval(neweq,x=cos(t)); solve(eq_subsforx,y); # Check, by substitution. eval(neweq,{x=cos(t),y=sin(t)*sqrt(2)/2}); eval(eq1,{x=cos(t),y=sin(t)*sqrt(2)/2,z=sin(t)/sqrt(2)}); # Plots are another way to examine the results. p1 := plots[implicitplot3d](eq1,x=-1..1,y=-1..1,z=-1..1,style=surface): p2 := plots[implicitplot3d](eq2,x=-1..1,y=-1..1,z=-1..1,style=surface): p3 := plots[intersectplot](eq1,eq2,x=-1..1,y=-1..1,z=-1..1): plots[display]([p1,p2,p3],axes=boxed); plots[spacecurve]([cos(t),sin(t)*sqrt(2)/2,sin(t)/sqrt(2),t=-0..2*Pi],axes=boxed); acer
The copy() command should produce a copy of an Array along with the indexing function. Eg, simply, B := copy(A); That should work for Array, Matrix, or Vector. It should also reproduce 'storage' and 'order'. The only thing that it does not reproduce, I believe, is the attribute readonly (which makes sense, to me, as I can't see why one would ever want two identical readonly objects). acer
Did you mean to write, Maximize(Payoff(Q, sval, pval, paval)) instead of, Maximize(Payoff(Q, s*val, pval, paval)) Also, why go to the expense of defining procedure Payoff each time that Qopt2 is called? Actually, why use a procedure for the payoff altogether, instead of an expression? I'm thinking that you could do it something more like this, Payoff := proc(Q, s, p, pa) 1 - 1/24*s^3 - 1/2*s*min(1, Q + 1/2*s)^2 + 1/4*s^2*min(1, Q + 1/2*s) - 1/3*min(1, Q + 1/2*pa)^3 + 1/3*min(1, Q + 1/2*s)^3 + Q*min(1, Q + 1/2*pa)^2 - Q*min(1, Q + 1/2*s)^2 - Q^2*min(1, Q + 1/2*pa) + Q^2*min(1, Q + 1/2*s) + s*Q*min(1, Q + 1/2*s) - 1/2*pa + 1/2*pa*min(1, Q + 1/2*pa)^2 + 1/4*pa^2 - 1/4*pa^2*min(1, Q + 1/2*pa) - s*Q + pa*Q - pa*Q*min(1, Q + 1/2*pa) - p*Q; end proc: Payoffeq:=Payoff(Q, s, p, pa); Qopt2 := proc(sval, pval, paval) local eq, result; global Payoffeq; if not type({args},'set'(numeric)) then return 'procname'('args'); end if; eq := subs({s=sval,p=pval,pa=paval},Payoffeq); result := Optimization:-Maximize(eq,Q=0..1); if type(result,'list'({numeric,list})) then return result[1]; else return 'procname'(args); end if; end proc: Qopt2(.2, 0.1e-1, 1); plot('Qopt2'(s, 0.1e-1, 1),s=0.1..0.5); You'd want to check that I didn't make any mistakes above, that the fornulae match, and that the results make sense, etc. The results I get differ from yours, even when using Q_opt() on just single points and not plotting it. So, let's look at what the Payoff looks like for a particular set of the parameters. plot(subs({s=0.2,p=0.1e-1,pa=1},Payoffeq),Q=0..2); For those values, I see a maximum at just over 0.9. And that seems to agree with the procedures I've shown here, and not with Q_opt(.2, 0.1e-1, 1) which returned 0.7911 for me. acer
Consider the slightly different call, plot([Q_opt(0.1,0.01,0.5),Q_opt(0.2,0.01,0.5),Q_opt(0.3,0.01,0.5),Q_opt(0.4,0.01,0.5)],s=0..0.5,legend=["Actual value s=0.1","Actual value s=0.2","Actual value s=0.3","Actual value s=0.4"]); Does it come out the same? acer
Rewrite both fractions with a denominator of 18*19. 1/19 = (1/19)*1 = (1/19)*(18/18) = (1*18)/(19*18) -5/18 = (-5/18)*1 = (-5/18)*(19/19) = (-5*19)/(18*19) ( 1*18 -5*19 )/(18*19) acer
You can get input such as the greek letters to be typeset in 2D by using the command completion facility. This facility allows you to get a name completed by maple. In Linux, command completion is accomplished by simultaneously pressing Ctrl-Shift-Spacebar. For example, if I am in 2D Math input mode, and I type, alph then the partial input word underway (alph) will complete to the nice 2D typset greek letter alpha. It also seems to work just when the word's last letter has already been immediately entered by me (ie. when the font changes from italic to normal). acer
All those 80 x[i] are strings, not numbers. So sum() can't add them up. Try putting a parse() around the x[i_4]'s and x{i_5]'s, or use fscanf to read floats instead. There should be several ways to do it. Also, you might help yourself if you use add() instead of sum() for simply adding up sums. (I suppose it may have come out of a palette.) And for this sort of work, and for learning programming in the Maple language, you might try 1D Maple input instead of 2D Math input, and Worksheet instead of Document. acer
The help-page ?separator may provide some explanation. acer
See the help-page ?Task,EquationOfLineBetweenTwo2DPoints Or, run the command, Student[Precalculus][LineTutor](); acer
How many times do we have to see submitters' getting caught up with the less-than symbol, before the mapleprimes maintainers switch the default Input format to plaintext? Most submitters are not using marked-up input. It's the new submitters who pay most here. The old hands would know better, if by default they had to toggle on Filtered HTML as the Input format. acer
First 335 336 337 338 339 340 341 Last Page 337 of 345