Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 26 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

What makes you think that Maple does not have such a command? It is called unassign.

unassign('name1', 'name2', 'name3');

If you want to see how it's done

showstat(unassign);

It's pretty simple---just 12 statements.

 

Start your computation over again, beginning with the command

restart;

Your problem is indeed because you entered vertical:= x=0. You should use the restart to clear that. Another way to clear the value of a variable is

vertical:= 'vertical';

However, I recommend that you get in the habit of using restart to clear mistakes.

sin(4*x)^2:
expand(%);

sort(expand(subs(sin(x)^2= 1-cos(x)^2, %)));

ErrorPlot(y, xcoords= x);

It is probably the result of assigning to an indexed name and then evaluating the unindexed form. For example,

a[1]:= 2:
eval(a);

If this isn't enough information for you to diagnose your problem, then you should post your code.

I'll answer your second question first because its solution is slightly easier, although the issue is more complex.

Your code contains a definition of a function Spec thus:

Spec:= d-> expression

where expression does not explicitly contain d although it does contain variables that do contain d. Such a construction will not make Spec a function of d. To do that, you need to use unapply:

Spec:= unapply(expression, d);

If you do this, then the computation of the max and the plot will run in under a minute.

To solve your first problem, you need to take the the max from the actual plot rather than from Spec evaluated at only integer points.

P:= plot(Spec(d), d=-15..15, ...the rest of the plot options):

#Note that evalf is not needed in plot.

A:= op([1,1], P):  #The data matrix from the plot
Smax1:= max(A[..,2]):
A[..,2]:= A[..,2]/Smax1:
P:= subsop([1,1]= A, P):
print(P);

One command handles both of your questions.

P:= a_1*x*y^2*z^3+a_2*x^4*y*z^2+a_3:
coeffs(P, [x,y,z], 'M');

M;

Note that the order of the monomials and of the coefficients is not the same as in the polynomial. However, the order of the coefficients and of the monomials are guaranteed to be the same as each other.

ode2:= convert(lhs(ode)=~rhs(ode), list)[];

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;

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