Carl Love

Carl Love

28100 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Christopher2222 

Great application. Assuming that each window requires four pieces (one side, all the way around) and that the door requires six pieces (both sides, no bottom), the solution is

BinPacking1D(7*12, [[42, 4], [20, 6], [72, 4], [32, 2], [16, 2], [30, 4]]);

for a total of 11 7-ft pieces to buy. Note that this does not take mitered corners into account.

@taro 

As Roman said, products are NOT sorted. Your example expression 2*y*(x*y+2)*(3*y^3+x^2+3*x*y) is a product; it is not stored as a polynomial. It is not sorted. The order of the factors is pretty much random except that numeric factors come first. The factors (x*y+2) and (3*y^3+x^2+3*x*y) are polynomials. Thus, their terms are sorted.

@Bishop556 

You have a division by zero because of y=0.

You should change .5 to 1/2 and 1.5 to 3/2. It will make errors easier to find. In Maple, try to avoid the use of decimal points except for empirically derived constants. Occasionally that is impossible, but keep it as a goal.

Since your procedure psi uses globals and y and parameters a and b, expressions such as psi(x,y), diff(psi(x,y), x, x), etc. are highly suspicious to me. Do you really intend for x and y to be both the arguments substituted for the parameters and the globals? Shouldn't those expressions be psi(a,b), diff(psi(a,b), a, a), etc.? I don't know enough about the physics to decide that.

@acer The value command changes Int to int even if the resulting int returns unevaluated.

@tomleslie 

Note that the Question is about Maple TA, not regular Maple.

@Mac Dude 

phi does not need to be a Vector, and thus there is no need to construct it first. It can be a table or simply an indexed procedure.

You should post your code.

@lt 

What error message did you get when you ran the code in Maple 13?

It is not necessary in this problem to restrict the domain to the reals in order for solve to solve it, and at the time that I had posted my Answer, Markiyan had not yet added the phrase "over the reals."

@Carl Love 

And here is the code. The first argument, E, is a set of polynomials presumed to be set equal to 0. The second argument, V, is optional and is a list of the variables in E to prescribe the order of the solution lists. If V is omitted, then a default order is chosen and returned.

SolveMod2:= proc(E::set(polynom), V::list(name):= [indets(E,name)[]])

     V =
     select(
          X-> (VatX-> andmap(e-> Eval(e, VatX) mod 2 = 0, E))(V=~ X),
          (N-> combinat:-permute([1$N, 0$N], N))(nops(V))
     )
end proc:

And here is the code run on a problem of the size that you mentioned. This takes less than 20 seconds on my computer.

E:= {'randpoly([x||(1..11)])' $ 11^3} mod 2;
SolveMod2(E);



Of course, the probability that a random system of 11^3 polynomials in 11 variables has any solution mod 2 is infintesimal. Here is the code run on a system with solutions.

E:= {'randpoly([x||(1..11)])' $ 32} mod 2:
SolveMod2(E);

Are they linear equations? Is some significant subset linear?

@rit 

I said that there were 16 binary operations on two variables. By that I meant that there are 16 functions from {0,1} x {0,1} to {0,1}. If you want to do larger sets, then no, Bits does not handle that.

Regarding the zero padding: That's what the bits argument does. That's why I said

Bits:-Not(235, bits= 8);

(Although it is not necessary in this simple example.)

Regarding your C# code: The point of bitwise operations is to avoid using strings with their inherent relative inefficiency. A single machine word can substitute for a string of 64 bits (assuming a 64-bit processor).

@beidouxing 

But in Maple you cannot substitute {} for (). Maple will often allow you to enter the expression with {}, but this changes the mathematical meaning of the expression. It makes it a set.

@wenny 

Once you use absolute value, there is an infinitude of pairs (a,b) such that the objective function is 0, its minimum value. Those pairs lie along a line in the (a,b) plane. The minimize command has returned to you the equation of that line.

To get a numeric answer, you need some constraints on a and b. If a and b are allowed to be arbitrarily large, then obviously the function value will become arbitrarily small (to -infinity).

First 517 518 519 520 521 522 523 Last Page 519 of 709