Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 357 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

What you're asking for---to reverse the effect of KroeneckerDelta---is mathematically impossible. It would be like multiplying ME by 0 and then trying to reverse the effect of that.

Use "Export as"  (rather than "Save" or "Save as") from the File menu to save the inner file as type Maple Input. Simply changing the file extension to .mpl is not enough.

The answer Dirac(X - 0.5) is what you get if X hasn't been previously assigned. So it seems that the X in you PDF command is not the same as the X in your RandomVariable command. One of the Xs may contain a nonprinting character.

This may be a bug that has been corrected in Maple 2016; I can't duplicate it. Try using restart. If that doesn't work, here's a workaround that should work in any Maple with the Statistics package:

eval(PDF(X, _t), _t= 0.5);

Let me know how it goes.

I can't tell for sure because you didn't show your whole code, but I suspect that you spelled the Greek letter pi rather than Pi. Only Pi represents the familiar mathematical constant, even though they both appear the same when prettyprinted.

f:= x-> -x^2+3*x+2:
l:= x-> 4*x:
m:= x-> 2*x-4:
plots:-display(
   plots:-inequal(
      {y <= f(x), y <= l(x), y >= m(x), y >= 0},
      x= -1..4, y= -5..10, nolines
   ),
   plot([f,l,m](x), x= -1..4, y= -5..10)
);

The t is a bound variable (see this Wikipedia article) bound by the maximize, and the m is bound by the plot.

The system of equations that you passed to fsolve clearly has no solution. This is obvious by inspection of the first two equations (as ordered in the error message), which give different values for y[1].

X:= <21.2, 24.7, 20.8, 20.8, 20.3>:
Y:= <16.6, 19.7, 16.4, 16.8, 16.9>:
L:= Statistics:-LinearFit([1,x], <X|Y>, x);
plot([<X|Y>, L], x= min(X)..max(X), style= [point, line]);

 

The result returned by plottools[getdata] is a list, one of whose members is the matrix that you want. You need to extract the matrix from the list. Since the matrix is the third item in the list, that can be done by indexing:
M:= plottools[getdata](P1)[3];

Now M is what you referred to as a "simple" matrix, which you apparenty already know how to export.

IMO, there's only one good way to handle this very common situation. Make the first statement of the procedure:
if not x::realcons then return 'procname'(args) end if;
This is called returning unevaluated. All the attempts to correct this problem with quotes or is are crude and unstable workarounds.

Then, you should also apply evalf to x when it is being checked in an inequality.

What you want is as simple as seq(a__||k, k= 1..3), or, even better, a__||(1..3).

Here's a slick technique---one of a great many possibilities:

p:= randpoly(x):
select(type, allvalues~([solve(p)]), positive &under evalf);

Of course, your statement "All coefficients/variables in the polynomial are positive" is nonsense. 

 

 

I believe that the following handles equality testing for all root-of-unity cases, as shown by the subsequent verification:

restart:
RoU:= (k,n)-> exp(2*Pi*k*I/n):
RoU_Equal:= (a,b)-> evalb(evala(Norm(convert(a-b, RootOf))) = 0):

Verification code:

Test_Equal:= (a,b,c,n)-> 
   not (
      (RoU_Equal(RoU(a,n)*RoU(b,n), RoU(c,n)) xor irem(a+b-c, n) = 0) or
      (RoU_Equal(RoU(a,n)/RoU(b,n), RoU(c,n)) xor irem(a-b-c, n) = 0) or
      (RoU_Equal(RoU(a,n)^b, RoU(c,n)) xor irem(a*b-c, n) = 0) or
      (RoU_Equal(RoU(a,n)^(-b), RoU(c,n)) xor irem(-a*b-c, n) = 0)
   )
:

The following verifies every possible case, both true and false, with every possible base up to and including 9:

V:= <''a'', ''b'' , ''c'' , ''n''>:
for v in Iterator:-CartesianProduct([$0..8] $ 3, [$2..9]) do
    assign~(V=~v);
    if not Test_Equal(a,b,c,n) then
       error "Failure at %1, %2, %3, %4", a, b, c, n
    end if
end do:

Equal(<a>, <b>) is equivalent to evalb(a = b). I think that you have the mistaken idea that Equal is a more-sophisticated comparator. One that is actually more sophisticated is is(a = b).

First 198 199 200 201 202 203 204 Last Page 200 of 395