Carl Love

Carl Love

28020 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

print~(set_)[];

                             a = 3
                             b = 5
                             c = 9
                             

For example,

plot([sin(t), t, t= -Pi..Pi]);

Here's a procedure that generates the three inequalities that define a triangle in the plane given the three vertices.

TypeTools:-AddType(Point, [realcons,realcons]);

ThreeIneqs:= proc(A::Point, B::Point, C::Point, XY::[name,name])
uses G= geometry;
local p, a, b, c, L, S:= {A,B,C};
     seq(
          (Eq-> `if`(eval(Eq, XY=~p) < 0, 1, -1)*Eq <= 0)
          (lhs(
               G:-Equation(
                    G:-line(
                         L,
                         [
                              G:-point(a, (S minus {p})[1][]),
                              G:-point(b, (S minus {p})[2][])
                         ]
                    ),
                    XY
               )
          )),
          p= S
     )
end proc:

ThreeIneqs([2,3], [4,5], [8,2], [x,y]);

The sum of the variables in the first 100 solutions is constant, and that constant is not 1. The constant is

There seems to be a bug that prevents me from getting past the first 100 solutions.

Procedure M creates such a Matrix of any size n.

M:= n-> Matrix(n, n, (i,j)-> max(i,j));

For example M(2), M(3), M(4).

The following procedure takes two Matrices, C and H, and returns a list of lists. Each sublist corresponds to a column of C and contains the indices of the columns in H that match it.

ColMatch:= proc(C::Matrix, H::Matrix)
uses LA= LinearAlgebra;
local c,h;
     [seq(select(h-> LA:-Equal(C[..,c],H[..,h]), [$1..op([1,2],H)]), c= 1..op([1,2],C))]
end proc:

An example of its use, using your C and H:

ColMatch(C,H);
                       [[2], [], [4], []]

You have

R = a+2*b+3*c;

That should be

R:= a+2*b+3*c;

The following is not a source of your error, but it may cause problems later. The usage

F(x):= R*x;

is incorrect. It should be

F:= x-> R*x;

Unless an author has specifically defined the two terms, do not infer that any difference is intended.

A distinction that is often made is, for example, that sin is a command whereas sin(x) is a function. However, I would not assume that any distinction was intended unless the author points it out.

~list:= x-> convert(x, list):
All:= (P::~list, Ls)-> andmap(L-> eval(L, [x,y]=~P) > 0, Ls):
All(<1,2>, [x+y+1, x+2*y+3, -x+y+2]);
                              true

Try this:

subsindets(expr, And(`+`, satisfies(x-> diff(x,q)=1)), x-> subs(q=0, x));

In words, "For every subexpression of type sum (`+`), check if the derivative with respect to q is 1. If it is, then change q to 0 in that subexpression."

int(-2*log((1+sqrt(s))/(1-sqrt(s)))/((-s^2+1)*(s-1)*sqrt(s)), s = 0..z) assuming 0 < z,z < 1;

First, get rid of all evalm. It is never needed in modern code, and it does nothing at all in the way that you are using it.

Assign the result of dsolve(..., numeric) to a variable:

Sol:= dsolve(..., numeric);

Do not use the output option for dsolve.

Then the following procedure evaluates the Matrix AA:

AA:= proc(S,t)
local Cu_inv:= eval(Cu, S(t))^(-1), tCu_inv:= eval(tCu, S(t))^(1);
     eval(Avv - Avu.Cu_inv.Cv + tCv.tCu_inv.Auu.Cu_inv.Cv - tCv.tCu_inv.Auv, S(t))
end proc:

To use it, invoke AA(Sol, t) where t is an actual numeric value.

I notice that your Auv and Avu are identically 0. I assume that you were going to change those. If not, two of the terms in the procedure are trivial.

The difference is the order that the operations are performed. If you use the gcd, then the gcd is done first, ignoring the mod. The result of that is then passed to mod. If you use Gcd, then it recognizes that it needs to take the modulus into account while finding the gcd. The same is true for all of the capitalized operators listed at ?mod .

For the vast majority of Maple procedures, arguments are evaluated before being passed: In f(g(x)), g(x) is evaluated before being passed to f. For gcd(x^2+1, x+1), the result is 1 and that is all that `mod` receives. The Gcd avoids this because it does not nothing by itself; it is an "inert" operator.

You can't use square brackets as parentheses---as an outer level of grouping, for example. You can only use round parentheses for algebraic grouping. So, your expression should be like this:

solve({((alpha[1]-alpha[2]*lambda)*sqrt(x)+p[2]*lambda)*(k[1]*(1-lambda^2)+2) = p[1]*(2*k[1]*(1-lambda^2)+2), ((alpha[2]-alpha[1]*lambda)*sqrt(x)+p[1]*lambda)*(k[2]*(1-lambda^2)+2) = p[2]*(2*k[2]*(1- lambda^2)+2)}, [p[1], p[2]]);

P:= Matrix([''[1,4],[1,5],[2,6],[3,7]'' $ 3]):
x:= 3*Statistics:-MovingAverage(P[..,1], 3):
X:= 3*Statistics:-MovingAverage(P[..,1]^~2, 3):
y:= 3*Statistics:-MovingAverage(P[..,2], 3):
Y:= 3*Statistics:-MovingAverage(P[..,2]^~2, 3):

First 338 339 340 341 342 343 344 Last Page 340 of 395