Robert Israel

6577 Reputation

21 Badges

18 years, 207 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are answers submitted by Robert Israel

plot3d( d(lambda,m), lambda = max(0.1, .4723685993-.5276314007*m) .. min(.4250185054, 1/(2+m)), m = 0.1 .. 1);

Shown there are the triangular (=3-gonal), square (=4-gonal), pentagonal (=5-gonal) and hexagonal (=6-gonal) numbers.  Just 91768403 more to go!

Or you could use the formula in the next section of that Wikipedia page.  But all that gives you is 275305224 = 3 * 91768408.  Much less impressive than "the third 91768409 gonal number".

Maple can get the position of a mouse-click on a Plot component.  For example,

insert a Plot component.  Right click on it, choose Component Properties.
Note the name (typically Plot0).  Set "plot expression" to
   plot(0, x=0..1, tickmarks=[0,0])
Check "Make execute code the default manipulator".

Click on "Action when clicked" and enter (above the "end use")

if not assigned(Clicks) then Clicks:= NULL end if;
Do( Clicks = (Clicks, %Plot0(clickx)));
Do(%Plot0 = plot(0,x=0..1,tickmarks=[sort([Clicks]),0]));  

Now when you click the mouse in the Plot component, a new tickmark should appear on the x axis.  The global variable Clicks will contain an expression sequence of the x coordinates of these clicks.  You can also include code that will call an external program, using the system or ssystem command, e.g. something like

Do(system(sprintf("myprogram %0.3f", %Plot0(clickx))));

You could also use NextZero in the RootFinding package.

> f := unapply(arctan(x) - 4*x/(1+x^2),x);
   with(RootFinding):
   NextZero(f, -10);

-2.886426944

> NextZero(f, %);

0.

> NextZero(f, %);

2.886426943

> NextZero(f, %);

FAIL

It would be harder for these numerical methods to deal with arctan(x) - 4*x/(1+x^2), which has a zero of order 3 at x=0.

 

 

