Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

You say "curve", but I wonder if you actually mean surface. Do you want a function z ~ f(x,y)? That's a surface. Or do you want functions x ~ f(t), y ~ g(t), z ~ h(t)? That's a curve.

@Kitonum Like this:

SMC:= Student:-MultivariateCalculus:
L1:= <2-4*t, 5+6*t>:  L2:= <-6-12*t, 17+18*t>: 
SMC:-Equal((SMC:-Line@`[]`@seq)~([L1,L2])[]);
                              true

 

@Magma 

All commands in LinearAlgebra:-Modular work substantially faster if the input matrices are converted to one of the package's native formats via its Mod command. Here's a comparison:

restart:
randomize(23): #arbitrary key number for repeatability
LA:= LinearAlgebra:  LAM:= LA:-Modular:
A:= LA:-RandomMatrix(64$2, generator= rand(0..1)):
n:= rand(2^63..2^64-1)();
                   n := 15162085668718581745
AP1:= CodeTools:-Usage( #Compute A^n in a native format:
    LAM:-Mod(2, LAM:-MatrixPower(2, LAM:-Mod(2,A,float[8]), n), integer[kernelopts(wordsize)/8])
): 
memory used=0.91MiB, alloc change=0 bytes, cpu time=63.00ms, real time=56.00ms, gc time=0ns

AP2:= CodeTools:-Usage(LAM:-MatrixPower(2, A, n)): #naive method, without conversion
memory used=86.39MiB, alloc change=28.99MiB, cpu time=8.02s, real time=8.00s, gc time=62.50ms

LA:-Equal(AP1, AP2); #accuracy check
                              true
8.02/.063; #cpu time ratio
                          127.3015873

 

@Magma According to the paper that you linked at the bottom of this Question, the problem being discussed in this thread is known to be NP-hard. That means that there can be no practical solution that doesn't use heuristics that possibly produce suboptimal solutions. For example, Paar's algorithm uses such heuristics, and in another thread its output was shown to be slightly suboptimal for the specific case being discussed there. 

On the other hand, your algorithm posted above and also my Maple implementation of it both search the entire space and are guaranteed to produce an optimal solution. By the concept of NP-hardness, there's no possibility that this code could be improved to run in a reasonable or practical amount of space and memory for a 64 x 64 case.

@Magma Thanks, I read it, and I made two responses so far, albeit tangential to your Question.

I'm no more likely to see a Reply where my name is tagged than I am to see a new Question. This is because I pay no attention to the automatic notifications because I just read all of MaplePrimes. Thus, there's no need to tag me in another thread.

@vv By M_r(Z2) do you mean the ring of r x matrices over GF(2,1)?

So, a commutative subring of this consisting only of invertible matrices (other than 0) would be an image of an embedding GF(2,r) -> M_r(Z2), right?

@Magma Maple can derive that formula for counting submatrices that you used, binomial(2*n, n) - 1, and that Maple can do that can be used to promote understanding of the concept, because it's more clear precisely what the below formula counts:

sum(binomial(n, k)^2, k= 1..n);
                     
binomial(2*n, n) - 1

since the number of k submatrices of an  matrix is easily seen to be binomial(n,k)^2.

Thanks, Rouben, and a Vote Up. The motion does look realistic.

I assume that there's no friction between the red ball and the container?

I think that a marketable toy could be based on this design.

@Jjjones98 Cramer's rule gives us an estimate of the size of the solution. For a 6x6 system, each of the 6 variables is a rational function whose numerator and denominator each have 6! = 720 terms, each term being a product of 6 coefficients. Now, some of your coefficients are 0, but not many. The 6 denominators are the same.

@tomleslie I figured that it had something to do with workbooks. Clicking on a variable and bringing up context, I see "Save", presumably to save that one variable in the workbook, but not "Save variables". Do you see that?

Could you guide me to the menu on which it's greyed out?

@tomleslie The inert commands Normal and Eval become active when used with mod and a numeric modulus. There are about 45 such commands predefined, and user-defined ones are easy to add. See ?mod for the 45.

In order for the OP's calculation to make any sense, must be defined as a RootOf an irreducible mod p integer-coefficient polynomial for a prime p that's explicitly given. Otherwise, the whole expression remains inert, as seen in your code above.

As you probably know, and as can be seen above, cancellation of identical factors from a numerator and denominator is an "automatic simplification" that occurs even in inert expressions (unless the arithmetic operators are also made inert, such as %/).

@Christian Wolinski 

You're correct, and the precise rules regarding this sort of thing are on the help page
?operators,precedence. Given any two binary infix operators op1 and op2 (possibly the same) and the expression

a op1 b op2 c

exactly one of the following is always true:

  1. the expression evaluates as (a op1 b) op2 c;
  2. the expression evaluates as a op1 (b op2 c);
  3. it's a syntax error.

 

Here is EAdd as displayed by showstat(EAdd), except that the lines in red were added by me to show what's actually happening (not what should be happening). In other words, your code acts as if my added lines were already there. 

I used showstat because the indentation style makes it easy to see that there's a NULL logic path. You should adopt a consistent indentation style for your own code writing.

EAdd := proc(f, x, p, P1, P2, Q1, Q2)
local a, mm, R1, R2;
   1   a := coeff(f,x,1);
   2   if P1 = infinity then
   3       return [Q1, Q2]
       elif Q1 = infinity then
   4       return [P1, P2]
       elif Q1 = P1 mod p then
   5       if Q2 = -P2 mod p then
   6           return [infinity, infinity]
           elif Q2 = P2 then
   7           mm := 1/2*(3*P1^2+a)/P2 mod p;
   8           R1 := Normal(mm^2-P1-Q1) mod p;
   9           R2 := Normal(mm*(P1-R1)-P2) mod p;
  10           return [R1, R2] mod p
           else
               return NULL
           end if
       else
  11       mm := (Q2-P2)/(Q1-P1) mod p;
  12       R1 := Normal(mm^2-P1-Q1) mod p;
  13       R2 := Normal(mm*(P1-R1)-P2) mod p;
  14       return [R1, R2] mod p
       end if
end proc

When NULL is returned and you try to index it, you get the error invalid subscript selector. Note that all procedures have a return value, possibly NULL, regardless of whether a return value is explicitly specified.

@mmcdara I've always been fascinated visually by the hurky-jerky way a container half full of water slides along a floor when kicked. A simulation of that would be fascinating also. If the box on Rouben's conveyor belt were half full of water, it'd be even better. 

First 232 233 234 235 236 237 238 Last Page 234 of 708