HP Forums
Reductions fractions. - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Reductions fractions. (/thread-9585.html)



Reductions fractions. - ggauny@live.fr - 11-28-2017 11:31 AM

Hi,

I would like find for example :

Reduce this fractions to the same denominator 1/3 and 4/9. I calculate
the lcm what it is 9 and I multiplication the 1/3 by 3. This me give 3/9.

Then the answer is 3/9 and 4/9.

Of course I know to do by hand but

Well in the prime I know "comdenom" but this dont' give this answer and
we have use arithmetic operator.


For example SIMPLIFY (42/12,12/16,36/24) give [7/2 3/4 3/2], is it a command
may be I am ignoring it, that give the same for fractions ?

cmd(1/3,4/9)----->[3/9 4/9]

cmd(5/9,7/4,6/11)----->[220/396 693/396 216/396]

Thank.


RE: Reductions fractions. - Carlos295pz - 11-28-2017 02:18 PM

I'm not sure if there is such a command, but an alternative is to help with variables in the CAS.

[Image: 38668473332_2b10a29318_o.png]


RE: Reductions fractions. - DrD - 11-28-2017 02:23 PM

With a list of fractions stored in LO:

Here's the equivalent numerators:
EXECON("&1/gcd(L0)",L0);

Each one times the common divisor:
gcd(L0);

-Dale-


RE: Reductions fractions. - ggauny@live.fr - 11-28-2017 03:06 PM

Hi,

Very helpfull !

Thank to you both.


RE: Reductions fractions. - Carlos295pz - 11-28-2017 03:38 PM

(11-28-2017 02:23 PM)DrD Wrote:  Here's the equivalent numerators:
EXECON("&1/gcd(L0)",L0);

Each one times the common divisor:
gcd(L0);

Adapted
Divisor: EVAL(1/gcd(exact(L0)))
Numerator list: EXECON("&1/EVAL(gcd(exact(L0)))",L0)


RE: Reductions fractions. - ggauny@live.fr - 11-28-2017 03:46 PM

Hi,

Very helpfull !

Thank to you both.


But surely I misunderstand with Carlos.


RE: Reductions fractions. - Carlos295pz - 11-28-2017 03:52 PM

The idea is to use variables that do not have assigned data, it is possible that in your calculator x, xx have a value, you can use other variables. I used those because they are the ones I can type faster.


RE: Reductions fractions. - ggauny@live.fr - 11-28-2017 04:12 PM

Thank once again it run with m, mm for example.


RE: Reductions fractions. - ggauny@live.fr - 11-28-2017 04:56 PM

Hi,

I appreciate Carlos and Dale for the elegant formulas
and because I best understand some commands.


RE: Reductions fractions. - Didier Lachieze - 11-28-2017 06:13 PM

(11-28-2017 03:38 PM)Carlos295pz Wrote:  Adapted
Divisor: EVAL(1/gcd(exact(L0)))
Numerator list: EXECON("&1/EVAL(gcd(exact(L0)))",L0)

For the numerator you can simply do: L0/EVAL(gcd(exact(L0)))


RE: Reductions fractions. - ggauny@live.fr - 11-28-2017 07:03 PM

Hi,

I see a little thing I no understand, sometime there is decimal
instead of integer.

I give example in attachement. Even I try mani things it is no change.

It is not important you know.


RE: Reductions fractions. - chromos - 11-28-2017 07:54 PM

(11-28-2017 06:13 PM)Didier Lachieze Wrote:  For the numerator you can simply do: L0/EVAL(gcd(exact(L0)))

Or even L0/gcd(exact(L0))


RE: Reductions fractions. - StephenG1CMZ - 11-28-2017 09:47 PM

(11-28-2017 07:03 PM)ggauny@live.fr Wrote:  Hi,

I see a little thing I no understand, sometime there is decimal
instead of integer.

I give example in attachement. Even I try mani things it is no change.

It is not important you know.

This gets rid of the unwanted real:
Code:

EXPORT TRYG()
BEGIN 
 LOCAL LL={5/9,7/4,6/11};
 LOCAL DD:=1/gcd(exact(LL));
 LOCAL NN:=LL*DD;
 
 RETURN {approx(DD),NN};// numerators or
 RETURN {approx(DD),exact(NN/DD)}; // fractions
END;
But the fractions are not nice: x/1/1/396 instead of x/396.


RE: Reductions fractions. - ggauny@live.fr - 11-29-2017 09:17 AM

Hi,

Taking the idea of Chromos for numerators and applying
to denominator I obtain for example :

LO[1/40 5/24 7/36 12/25]------->[1/40 5/24 7/36 12/25]

LO/gcd(exact(LO))----->[45 375 350 864] //numerators

1/gcd(exact(LO))----->1800 //denominator commun

This avoid the influence of *EVAL* wich give sometimes undesired decimals.


Now I only have to find the good presentation like for example :

45/1800 375/1800 350/1800 864/1800

But this is a new challenge for me !

Thanks to all for help.


RE: Reductions fractions. - ggauny@live.fr - 11-29-2017 03:13 PM

Hello,

In CAS program I use this little code :

Code:


#cas
RedFracsss(LO):=
BEGIN

   a:=gcd(exact(LO));

   PRINT();
   PRINT(LO/a);
   PRINT(1/a);

END;
#end

In the CAS terminal we see [n, n1, n2......] the numerators
and just below the denominator.

Usefull to verify exercises of my greatgrandson wich learn fractions !

EDIT because little little boy is not good american, the right word is greatgrandson !


RE: Reductions fractions. - Carlos295pz - 11-29-2017 03:35 PM

In Home program

Code:
EXPORT RedFracssh(l)
BEGIN
  LOCAL Div=gcd(exact(l));
  PRINT;
  PRINT(l/Div);
  PRINT(EVAL(1/Div));
END;