Exetools  

Go Back   Exetools > General > Community Tools

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2020, 22:43
CodeCracker CodeCracker is offline
VIP
 
Join Date: Jun 2011
Posts: 466
Rept. Given: 27
Rept. Rcvd 406 Times in 134 Posts
Thanks Given: 21
Thanks Rcvd at 1,880 Times in 359 Posts
CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499
LinearDiophantineEq

LinearDiophantineEq: will solve equation a*x+b*y=c
where x and y are integers, nothing special about it.

https://www.techiedelight.com/find-general-solution-linear-diophantine-equation/
https://raw.githubusercontent.com/wandering007/algorithms/master/extended_gcd.cpp
Attached Files
File Type: zip LinearDiophantineEq.zip (4.3 KB, 9 views)
Reply With Quote
The Following User Says Thank You to CodeCracker For This Useful Post:
niculaita (02-18-2020)
  #2  
Old 02-14-2020, 02:49
Git's Avatar
Git Git is offline
Old Git
 
Join Date: Mar 2002
Location: Torino
Posts: 1,115
Rept. Given: 220
Rept. Rcvd 265 Times in 157 Posts
Thanks Given: 108
Thanks Rcvd at 216 Times in 124 Posts
Git Reputation: 200-299 Git Reputation: 200-299 Git Reputation: 200-299
Quote:
Originally Posted by CodeCracker View Post
a*x+b*y=c
where x and y are integers,
Implied, but maybe not obvious that it's more restrictive than that - all four left hand variables muct be integers.

Git
Reply With Quote
  #3  
Old 02-18-2020, 02:09
CodeCracker CodeCracker is offline
VIP
 
Join Date: Jun 2011
Posts: 466
Rept. Given: 27
Rept. Rcvd 406 Times in 134 Posts
Thanks Given: 21
Thanks Rcvd at 1,880 Times in 359 Posts
CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499 CodeCracker Reputation: 400-499
Quote:
Originally Posted by Git View Post
Implied, but maybe not obvious that it's more restrictive than that - all four left hand variables muct be integers.
Git
a, b, c must be also be integers.

One may ask what if x and y are not integers but real numbers,
then we will have an infinite number of solutions:
for each x value there is a y value
and for each y value there is a x value,
which is another way of saying we don't have enough information about x and y from a single equation.
Reply With Quote
The Following User Says Thank You to CodeCracker For This Useful Post:
niculaita (02-18-2020)
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT +8. The time now is 01:55.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )