Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

What kind of data are in the Arrays cosArr2, k1, and alpha? If it is not floating point, could you make it so?

I think that the problem can be done. Instead of NextTo, we need a custom relational constraint CircNextTo (and its negation). See the long comment ahead of procedure `Know/Rel`. These procedures are much easier to write than the general procedural constraints that I wrote about yesterday. See the seven examples that I put in the code, starting with SameBlock.

Then to make the rotational symmetry unique, we arbitrarily make Alan = 1. Since left and right are not used in the problem, we also have flip symmetry. We know Amy is next to Alan, so we make Amy = 2.

To express a disjunction of constraints, use OR([constraints]). There can be any number of constraints more than one. Example: OR([NextTo(Amy, Alan, PN), NextTo(Brad, Beth, PN)]). Note that both letters of OR are uppercase.

I was wrong about the negation of the NextTo constraint, and I've changed my previous answer regarding that. Please reread it. The negation of NextTo(A, B, V) is Rel(Separated, A, B, V, [1]). Since Separated is an export of the dynamic module, a constraint using it must appear after the with is executed.

The circular arrangement does indeed complicate matters. I don't know if this problem can be solved by the package. I'll be thinking about it as I fall asleep tonight.

@Joe Riel I think the depends is an elegant solution to the problem. Why do you say that it only partially solves the problem?

@Joe Riel To me, a dimension check in the body of the anonymous procedure is certainly nastier than using subs to create a check in the header.

@weirp Are the scalars a and b going to be specific numeric values at the time of execution, or will they be unspecified symbols? If the latter, then I'm afraid that your computation is not feasible. The size of A[k] grows by a factor of about 3 for each k, and A[16] is already 460 megabytes. Whereas with a and b as specific integers I've finished the computation up to k = 100 in a few seconds with no problems.

@pepegna90 I have the worksheet already! I need the matrix data. That's what I couldn't find on filedropper.

You've given the initial value for k. I think that it is also necessary to give initial values for i and j and also to specify their upper bounds.

@pepegna90 I can't find your file from the link on filedropper. The link just takes me to the fledropper main page.

@Joe Riel Can you please show this example done with objects? Would using objects avoid the "nastiness" of having to use subs?

@brian bovril The opposite of NextTo(a, b, V) is Rel(NotNextTo, a, b, V)).

Update: There's a problem with using NotNextTo: I decided not to make it an export of the module. It's been a very long time, so I can't remember why. So the above is the internal form of the negation of a NextTo constraint. Internally, I also have a way to express the negation of almost any constraint. So here's a way to negate a NextTo using accessible exports:

The negation of NextTo(a, b, V) is Rel(Separated, a, b, V, [1]),

i.e., a and b are separated by a distance of at least 1 when measured wrt V. Since Separated is an export of the dynamic module, this constraint needs to be specified after the with is executed.

I added "physics package" to the tags, in the hope that Edgardo would see.

@boris_m I can't reproduce it in any version of Maple that I have. That includes Maple 17.02/32-bit on Windows 8.1/64-bit.

The nature of the problem is that it is acting as if zip is an unknown function. Check if a regular zip command works for you at the top level. If it does, then try this

m:= module()
option package;
export
     `*`:= proc(a::list, b::list)
     option overload;
     local i, L:= zip(:-`*`, a, b);
          if L::function then
               print(L);
               error "No zip."
          end if;        
          add(i, i in L);
     end proc
;    
end module;

If that doesn't work, we can do it without zip like this:

m:= module()
option package;
export
     `*`:= proc(a::list, b::list)
     option overload;
          `+`(:-`*`~(a,b)[])
     end proc
;    
end module;

Please post your exact code.

@Ratch You claim that solve in Maple 16 did not work for you. Using Maple 16.02, I got nine solutions with solve. Eight are nonreal, and there's the real solution given by fsolve.

First 567 568 569 570 571 572 573 Last Page 569 of 709