Carl Love

Carl Love

28050 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@ecrkae You need to give values for A, c_3k, etc.

@ecrkae You need to give values for A, c_3k, etc.

You are assuming that the letters represent distinct digits. That may be the default assumption in such problems; I don't know.

It is immediately obvious that C=9, K=1, and R is even. Applying essentially your technique, I get 94 solutions in about a half second.

restart: st:= time():
S:={$0..9}:  L:= table():  C:= 9:  K:= 1:
for N in S do
for R in {0,2,4,6,8} do
for P in S do
for H in S do
for M in S do
for E in S do
     a:=C*10^3+N*10^2+R*10+P:
     b:=C*10^2+P*10+P:  
     c:=K*10^4+H*10^3+M*10^2+E*10+R:
     if a + b = c  then  L[CNRP=a, CPP=b, KHMER=c]:= [][]  fi:
od: od: od: od: od: od:
time()-st;
nops([indices(L)]);
                             0.547
                               94

You are assuming that the letters represent distinct digits. That may be the default assumption in such problems; I don't know.

It is immediately obvious that C=9, K=1, and R is even. Applying essentially your technique, I get 94 solutions in about a half second.

restart: st:= time():
S:={$0..9}:  L:= table():  C:= 9:  K:= 1:
for N in S do
for R in {0,2,4,6,8} do
for P in S do
for H in S do
for M in S do
for E in S do
     a:=C*10^3+N*10^2+R*10+P:
     b:=C*10^2+P*10+P:  
     c:=K*10^4+H*10^3+M*10^2+E*10+R:
     if a + b = c  then  L[CNRP=a, CPP=b, KHMER=c]:= [][]  fi:
od: od: od: od: od: od:
time()-st;
nops([indices(L)]);
                             0.547
                               94

Why do you want to use C when those things can be done in Maple?

Do you mean that p is the conjugate of z?

@brian bovril To change the prompt, use interface(prompt= "(**)").

Where is my sequence wrong? I tested it up to the 1000th Fibonacci.

@brian bovril To change the prompt, use interface(prompt= "(**)").

Where is my sequence wrong? I tested it up to the 1000th Fibonacci.

@wolfman29 Yes, you can do double (and higher dimension) numeric integrals. There are basically two syntaxes:

Int(Int(x^2+y^2, x= 0..y), y= 0..1);  evalf(%);

or

Int(x^2+y^2, [x= 0..y, y= 0..1]);  evalf(%);

@wolfman29 Yes, you can do double (and higher dimension) numeric integrals. There are basically two syntaxes:

Int(Int(x^2+y^2, x= 0..y), y= 0..1);  evalf(%);

or

Int(x^2+y^2, [x= 0..y, y= 0..1]);  evalf(%);

Why do you say "possible"? It's clear to me that your code covers all the cases.

Why do you say "possible"? It's clear to me that your code covers all the cases.

First, let's clarify what the problem under discussion is. I see two possibilities:

  1. to find any group of coins whose total value exceeds $1 but such that no subset makes exactly $1,
  2. to find a group of coins of maximal total value satisfying (1).

Problem (1) feels like a "knapsack problem". (See the Wikipedia arcticle "Knapsack problem".) I am not at all sure about that. The subset sum problem is a relatively easy (NP-complete) case of the knapsack problem (NP-hard). Problem (2) feels like something where you'd have to solve a knapsack problem for each point (coin combination) that you're checking.

We must resort to heuristics. The best heuristic that I've ever learned applies here, and it applies to almost any real-world packing job: "Put the big ones in first". That's what you've done in your informal solution to this problem: You put in the 50-cent piece, then the 20s, then decided you couldn't fit any 10s, then put in the 5.

 

 

@abbeykabir The two curves are so close that the difference is not perceivable. You can find the maximum difference between them with the command

LinearAlgebra:-Norm(M[.., 2] - M[.., 3]);

To exchange the horizontal and vertical axes, change M[.., [1,2]] to M[.., [2,1]] and likewise for M[.., [1,3]].

As threads get older, it gets harder and harder to find them. If you have more questions, please make a new thread.

@abbeykabir The two curves are so close that the difference is not perceivable. You can find the maximum difference between them with the command

LinearAlgebra:-Norm(M[.., 2] - M[.., 3]);

To exchange the horizontal and vertical axes, change M[.., [1,2]] to M[.., [2,1]] and likewise for M[.., [1,3]].

As threads get older, it gets harder and harder to find them. If you have more questions, please make a new thread.

First 611 612 613 614 615 616 617 Last Page 613 of 709