Solver Converting Mixed Fractions to Improper Fractions (and vice versa)
Algebra
->
Algebra
->
Numeric Fractions Calculators, Lesson and Practice
-> Solver Converting Mixed Fractions to Improper Fractions (and vice versa)
Log On
Ad:
Algebrator™
solves your algebra problems and provides step-by-step explanations!
Ad:
Algebra Solved!™
: algebra software solves algebra homework problems with step-by-step help!
Algebra: Numeric Fractions
Solvers
Lessons
Problems, free tutors
Quiz
In Depth
Source code of 'Converting Mixed Fractions to Improper Fractions (and vice versa)'
This Solver (Converting Mixed Fractions to Improper Fractions (and vice versa))
was created by by
jim_thompson5910(13794)
:
View Source
,
Show
,
Put on YOUR site
About jim_thompson5910
:
==section input This solver will show you how to convert mixed fractions to improper fractions. Also, it will show you how to convert an improper fractions to a mixed fractions. Choose which fractions you want to convert: *[choice method mixed-fraction-to-improper-fraction improper-fraction-to-mixed-fraction] <b>Mixed Fractions to Improper Fractions</b> If you want to convert a mixed fraction to an improper fraction (for example {{{1&1/2}}} to {{{3/2}}}) then enter the given mixed fraction (make sure to choose the first choice of the drop box)<table> <tr><td rowspan="2">*[input whole=1]</td> <td>*[input mixed_num=1]</td></tr> <tr><td>*[input mixed_denom=2]</td></tr> </table>OR.... <b>Improper Fractions to Mixed Fractions</b> If you want to convert from an improper fraction to a mixed fraction (eg {{{5/4}}} ---> {{{1&1/4}}}), enter the improper fraction (make sure to choose the second choice of the drop box)<table> <tr><td>*[input imp_num=5]</td></tr> <tr><td>*[input imp_denom=4]</td></tr> </table>Note: Enter whole numbers only into each box (no decimals or fractions in any one box) ==section solution perl ### -------------------------- Mixed to Improper if($method eq "mixed-fraction-to-improper-fraction") { my $temp=$whole; $temp=~s/\-//g; ## Error checking (Mixed Number) if((($mixed_num=~m/\D/)||($mixed_denom=~m/\D/))||($temp=~m/\D/)) { print "<br><font color=red>Error: Please enter numerical values only</font><br>"; return; } print "<h4>Mixed Fractions to Improper Fractions</h4>"; print "<br>Remember, mixed fractions (or mixed numbers) are of the form:<br>"; print "<br><pre>"; print "<br> numerator"; print "<br>whole part ----------------"; print "<br> denominator"; print "<br></pre>"; print "<br>So we can see that: {{{whole_part=$whole}}}, {{{numerator=$mixed_num}}}, and {{{denominator=$mixed_denom}}}<br>"; print "<br>Now follow these steps to convert the mixed fraction to an improper fraction<br>"; my $temp_product=$whole*$mixed_denom; my $temp_sum; print "<br>Step 1) First, multiply the whole part {{{$whole}}} by the denominator {{{$mixed_denom}}} to get {{{$whole*$mixed_denom=$temp_product}}}.<br>"; if($whole=~m/\-/) { $temp_sum=$temp_product-$mixed_num; print "<br>Step 2) Now subtract the numerator {{{$mixed_num}}} from that result to get {{{$temp_product-$mixed_num=$temp_sum}}}. This result is the new numerator. The denominator will remain the same.<br>"; } else { $temp_sum=$temp_product+$mixed_num; print "<br>Step 2) Now add that result to the numerator {{{$mixed_num}}} to get {{{$temp_product+$mixed_num=$temp_sum}}}. This result is the new numerator. The denominator will remain the same.<br>"; } print "<br>Step 3) Place the new numerator {{{$temp_sum}}} over the original denominator {{{$mixed_denom}}} to get {{{$temp_sum/$mixed_denom}}}<br>"; print "<br>=============================<br>"; print "<br>Answer:<br>"; #print "<br>So the mixed number {{{$whole&$mixed_num/$mixed_denom}}} converts to the improper fraction {{{($temp_sum)/($mixed_denom)}}} <br>"; print "<br>So, {{{$whole&$mixed_num/$mixed_denom=$temp_sum/$mixed_denom}}}"; } ## improper to mixed elsif($method eq "improper-fraction-to-mixed-fraction") { my $temp=$imp_num; $temp=~s/\-//g; ## Error checking (Improper) if($temp=~m/\D/||$imp_denom=~m/\D/) { print "<br><font color=red>Error: Please enter numerical values only</font><br>"; return; } my $new_whole=int($imp_num/$imp_denom); my $remainder=$imp_num-$new_whole*$imp_denom; my $temp_num=$new_whole*$imp_denom; print "<br>{{{$imp_num/$imp_denom}}} Start with the given improper fraction.<br>"; print "<br>{{{($temp_num+$remainder)/$imp_denom}}} Break up {{{$imp_num}}} to get {{{$temp_num+$remainder}}}. Note: Make sure that the first number is a multiple of the denominator {{{$imp_denom}}}<br>"; print "<br>{{{$temp_num/$imp_denom+$remainder/$imp_denom}}} Break up the fraction. Make sure that the first number is a multiple of the denominator {{{$imp_denom}}}<br>"; print "<br>{{{$new_whole+$remainder/$imp_denom}}} Reduce<br>"; if($imp_num=~m/\-/) { $remainder=~s/\-//g; print "<br>{{{-($new_whole+$remainder/$imp_denom)}}} Factor out a -1<br>"; } print "<br>=============================<br>"; print "<br>Answer:<br>"; print "<br>So, {{{$imp_num/$imp_denom=$new_whole&$remainder/$imp_denom}}}"; } ==section output ==section check