MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 11 Oct 2016 04:01 PM |
How Do You Solve: 13x+19y=1000
x and y have to be whole numbers |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
| |
|
Lordux
|
  |
| Joined: 10 Jun 2010 |
| Total Posts: 610 |
|
|
| 11 Oct 2016 04:04 PM |
graph it 19y=-13x+1000 y=-0.685x+52.6315789 |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:04 PM |
How Do You Solve: 13x + 19y = 1000
x and y have to be whole numbers
linear equation
y = 1000/19 + 13x/19
for i = 10000 do if 13*i/19 + (1000/19) == math.floor then print("WE FOUND A COMBO ("..i..","..(13*i/19 + (1000/19))..")") end wait() end
|
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:08 PM |
y = 1000/19 + 13x/19
for i = -10000000, 1000000000 do if 13*i/19 + (1000/19) == math.floor then print("WE FOUND A COMBO ("..i..","..(13*i/19 + (1000/19))..")") end wait() end
add the values instead of printing to a table
there is only one solution bc its linear, and it prob isn't a interger chord
|
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 11 Oct 2016 04:09 PM |
| No I want all of the possible x and y that are integer |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:10 PM |
thats what my script does
prints all combinations where X and Y are intigers
|
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 11 Oct 2016 04:10 PM |
I give you one hint:
1000 = 12 [19] 1000 = 12 [13] |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 11 Oct 2016 04:11 PM |
| and your script errors and still doesn't print all integer solutions |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:19 PM |
lol you mean 0 = x, y = 19 and 13, 0
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:21 PM |
my script doesn't error, I don't know why it doesn't print those value stho
|
|
|
| Report Abuse |
|
|
|
| 11 Oct 2016 04:33 PM |
for i=1, math.huge, 1 do local y=((-13*i)/19)+(1000/19) if y==math.floor(y) then print(i,y) end wait() end
beware. I experienced minor lag from this :)
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:39 PM |
did you find the values he was reffering to?
and for me it wasn't about lag when using wait() it was just it only goes thru 32 values per second which takes forever. u also dont have any negative x solutions
|
|
|
| Report Abuse |
|
|
|
| 11 Oct 2016 04:42 PM |
I forgot about the negative ones. Here it is...
for i=1, math.huge, 1 do local y=((-13*i)/19)+(1000/19) local y0=((-13*-i)/19)+(1000/19) if y==math.floor(y) then print(i,y) end if y0==math.floor(y0) then print(-i,y0) end wait() end
Also yes it does print out values continuously.
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:45 PM |
what is different between our two scripts? besides your nifty negative value way
|
|
|
| Report Abuse |
|
|
|
| 11 Oct 2016 04:50 PM |
Well first you didn't simplify correctly >y = 1000/19 + 13x/19 is wrong should be y=1000/19-13x/19
Second your index starts at -10000000, probably not many values around that area.
>math.floor you are comparing a number value to a function value. should be math.floor(numValue)
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:52 PM |
I forgot to do if 13*i/19 + (1000/19) == math.floor(13*i/19 + (1000/19)) then left it halways complete
combined with algebra error makes sense
|
|
|
| Report Abuse |
|
|
|
| 11 Oct 2016 04:55 PM |
| does anyone even like algebra? |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 11 Oct 2016 04:57 PM |
I don't mind it, and you need it for calculus so :/
|
|
|
| Report Abuse |
|
|
|
| 11 Oct 2016 04:59 PM |
I love math. Algebra,trig,calc all of it.
|
|
|
| Report Abuse |
|
|
cabbler
|
  |
| Joined: 19 Jun 2015 |
| Total Posts: 735 |
|
|
| 11 Oct 2016 06:00 PM |
| Uh you can only solve for one variable, and there are infinite solutions ... |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 11 Oct 2016 06:07 PM |
wrong.
13x+19y=1000
d/dx[13x] + d/dx[19y] = d/dx[1000]
13 + 19dy/dx = 0
19dy/dx = -13
dy/dx = -13/19
mtan = -13/19
if x = 0,
y = 1000/19
Equation of tangent line: y - 1000/19 = -13/19(x - 0)
kek
|
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 12 Oct 2016 01:56 PM |
| I still need the integer solutions. |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
|
| 12 Oct 2016 02:42 PM |
Fine I give you the answer
13x + 19y = 1000
12 = 1000 [19] 0 = 1000 - 13x [19] 13x = 1000 [19] 13x = 12 [19] x = 17 [19]
x = 19k + 17
0 = 1000 - 19y [19] 19y = 12 [13] y = 2 [13]
y= 13l +2
13 (19k + 17) + 19 (13l + 2) = 1000
247k + 221+ 247l + 38 = 1000 247(k+l) = 1000-221-38 247(k+l) = 741 k+l=3 l=3-k
y= 13(3-k) + 2 y= 39-13k+2 y= 41-13k
THE SOLUTION IS:
x=19k+17 y=-13k+41
(example) for k=5: 13(19*5+17) + 19(-13*5+41) = 1000 |
|
|
| Report Abuse |
|
|