Robert Israel

6577 Reputation

21 Badges

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

MaplePrimes Activity


These are replies submitted by Robert Israel

Do you mean this?
> op(indets(inert, specfunc(anything,_Inert_SET)));
For a polynomial with real coefficients, such as x^3+1, the Newton iteration maps reals to reals (and infinity). Thus real numbers can't be in the basin of attraction of non-real roots. You'll notice that in Figure 2 of the paper you referred to, the real axis (which goes horizontally through the figure, halfway up) only intersects the red region (the basin of attraction of the real root -1) plus a couple of black areas where convergence hadn't occurred yet.
For a polynomial with real coefficients, such as x^3+1, the Newton iteration maps reals to reals (and infinity). Thus real numbers can't be in the basin of attraction of non-real roots. You'll notice that in Figure 2 of the paper you referred to, the real axis (which goes horizontally through the figure, halfway up) only intersects the red region (the basin of attraction of the real root -1) plus a couple of black areas where convergence hadn't occurred yet.
This is probably not what you want, but
> CorrelatedSample:= proc(Dist, p::numeric,
           n::posint)
    local X, i, S;
    uses Statistics;
    X:= Sample(RandomVariable(Dist),n);
    S:= Sample(RandomVariable(Bernoulli(p)),n-1);
    for i from 2 to n do
      X[i]:= S[i-1]*X[i-1]+(1-S[i-1])*X[i]
    end do;
    X;
  end proc;
This produces a sample of size n from a process where all X[i] have distribution Dist, and the correlation of X[i] and X[i+1] is p (where 0 < p < 1). For example:
> CorrelatedSample(Uniform(0,1), 0.1, 10);
It also has the property that Prob(X[i] = X[i+1]) = p.
This is probably not what you want, but
> CorrelatedSample:= proc(Dist, p::numeric,
           n::posint)
    local X, i, S;
    uses Statistics;
    X:= Sample(RandomVariable(Dist),n);
    S:= Sample(RandomVariable(Bernoulli(p)),n-1);
    for i from 2 to n do
      X[i]:= S[i-1]*X[i-1]+(1-S[i-1])*X[i]
    end do;
    X;
  end proc;
This produces a sample of size n from a process where all X[i] have distribution Dist, and the correlation of X[i] and X[i+1] is p (where 0 < p < 1). For example:
> CorrelatedSample(Uniform(0,1), 0.1, 10);
It also has the property that Prob(X[i] = X[i+1]) = p.
In Classic, it is possible to have two different worksheets in the same Maple window. But perhaps saadmechiche is looking for the ability to have two windows into the same worksheet or document, so you could look at two different parts of the worksheet at the same time. This would be a very useful feature, I think. It is not available now, but perhaps the developers could think about providing it in the future.
In Classic, it is possible to have two different worksheets in the same Maple window. But perhaps saadmechiche is looking for the ability to have two windows into the same worksheet or document, so you could look at two different parts of the worksheet at the same time. This would be a very useful feature, I think. It is not available now, but perhaps the developers could think about providing it in the future.
Perhaps this might help. Given a target and a source, it searches for the target in the source, and if it finds it, returns a list L such that op(L,target) = source. If it doesn't find it, it returns false.
> searchfor:= proc(target,source)
   local i,r;
   if type(source,atomic) then evalb(target=source)
   elif target=source then true
   else
     for i from 1 to nops(source) do
       r:= searchfor(target,op(i,source));
       if type(r,list) then return [i,op(r)]
       elif r then return [i]
       end if
     end do;
     false
   end if
 end proc;
For example:
> inert:= ToInert(Matrix(3,3,(i,j) -> x^i*y^j)):
  searchfor(ToInert(x^2*y), inert);
[3,1,4,2]
> op(%, inert) = ToInert(x^2*y);
_Inert_PROD(_Inert_POWER(_Inert_NAME("x"),_Inert_INTPOS(2)),_Inert_NAME("y")) = _Inert_PROD(_Inert_POWER(_Inert_NAME("x"),_Inert_INTPOS(2)),_Inert_NAME("y"))
Piecewise functions can't be entered that way. f(x) is just a list of points, and plot is plotting that list.
Piecewise functions can't be entered that way. f(x) is just a list of points, and plot is plotting that list.
I'm not sure I understand what you're trying to do, but I think you're saying x[i], i = 1..g, are a sample from the Poisson distribution with parameter 1, and then each y[i], i=1..g, is from the Poisson distribution with parameter x[i]. I don't know why you use convert(...,`+`) to extract a member from a vector: the simpler way is ...[1]. Also you might as well get the x[i] using one call to Sample. My attempt would be
> myF:= g -> 
 convert(map(
      t -> `if`(t=0, 0,  
         floor(Sample(RandomVariable(Poisson(t)),1)[1])),
      Sample(RandomVariable(Poisson(1)),g)),
   list);
This seems to take less than 40% as much time as your FFFF.
Yes, this is probably a better idea.
Yes, this is probably a better idea.
To check whether C contains negative values:
> hastype(C, negative);
To set all negative values in C to 0:
> Map(max, C, 0);
To check whether C contains negative values:
> hastype(C, negative);
To set all negative values in C to 0:
> Map(max, C, 0);
First 156 157 158 159 160 161 162 Last Page 158 of 187