I don't think there's anything particularly special about 275305224.  Its prime factorization
2^3 * 3 * 109 * 105239 is not remarkable in any way.  Its only appearance in the On-Line Encyclopedia of Integer Sequences is as the number of order-5 magic squares
(http://oeis.org/A006052).
The point is that the counting of magic squares can't be done in a very regular manner (otherwise the numbers for higher orders would be known).

Sorry, I should have said, you can't use an if statement inside a seq, but you can use the `if` function.  Thus

 

> [seq(seq(seq(seq(seq(seq(seq(seq(seq(`if`(type(simplify((A1 +B1*f+C1*f^(2))+(A2 +B2*f+C2*f^(2))+(A3 +B3*f+C3*f^(2))+2* sqrt((A1 +B1*f+C1*f^(2))*(A2 +B2*f+C2*f^(2))+(A1 +B1*f+C1*f^(2))*(A3 +B3*f+C3*f^(2))+(A2 +B2*f+C2*f^(2))*(A3 +B3*f+C3*f^(2)))), polynom(integer, f))=true    and A1+B1+C1 <>0,Array([[A1,B1,C1],[A2,B2,C2],[A3,B3,C3],[ coeffs(simplify((A1 +B1*f+C1*f^(2))+(A2 +B2*f+C2*f^(2))+(A3 +B3*f+C3*f^(2))+2* sqrt((A1 +B1*f+C1*f^(2))*(A2 +B2*f+C2*f^(2))+(A1 +B1*f+C1*f^(2))*(A3 +B3*f+C3*f^(2))+(A2 +B2*f+C2*f^(2))*(A3 +B3*f+C3*f^(2)))),f)]]),NULL),
C3=C2..2),B3=B2..2),A3=A2..2),C2=C1..2),B2=B1..2),A2=A1..2),C1=0..2),
B1=0..2),A1=0..2)];

As Preben and Axel wrote, there probably do not exist closed-form solutions for this nonlinear system.  However, you might try series solutions in M.   The following is to order M^5.  You could do this to any desired order, except that the expressions for the coefficients tend to get large.

> eqns:= {seq(seq(coeftayl(eval(lhs(eqn),
 {x=add(x[i]*M^i,i=0..5), y= add(y[i]*M^i,i=0..5), z=add(z[i]*M^i,i=0..5)}),M=0,n),n=0..5),eqn=[eqn1,eqn2,eqn3])};
  Sol:= solve(eqns,{seq(x[i],i=0..5),seq(y[i],i=0..5),seq(z[i],i=0..5)});
  X5:= eval(add(x[i]*M^i, i=0..5), Sol);
  Y5:= eval(add(y[i]*M^i, i=0..5), Sol);
  Z5:= eval(add(z[i]*M^i, i=0..5), Sol);

You should contact Maplesoft Customer Support.  See http://www.maplesoft.com/support/

The best way, as Preben suggested, is to use dsolve/numeric and odeplot on the system of two differential equations.  However, if you do want to combine graphs produced by DEplot, I believe this should work: the default is to have 49 equally spaced t values.  This is not affected by whatever stepsize adjustment the numerical method uses in computing the solution. 

No, I'm saying that in the long run (with all cars identical) all permutations are equally likely, and each car is equally likely to be in any of the positions.

I don't understand how you can say "P(i,j) was the probability that the i-car overtakes the j-car during any one lap of the race".  Surely this depends on the positions of the cars.
You can't overtake a car that's already behind you, and you're unlikely to overtake a car that's many positions ahead of you.  But maybe you meant that as the probability that car number i overtakes car number j in one lap when car j is directly ahead of car i.
Actually I'd prefer to talk about the rate r[i,j] at which this occurs, which is the limit as
t -> 0+ of (1/t) * (probability that car i overtakes car j in time t when car j is directly ahead of car i).

If the cars are not all identical, a state of the system corresponds to a permutation of
the N cars.  The possible transitions are interchanges of two adjacent cars, i.e. permutation [i[1], ..., i[N]] -> [i[1]', ..., i[N]'] where for some j and k with i[k] = i[j]+1,
i[k]' = i[j], i[j]' = i[k], and i[n]' = i[n] otherwise.  The rate for this transition is r[k,j].  The
generator for the continuous-time Markov chain is then an (N!) x (N!) matrix Q with positive entries for these transitions, and diagonal elements that make the sum of the entries in each row 0.  For example, with N=3, the states being [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2] and [3,2,1], the generator is


         [-r[2, 3] - r[1, 2] , r[2, 3] , r[1, 2] , 0 , 0 , 0]
         [r[3, 2] , -r[3, 2] - r[1, 3] , 0 , r[1, 3] , 0 , 0]
         [r[2, 1] , 0 , -r[2, 1] - r[1, 3] , 0 , r[1, 3] , 0]
         [0 , r[3, 1] , 0 , -r[3, 1] - r[1, 2] , 0 , r[1, 2]]
         [0 , 0 , r[3, 1] , 0 , -r[3, 1] - r[2, 3] , r[2, 3]]
         [0 , 0 , 0 , r[2, 1] , r[3, 2] , -r[2, 1] - r[3, 2]]

Given that you start (at time t=0) in state i, the probability of being in state j at time t is the [i,j] matrix element of exp(t*Q) (this is the matrix exponential, which can be computed with MatrixExponential in the LinearAlgebra package).  The equilibrium probabilities for the states is a row vector E such that E.Q = 0 and sum(E[i],i=1..N)=1.

I don't know why in #2 you say "Maple doesnt seem to be very happy about this".  It works perfectly well.  Maple goes through your loop.  It's just that none of the if clauses turn out to be true.

For #3, you might try using a nested seq instead of loops.

seq(seq(seq(seq(..., A2 = A1 .. 2), A1 = 0 .. 2) etc.

Do you mean this?

> for n from 1 to 7 do
      P[n]:= sum((-1)^i*factorial(2*n-2*i)*x^(n-2*i)/(2^n*factorial(i)*factorial(n-i)*factorial(n-2*i)), i = 0 .. (1/2)*n)
  end do;


evalf(x,3) evaluates x with 3 significant digits, so 0.012345 becomes 0.0123 and 1234.56 becomes 1230.  Do you mean you want 3 digits after the decimal point?  That would be produced by .001*round(1000*x).  So:

latex(map(x -> .001*round(1000*x), tableau));

Am I correct in saying that the positions are integers 1 to N?   When you say P(i,j), do i and j refer to the positions of the cars or the cars themselves?  I hope it's the former: that makes modeling this much simpler, as the different cars are effectively identical.  If so, for your first question you can treat the position of car N as a continuous-time Markov chain, with transitions i -> i+1 (i.e. car N, in position i, is passed by the car behind it) and i -> i-1
(i.e. car N, in position i, passes the car ahead of it).  The rates for i -> i+1 and i+1 -> i
are the same, making this a reversible Markov chain with equilibrium probabilities 1/N for all states.

It is the same in Maple 14.

I think this is basically an example of the "specialization problem". When simplify is called on the summand 1/GAMMA(j+1)/GAMMA(2-j)*GAMMA(1+a-c+j)*GAMMA(1+a-b+j)/GAMMA(a- 1+j)*GAMMA(-2+b+c-j+n-a), the result is

  GAMMA(-2 + b + c - j + n - a) GAMMA(1 + a - b + j)

        GAMMA(1 + a - c + j) sin(Pi (j + 1))/(GAMMA(a - 1 + j) j

        (-1 + j) Pi)

which is correct "generically", and because of the sin(Pi (j+1)) is 0 for integers j, except of course for the special cases j=0 and j=1 (which happen to be the values you are summing over, but Maple doesn't notice that).   

These problems are not simple things to fix.

First 18 19 20 21 22 23 24 Last Page 20 of 138