All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic > Weights and Scales
Ratio Resolution VII (Posted on 2022-08-16) Difficulty: 3 of 5
Let us consider three alloys of which the first alloy contains zinc, tin, and copper in the ratio 2:3:4; the second alloy contains zinc, tin, and copper in the ratio 3:4:5 and, the third alloy contains zinc, tin, and copper in the ratio 4:5:6
  1. When the three alloys are melted together in the ratio p:q:r, the ratio of zinc, tin, and copper in the resulting alloy is also p:q:r. Determine the ratio p:q:r
  2. What is the ratio p:q:r, if keeping all the other conditions unaltered, the ratio of zinc, tin, and copper in the resulting alloy is r:q:p?
Note: Assume that each of p, q, and r is a positive integer with gcd(p,q,r)=1

See The Solution Submitted by K Sengupta    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts computer findings | Comment 1 of 3
clearvars
global a1 a2 a3
a1=[2 3 4];
a2=[3 4 5];
a3=[4 5 6];
aa=[a1; a2; a3]

syms q r

eqs=[mix2(q,r)/mix1(q,r)==q, mix3(q,r) /mix1(q,r) ==r];
v=solve(eqs);
q=v.q(2);
r=v.r(2);
m=eval(a1+q*a2+r*a3)
m*aa/m(1)
minoff=999;
for i=1:10000
  val=i/m(1)*m;
  valb=val(2);valc=val(3);
  if abs(valb-round(valb))<.0000001
    if abs(valc-round(valc))<.0000001
      disp(val) 
    end
  end
  totoff=abs(valb-round(valb))+abs(valc-round(valc));
  if totoff<minoff
    minoff=totoff;
    mini=i;
  end
end
mini/m(1)*m
mround=round(mini/m(1)*m)
mround*aa/m(1)

function a=mix1(x,y)
global a1 a2 a3
  t=a1+x*a2+y*a3;
  a=t(1);
end

function a=mix2(x,y)
global a1 a2 a3
  t=a1+x*a2+y*a3;
  a=t(2);
end

function a=mix3(x,y)
global a1 a2 a3
  t=a1+x*a2+y*a3;
  a=t(3);
end

finds

The bests ratio of alloys to use is

 12.4807406984079 : 16.4300336161555 : 20.3793265339031
 
to get an element mixture of ratio

 12.4807406984079 : 16.4300336161555 : 20.3793265339031
 
The best rounting to an integer was

 2051:2699.99992476677:3348.99984953355
 
which, when rounded to the integers 

        2051  :  2700 : 3349
        
produced the elemental ratio 

 2051.0000663074 : 2700.00000915801 : 3348.99995200862


I was not able to get this method to work with the second part, so I went to the suggested working with trial integers:


a1=[2 3 4];
a2=[3 4 5];
a3=[4 5 6];
aa=[a1; a2; a3]

best=999;
for a=1:250
  for b=1:200
    for c=1:150
      if gcd(gcd(a,b),c)==1
        rslt=[a b c]*aa;           % matrix multiplication
        ratio=b/rslt(2);
        rsltN=ratio*rslt;          % normalize to the middle term being b
        tst=sum(abs(rsltN-[c b a]));  % element-by-element subtraction
        if tst<best
          best=tst;
          bestRats=[a b c];
          bestRslt=rsltN;
        end
      end
    end
  end
end
bestRats
bestRslt

finds that in its range of tests, the best integral ratios on the mixing would be

   111:88:65

for a resulting mixture element ratio of

   64.9980198019802 : 88 : 111.00198019802
   
   
   
   
The same method, used for the first part, yields

    79:104:129
 
 resulting in
 
    79.0015408320493 : 104 : 128.998459167951

    
    
The equation-solving method for the first part was for practical purposes instantaneous, but took a while to program, and I gave up trying to modify it for the second part. The second method, using trial integers, took about a minute or two to run but less than half hour to program, and modifying it for part two was trivial.    

  Posted by Charlie on 2022-08-16 09:17:38
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information