Turn the following values into percentage [on hold]












4














I have the following data:
{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}
{5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}
My data is already in Matrix form in Mathematica, is there a possibility to change the second raw into percentages? I want the first data: 5914 to be 100% and calculate how much did the data grow over the years based on the first year. So the last number should be: 324%.
How could this be done automatically and for a huge set of data?
Thank you!










share|improve this question









New contributor




user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey 3 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey

If this question can be reworded to fit the rules in the help center, please edit the question.













  • try this data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}; secondData = data[[2]]; secondData = IntegerPart[N[#*100/First[secondData]]]& /@ secondData; data[[2]] = secondData;
    – Xminer
    yesterday








  • 1




    Just divide your array with the first element? arr/First[arr]. You might want to go through some basic tutorials: wolfram.com/language/elementary-introduction/2nd-ed
    – Szabolcs
    yesterday
















4














I have the following data:
{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}
{5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}
My data is already in Matrix form in Mathematica, is there a possibility to change the second raw into percentages? I want the first data: 5914 to be 100% and calculate how much did the data grow over the years based on the first year. So the last number should be: 324%.
How could this be done automatically and for a huge set of data?
Thank you!










share|improve this question









New contributor




user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey 3 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey

If this question can be reworded to fit the rules in the help center, please edit the question.













  • try this data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}; secondData = data[[2]]; secondData = IntegerPart[N[#*100/First[secondData]]]& /@ secondData; data[[2]] = secondData;
    – Xminer
    yesterday








  • 1




    Just divide your array with the first element? arr/First[arr]. You might want to go through some basic tutorials: wolfram.com/language/elementary-introduction/2nd-ed
    – Szabolcs
    yesterday














4












4








4







I have the following data:
{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}
{5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}
My data is already in Matrix form in Mathematica, is there a possibility to change the second raw into percentages? I want the first data: 5914 to be 100% and calculate how much did the data grow over the years based on the first year. So the last number should be: 324%.
How could this be done automatically and for a huge set of data?
Thank you!










share|improve this question









New contributor




user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have the following data:
{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}
{5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}
My data is already in Matrix form in Mathematica, is there a possibility to change the second raw into percentages? I want the first data: 5914 to be 100% and calculate how much did the data grow over the years based on the first year. So the last number should be: 324%.
How could this be done automatically and for a huge set of data?
Thank you!







list-manipulation numerics






share|improve this question









New contributor




user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 13 hours ago









J. M. is computer-less

96k10300460




96k10300460






New contributor




user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









user62202

211




211




New contributor




user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user62202 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey 3 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey

If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey 3 hours ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, Thies Heidecke, Bob Hanlon, m_goldberg, bbgodfrey

If this question can be reworded to fit the rules in the help center, please edit the question.












  • try this data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}; secondData = data[[2]]; secondData = IntegerPart[N[#*100/First[secondData]]]& /@ secondData; data[[2]] = secondData;
    – Xminer
    yesterday








  • 1




    Just divide your array with the first element? arr/First[arr]. You might want to go through some basic tutorials: wolfram.com/language/elementary-introduction/2nd-ed
    – Szabolcs
    yesterday


















  • try this data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}; secondData = data[[2]]; secondData = IntegerPart[N[#*100/First[secondData]]]& /@ secondData; data[[2]] = secondData;
    – Xminer
    yesterday








  • 1




    Just divide your array with the first element? arr/First[arr]. You might want to go through some basic tutorials: wolfram.com/language/elementary-introduction/2nd-ed
    – Szabolcs
    yesterday
















try this data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}; secondData = data[[2]]; secondData = IntegerPart[N[#*100/First[secondData]]]& /@ secondData; data[[2]] = secondData;
– Xminer
yesterday






try this data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}; secondData = data[[2]]; secondData = IntegerPart[N[#*100/First[secondData]]]& /@ secondData; data[[2]] = secondData;
– Xminer
yesterday






1




1




Just divide your array with the first element? arr/First[arr]. You might want to go through some basic tutorials: wolfram.com/language/elementary-introduction/2nd-ed
– Szabolcs
yesterday




Just divide your array with the first element? arr/First[arr]. You might want to go through some basic tutorials: wolfram.com/language/elementary-introduction/2nd-ed
– Szabolcs
yesterday










3 Answers
3






active

oldest

votes


















6














(I get to show this first...)



data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
18800, 19216}};
{data[[1]], PercentForm[N[data[[2]]]/data[[2, 1]]]}


enter image description here



(...coming soon, in version 12)






share|improve this answer





















  • If I do NumberForm[100.,{4,1}] I get 100.0. And for NumberForm[312.,{4,1}] 312.0. It looks like that PercentForm[1.] gives 100% and PercentForm[3.12] results in 312.%. Is this just the usual sloppiness or will this be fixed ? Also, why do you have to use N? Shouldn't this be done automatically, at least if the default of PercentForm seems to be to print 1 digit to the right of the decimal point?
    – Rolf Mertig
    yesterday








  • 2




    @RolfMertig The decimal point disparity was a design choice (at the insistence of the boss), to only put in a decimal when the value does not coerce to an integer. As for using N, we opted not to coerce exact values, other than integers, into percentages. So that was also a design choice.
    – Daniel Lichtblau
    yesterday






  • 1




    Greetings to the boss: wrong design choice. It was always a pain to construct nicely aligned and consisent tables of real numbers. And what is even worse is that the documentation does not fit the behaviour of Mathematica anymore (at least in such type of details).I do remeber a time when the documentation coincided with the software (which was one reason I switched from Macsyma to Mathematica ...).
    – Rolf Mertig
    yesterday






  • 1




    @RolfMertig I agree the alignment of numbers is not always easy. But I don't see what exact fractions have to do with formatting reals. On the topic of formatting reals, DecimalForm has seen some fixes..
    – Daniel Lichtblau
    yesterday










  • What is coming soon in version 12?
    – Αλέξανδρος Ζεγγ
    19 hours ago



















5














data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143,6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}


There's no need to define additional variables,try



data[[2]] = 100 data[[2]]/data[[2, 1]]//Round[#,1]& (*//IntegerPart*)  ;
data
(*{{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
{100,103, 104, 304, 307, 310, 312, 312, 317, 324}}*)





share|improve this answer























  • In many applications, Round would be more appropriate than IntegerPart
    – Bob Hanlon
    yesterday










  • @ Bob Hanlon Thanks, you're right (but it is a liitle bit slower ;-) )
    – Ulrich Neumann
    yesterday












  • @Ulrich If it is about speed, I'd prefer data[[2]] = Round[data[[2]] (100. /data[[2, 1]]), 1]. The converts to machine precision numbers and reduces the number of scalar-vector multiplications from 2 to 1.
    – Henrik Schumacher
    yesterday










  • @ Henrik Thanks, my actual answer seems to be the power-version!
    – Ulrich Neumann
    yesterday



















1














Similar to the above:



k = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
2017} , {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
18800, 19216}}

k[[2]]=Flatten[Floor[100*Rest[k]/Flatten[Rest[k]][[1]]]]


Gives



{{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
{100, 103, 104, 304, 307, 310, 312, 312, 317, 324}}






share|improve this answer




























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    (I get to show this first...)



    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
    2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
    18800, 19216}};
    {data[[1]], PercentForm[N[data[[2]]]/data[[2, 1]]]}


    enter image description here



    (...coming soon, in version 12)






    share|improve this answer





















    • If I do NumberForm[100.,{4,1}] I get 100.0. And for NumberForm[312.,{4,1}] 312.0. It looks like that PercentForm[1.] gives 100% and PercentForm[3.12] results in 312.%. Is this just the usual sloppiness or will this be fixed ? Also, why do you have to use N? Shouldn't this be done automatically, at least if the default of PercentForm seems to be to print 1 digit to the right of the decimal point?
      – Rolf Mertig
      yesterday








    • 2




      @RolfMertig The decimal point disparity was a design choice (at the insistence of the boss), to only put in a decimal when the value does not coerce to an integer. As for using N, we opted not to coerce exact values, other than integers, into percentages. So that was also a design choice.
      – Daniel Lichtblau
      yesterday






    • 1




      Greetings to the boss: wrong design choice. It was always a pain to construct nicely aligned and consisent tables of real numbers. And what is even worse is that the documentation does not fit the behaviour of Mathematica anymore (at least in such type of details).I do remeber a time when the documentation coincided with the software (which was one reason I switched from Macsyma to Mathematica ...).
      – Rolf Mertig
      yesterday






    • 1




      @RolfMertig I agree the alignment of numbers is not always easy. But I don't see what exact fractions have to do with formatting reals. On the topic of formatting reals, DecimalForm has seen some fixes..
      – Daniel Lichtblau
      yesterday










    • What is coming soon in version 12?
      – Αλέξανδρος Ζεγγ
      19 hours ago
















    6














    (I get to show this first...)



    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
    2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
    18800, 19216}};
    {data[[1]], PercentForm[N[data[[2]]]/data[[2, 1]]]}


    enter image description here



    (...coming soon, in version 12)






    share|improve this answer





















    • If I do NumberForm[100.,{4,1}] I get 100.0. And for NumberForm[312.,{4,1}] 312.0. It looks like that PercentForm[1.] gives 100% and PercentForm[3.12] results in 312.%. Is this just the usual sloppiness or will this be fixed ? Also, why do you have to use N? Shouldn't this be done automatically, at least if the default of PercentForm seems to be to print 1 digit to the right of the decimal point?
      – Rolf Mertig
      yesterday








    • 2




      @RolfMertig The decimal point disparity was a design choice (at the insistence of the boss), to only put in a decimal when the value does not coerce to an integer. As for using N, we opted not to coerce exact values, other than integers, into percentages. So that was also a design choice.
      – Daniel Lichtblau
      yesterday






    • 1




      Greetings to the boss: wrong design choice. It was always a pain to construct nicely aligned and consisent tables of real numbers. And what is even worse is that the documentation does not fit the behaviour of Mathematica anymore (at least in such type of details).I do remeber a time when the documentation coincided with the software (which was one reason I switched from Macsyma to Mathematica ...).
      – Rolf Mertig
      yesterday






    • 1




      @RolfMertig I agree the alignment of numbers is not always easy. But I don't see what exact fractions have to do with formatting reals. On the topic of formatting reals, DecimalForm has seen some fixes..
      – Daniel Lichtblau
      yesterday










    • What is coming soon in version 12?
      – Αλέξανδρος Ζεγγ
      19 hours ago














    6












    6








    6






    (I get to show this first...)



    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
    2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
    18800, 19216}};
    {data[[1]], PercentForm[N[data[[2]]]/data[[2, 1]]]}


    enter image description here



    (...coming soon, in version 12)






    share|improve this answer












    (I get to show this first...)



    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
    2017}, {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
    18800, 19216}};
    {data[[1]], PercentForm[N[data[[2]]]/data[[2, 1]]]}


    enter image description here



    (...coming soon, in version 12)







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered yesterday









    Daniel Lichtblau

    46.5k275162




    46.5k275162












    • If I do NumberForm[100.,{4,1}] I get 100.0. And for NumberForm[312.,{4,1}] 312.0. It looks like that PercentForm[1.] gives 100% and PercentForm[3.12] results in 312.%. Is this just the usual sloppiness or will this be fixed ? Also, why do you have to use N? Shouldn't this be done automatically, at least if the default of PercentForm seems to be to print 1 digit to the right of the decimal point?
      – Rolf Mertig
      yesterday








    • 2




      @RolfMertig The decimal point disparity was a design choice (at the insistence of the boss), to only put in a decimal when the value does not coerce to an integer. As for using N, we opted not to coerce exact values, other than integers, into percentages. So that was also a design choice.
      – Daniel Lichtblau
      yesterday






    • 1




      Greetings to the boss: wrong design choice. It was always a pain to construct nicely aligned and consisent tables of real numbers. And what is even worse is that the documentation does not fit the behaviour of Mathematica anymore (at least in such type of details).I do remeber a time when the documentation coincided with the software (which was one reason I switched from Macsyma to Mathematica ...).
      – Rolf Mertig
      yesterday






    • 1




      @RolfMertig I agree the alignment of numbers is not always easy. But I don't see what exact fractions have to do with formatting reals. On the topic of formatting reals, DecimalForm has seen some fixes..
      – Daniel Lichtblau
      yesterday










    • What is coming soon in version 12?
      – Αλέξανδρος Ζεγγ
      19 hours ago


















    • If I do NumberForm[100.,{4,1}] I get 100.0. And for NumberForm[312.,{4,1}] 312.0. It looks like that PercentForm[1.] gives 100% and PercentForm[3.12] results in 312.%. Is this just the usual sloppiness or will this be fixed ? Also, why do you have to use N? Shouldn't this be done automatically, at least if the default of PercentForm seems to be to print 1 digit to the right of the decimal point?
      – Rolf Mertig
      yesterday








    • 2




      @RolfMertig The decimal point disparity was a design choice (at the insistence of the boss), to only put in a decimal when the value does not coerce to an integer. As for using N, we opted not to coerce exact values, other than integers, into percentages. So that was also a design choice.
      – Daniel Lichtblau
      yesterday






    • 1




      Greetings to the boss: wrong design choice. It was always a pain to construct nicely aligned and consisent tables of real numbers. And what is even worse is that the documentation does not fit the behaviour of Mathematica anymore (at least in such type of details).I do remeber a time when the documentation coincided with the software (which was one reason I switched from Macsyma to Mathematica ...).
      – Rolf Mertig
      yesterday






    • 1




      @RolfMertig I agree the alignment of numbers is not always easy. But I don't see what exact fractions have to do with formatting reals. On the topic of formatting reals, DecimalForm has seen some fixes..
      – Daniel Lichtblau
      yesterday










    • What is coming soon in version 12?
      – Αλέξανδρος Ζεγγ
      19 hours ago
















    If I do NumberForm[100.,{4,1}] I get 100.0. And for NumberForm[312.,{4,1}] 312.0. It looks like that PercentForm[1.] gives 100% and PercentForm[3.12] results in 312.%. Is this just the usual sloppiness or will this be fixed ? Also, why do you have to use N? Shouldn't this be done automatically, at least if the default of PercentForm seems to be to print 1 digit to the right of the decimal point?
    – Rolf Mertig
    yesterday






    If I do NumberForm[100.,{4,1}] I get 100.0. And for NumberForm[312.,{4,1}] 312.0. It looks like that PercentForm[1.] gives 100% and PercentForm[3.12] results in 312.%. Is this just the usual sloppiness or will this be fixed ? Also, why do you have to use N? Shouldn't this be done automatically, at least if the default of PercentForm seems to be to print 1 digit to the right of the decimal point?
    – Rolf Mertig
    yesterday






    2




    2




    @RolfMertig The decimal point disparity was a design choice (at the insistence of the boss), to only put in a decimal when the value does not coerce to an integer. As for using N, we opted not to coerce exact values, other than integers, into percentages. So that was also a design choice.
    – Daniel Lichtblau
    yesterday




    @RolfMertig The decimal point disparity was a design choice (at the insistence of the boss), to only put in a decimal when the value does not coerce to an integer. As for using N, we opted not to coerce exact values, other than integers, into percentages. So that was also a design choice.
    – Daniel Lichtblau
    yesterday




    1




    1




    Greetings to the boss: wrong design choice. It was always a pain to construct nicely aligned and consisent tables of real numbers. And what is even worse is that the documentation does not fit the behaviour of Mathematica anymore (at least in such type of details).I do remeber a time when the documentation coincided with the software (which was one reason I switched from Macsyma to Mathematica ...).
    – Rolf Mertig
    yesterday




    Greetings to the boss: wrong design choice. It was always a pain to construct nicely aligned and consisent tables of real numbers. And what is even worse is that the documentation does not fit the behaviour of Mathematica anymore (at least in such type of details).I do remeber a time when the documentation coincided with the software (which was one reason I switched from Macsyma to Mathematica ...).
    – Rolf Mertig
    yesterday




    1




    1




    @RolfMertig I agree the alignment of numbers is not always easy. But I don't see what exact fractions have to do with formatting reals. On the topic of formatting reals, DecimalForm has seen some fixes..
    – Daniel Lichtblau
    yesterday




    @RolfMertig I agree the alignment of numbers is not always easy. But I don't see what exact fractions have to do with formatting reals. On the topic of formatting reals, DecimalForm has seen some fixes..
    – Daniel Lichtblau
    yesterday












    What is coming soon in version 12?
    – Αλέξανδρος Ζεγγ
    19 hours ago




    What is coming soon in version 12?
    – Αλέξανδρος Ζεγγ
    19 hours ago











    5














    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143,6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}


    There's no need to define additional variables,try



    data[[2]] = 100 data[[2]]/data[[2, 1]]//Round[#,1]& (*//IntegerPart*)  ;
    data
    (*{{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
    {100,103, 104, 304, 307, 310, 312, 312, 317, 324}}*)





    share|improve this answer























    • In many applications, Round would be more appropriate than IntegerPart
      – Bob Hanlon
      yesterday










    • @ Bob Hanlon Thanks, you're right (but it is a liitle bit slower ;-) )
      – Ulrich Neumann
      yesterday












    • @Ulrich If it is about speed, I'd prefer data[[2]] = Round[data[[2]] (100. /data[[2, 1]]), 1]. The converts to machine precision numbers and reduces the number of scalar-vector multiplications from 2 to 1.
      – Henrik Schumacher
      yesterday










    • @ Henrik Thanks, my actual answer seems to be the power-version!
      – Ulrich Neumann
      yesterday
















    5














    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143,6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}


    There's no need to define additional variables,try



    data[[2]] = 100 data[[2]]/data[[2, 1]]//Round[#,1]& (*//IntegerPart*)  ;
    data
    (*{{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
    {100,103, 104, 304, 307, 310, 312, 312, 317, 324}}*)





    share|improve this answer























    • In many applications, Round would be more appropriate than IntegerPart
      – Bob Hanlon
      yesterday










    • @ Bob Hanlon Thanks, you're right (but it is a liitle bit slower ;-) )
      – Ulrich Neumann
      yesterday












    • @Ulrich If it is about speed, I'd prefer data[[2]] = Round[data[[2]] (100. /data[[2, 1]]), 1]. The converts to machine precision numbers and reduces the number of scalar-vector multiplications from 2 to 1.
      – Henrik Schumacher
      yesterday










    • @ Henrik Thanks, my actual answer seems to be the power-version!
      – Ulrich Neumann
      yesterday














    5












    5








    5






    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143,6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}


    There's no need to define additional variables,try



    data[[2]] = 100 data[[2]]/data[[2, 1]]//Round[#,1]& (*//IntegerPart*)  ;
    data
    (*{{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
    {100,103, 104, 304, 307, 310, 312, 312, 317, 324}}*)





    share|improve this answer














    data = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017}, {5914, 6143,6182, 18000, 18173, 18344, 18454, 18506, 18800, 19216}}


    There's no need to define additional variables,try



    data[[2]] = 100 data[[2]]/data[[2, 1]]//Round[#,1]& (*//IntegerPart*)  ;
    data
    (*{{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
    {100,103, 104, 304, 307, 310, 312, 312, 317, 324}}*)






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday

























    answered yesterday









    Ulrich Neumann

    7,610516




    7,610516












    • In many applications, Round would be more appropriate than IntegerPart
      – Bob Hanlon
      yesterday










    • @ Bob Hanlon Thanks, you're right (but it is a liitle bit slower ;-) )
      – Ulrich Neumann
      yesterday












    • @Ulrich If it is about speed, I'd prefer data[[2]] = Round[data[[2]] (100. /data[[2, 1]]), 1]. The converts to machine precision numbers and reduces the number of scalar-vector multiplications from 2 to 1.
      – Henrik Schumacher
      yesterday










    • @ Henrik Thanks, my actual answer seems to be the power-version!
      – Ulrich Neumann
      yesterday


















    • In many applications, Round would be more appropriate than IntegerPart
      – Bob Hanlon
      yesterday










    • @ Bob Hanlon Thanks, you're right (but it is a liitle bit slower ;-) )
      – Ulrich Neumann
      yesterday












    • @Ulrich If it is about speed, I'd prefer data[[2]] = Round[data[[2]] (100. /data[[2, 1]]), 1]. The converts to machine precision numbers and reduces the number of scalar-vector multiplications from 2 to 1.
      – Henrik Schumacher
      yesterday










    • @ Henrik Thanks, my actual answer seems to be the power-version!
      – Ulrich Neumann
      yesterday
















    In many applications, Round would be more appropriate than IntegerPart
    – Bob Hanlon
    yesterday




    In many applications, Round would be more appropriate than IntegerPart
    – Bob Hanlon
    yesterday












    @ Bob Hanlon Thanks, you're right (but it is a liitle bit slower ;-) )
    – Ulrich Neumann
    yesterday






    @ Bob Hanlon Thanks, you're right (but it is a liitle bit slower ;-) )
    – Ulrich Neumann
    yesterday














    @Ulrich If it is about speed, I'd prefer data[[2]] = Round[data[[2]] (100. /data[[2, 1]]), 1]. The converts to machine precision numbers and reduces the number of scalar-vector multiplications from 2 to 1.
    – Henrik Schumacher
    yesterday




    @Ulrich If it is about speed, I'd prefer data[[2]] = Round[data[[2]] (100. /data[[2, 1]]), 1]. The converts to machine precision numbers and reduces the number of scalar-vector multiplications from 2 to 1.
    – Henrik Schumacher
    yesterday












    @ Henrik Thanks, my actual answer seems to be the power-version!
    – Ulrich Neumann
    yesterday




    @ Henrik Thanks, my actual answer seems to be the power-version!
    – Ulrich Neumann
    yesterday











    1














    Similar to the above:



    k = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
    2017} , {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
    18800, 19216}}

    k[[2]]=Flatten[Floor[100*Rest[k]/Flatten[Rest[k]][[1]]]]


    Gives



    {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
    {100, 103, 104, 304, 307, 310, 312, 312, 317, 324}}






    share|improve this answer


























      1














      Similar to the above:



      k = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
      2017} , {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
      18800, 19216}}

      k[[2]]=Flatten[Floor[100*Rest[k]/Flatten[Rest[k]][[1]]]]


      Gives



      {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
      {100, 103, 104, 304, 307, 310, 312, 312, 317, 324}}






      share|improve this answer
























        1












        1








        1






        Similar to the above:



        k = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
        2017} , {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
        18800, 19216}}

        k[[2]]=Flatten[Floor[100*Rest[k]/Flatten[Rest[k]][[1]]]]


        Gives



        {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
        {100, 103, 104, 304, 307, 310, 312, 312, 317, 324}}






        share|improve this answer












        Similar to the above:



        k = {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 
        2017} , {5914, 6143, 6182, 18000, 18173, 18344, 18454, 18506,
        18800, 19216}}

        k[[2]]=Flatten[Floor[100*Rest[k]/Flatten[Rest[k]][[1]]]]


        Gives



        {{2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017},
        {100, 103, 104, 304, 307, 310, 312, 312, 317, 324}}







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        GerardF123

        1447




        1447















            Popular posts from this blog

            An IMO inspired problem

            Management

            Investment