baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
I have a question regarding fraction cancelation algorithm. Actually what I need is an approach that will allowe me to quickly cancel out two arrays of numbers. Example:
Let say I have two arrays of integers like :
My aim is to multiply integers within a given array and then divide two arrays:@a=qw(1 4 6 2 7 87 5 6 4 32) @b = qw(86 50 62 41 32)
What would be the most efficiant way to do this? Probably to first cancle out what can be canceled and then seperatly first multiply integers and then divide the obtained products. If that is the case, what would be the most efficient cancelation approach??1 x 4 x 6 x 2 x 7 x 87 x 5 x 6 x 4 x 32 --------------------------------------- 86 x 50 x 62 x 41 x 32
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fraction Cancelation
by BrowserUk (Patriarch) on Feb 24, 2016 at 16:04 UTC | |
|
Re: Fraction Cancelation
by Corion (Patriarch) on Feb 24, 2016 at 15:50 UTC | |
|
Re: Fraction Cancelation
by BillKSmith (Monsignor) on Feb 24, 2016 at 18:05 UTC | |
by LanX (Saint) on Feb 24, 2016 at 19:11 UTC | |
by Laurent_R (Canon) on Feb 24, 2016 at 21:53 UTC | |
|
Re: Fraction Cancelation
by Laurent_R (Canon) on Feb 24, 2016 at 22:14 UTC | |
by baxy77bax (Deacon) on Feb 25, 2016 at 11:52 UTC | |
|
Re: Fraction Cancelation [Perl6]
by u65 (Chaplain) on Feb 24, 2016 at 20:31 UTC | |
|
Re: Fraction Cancelation
by shmem (Chancellor) on Feb 26, 2016 at 20:17 UTC |