Raise a table of pre-existing data to the power of of one of the variables

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












NOTE: I have edited this question to give a table whose first elements don't count up from 0 to 5.



I'm using a sample table here, given by Table[a/b + a^(1/2), b, 1, 6, a, 1, 6] - simply because it's small and easy. This gives me the following data:



testtable1 = 2, 2 + Sqrt[2], 3 + Sqrt[3], 6, 5 + Sqrt[5], 
6 + Sqrt[6], 3/2, 1 + Sqrt[2], 3/2 + Sqrt[3], 4, 5/2 + Sqrt[5],
3 + Sqrt[6], 4/3, 2/3 + Sqrt[2], 1 + Sqrt[3], 10/3,
5/3 + Sqrt[5], 2 + Sqrt[6], 5/4, 1/2 + Sqrt[2], 3/4 + Sqrt[3], 3,
5/4 + Sqrt[5], 3/2 + Sqrt[6], 6/5, 2/5 + Sqrt[2], 3/5 + Sqrt[3],
14/5, 1 + Sqrt[5], 6/5 + Sqrt[6], 7/6, 1/3 + Sqrt[2],
1/2 + Sqrt[3], 8/3, 5/6 + Sqrt[5], 1 + Sqrt[6]


But now I want to raise that table to the power of b - without going back to create a new table. Of course, it's easy to say Table[(a/b + a^(1/2))^b, b, 1, 6, a, 1, 6] - but that's only because this is a simple table. I'm looking for an operation that I can apply generically to any testtable1, because the calculations involved in getting to my actual testtable1 are very big and very slow, and hit the error limits of Mathematica - i.e., they become inaccurate. So, I want to crunch the data I have already generated rather than modify the original calculation.



Is this possible? Maybe I need to turn testtable1 into a dataset? Pointers on how to tackle this would be much appreciated.







share|improve this question






















  • Do you prefer exact computations or is it okay to use (inexact) floating point numbers? The latter would speed up your calculations tremendously.
    – Henrik Schumacher
    Aug 29 at 9:07














up vote
3
down vote

favorite












NOTE: I have edited this question to give a table whose first elements don't count up from 0 to 5.



I'm using a sample table here, given by Table[a/b + a^(1/2), b, 1, 6, a, 1, 6] - simply because it's small and easy. This gives me the following data:



testtable1 = 2, 2 + Sqrt[2], 3 + Sqrt[3], 6, 5 + Sqrt[5], 
6 + Sqrt[6], 3/2, 1 + Sqrt[2], 3/2 + Sqrt[3], 4, 5/2 + Sqrt[5],
3 + Sqrt[6], 4/3, 2/3 + Sqrt[2], 1 + Sqrt[3], 10/3,
5/3 + Sqrt[5], 2 + Sqrt[6], 5/4, 1/2 + Sqrt[2], 3/4 + Sqrt[3], 3,
5/4 + Sqrt[5], 3/2 + Sqrt[6], 6/5, 2/5 + Sqrt[2], 3/5 + Sqrt[3],
14/5, 1 + Sqrt[5], 6/5 + Sqrt[6], 7/6, 1/3 + Sqrt[2],
1/2 + Sqrt[3], 8/3, 5/6 + Sqrt[5], 1 + Sqrt[6]


But now I want to raise that table to the power of b - without going back to create a new table. Of course, it's easy to say Table[(a/b + a^(1/2))^b, b, 1, 6, a, 1, 6] - but that's only because this is a simple table. I'm looking for an operation that I can apply generically to any testtable1, because the calculations involved in getting to my actual testtable1 are very big and very slow, and hit the error limits of Mathematica - i.e., they become inaccurate. So, I want to crunch the data I have already generated rather than modify the original calculation.



Is this possible? Maybe I need to turn testtable1 into a dataset? Pointers on how to tackle this would be much appreciated.







share|improve this question






















  • Do you prefer exact computations or is it okay to use (inexact) floating point numbers? The latter would speed up your calculations tremendously.
    – Henrik Schumacher
    Aug 29 at 9:07












up vote
3
down vote

favorite









up vote
3
down vote

favorite











NOTE: I have edited this question to give a table whose first elements don't count up from 0 to 5.



I'm using a sample table here, given by Table[a/b + a^(1/2), b, 1, 6, a, 1, 6] - simply because it's small and easy. This gives me the following data:



testtable1 = 2, 2 + Sqrt[2], 3 + Sqrt[3], 6, 5 + Sqrt[5], 
6 + Sqrt[6], 3/2, 1 + Sqrt[2], 3/2 + Sqrt[3], 4, 5/2 + Sqrt[5],
3 + Sqrt[6], 4/3, 2/3 + Sqrt[2], 1 + Sqrt[3], 10/3,
5/3 + Sqrt[5], 2 + Sqrt[6], 5/4, 1/2 + Sqrt[2], 3/4 + Sqrt[3], 3,
5/4 + Sqrt[5], 3/2 + Sqrt[6], 6/5, 2/5 + Sqrt[2], 3/5 + Sqrt[3],
14/5, 1 + Sqrt[5], 6/5 + Sqrt[6], 7/6, 1/3 + Sqrt[2],
1/2 + Sqrt[3], 8/3, 5/6 + Sqrt[5], 1 + Sqrt[6]


But now I want to raise that table to the power of b - without going back to create a new table. Of course, it's easy to say Table[(a/b + a^(1/2))^b, b, 1, 6, a, 1, 6] - but that's only because this is a simple table. I'm looking for an operation that I can apply generically to any testtable1, because the calculations involved in getting to my actual testtable1 are very big and very slow, and hit the error limits of Mathematica - i.e., they become inaccurate. So, I want to crunch the data I have already generated rather than modify the original calculation.



Is this possible? Maybe I need to turn testtable1 into a dataset? Pointers on how to tackle this would be much appreciated.







share|improve this question














NOTE: I have edited this question to give a table whose first elements don't count up from 0 to 5.



I'm using a sample table here, given by Table[a/b + a^(1/2), b, 1, 6, a, 1, 6] - simply because it's small and easy. This gives me the following data:



testtable1 = 2, 2 + Sqrt[2], 3 + Sqrt[3], 6, 5 + Sqrt[5], 
6 + Sqrt[6], 3/2, 1 + Sqrt[2], 3/2 + Sqrt[3], 4, 5/2 + Sqrt[5],
3 + Sqrt[6], 4/3, 2/3 + Sqrt[2], 1 + Sqrt[3], 10/3,
5/3 + Sqrt[5], 2 + Sqrt[6], 5/4, 1/2 + Sqrt[2], 3/4 + Sqrt[3], 3,
5/4 + Sqrt[5], 3/2 + Sqrt[6], 6/5, 2/5 + Sqrt[2], 3/5 + Sqrt[3],
14/5, 1 + Sqrt[5], 6/5 + Sqrt[6], 7/6, 1/3 + Sqrt[2],
1/2 + Sqrt[3], 8/3, 5/6 + Sqrt[5], 1 + Sqrt[6]


But now I want to raise that table to the power of b - without going back to create a new table. Of course, it's easy to say Table[(a/b + a^(1/2))^b, b, 1, 6, a, 1, 6] - but that's only because this is a simple table. I'm looking for an operation that I can apply generically to any testtable1, because the calculations involved in getting to my actual testtable1 are very big and very slow, and hit the error limits of Mathematica - i.e., they become inaccurate. So, I want to crunch the data I have already generated rather than modify the original calculation.



Is this possible? Maybe I need to turn testtable1 into a dataset? Pointers on how to tackle this would be much appreciated.









share|improve this question













share|improve this question




share|improve this question








edited Aug 29 at 9:03

























asked Aug 29 at 8:31









Richard Burke-Ward

1827




1827











  • Do you prefer exact computations or is it okay to use (inexact) floating point numbers? The latter would speed up your calculations tremendously.
    – Henrik Schumacher
    Aug 29 at 9:07
















  • Do you prefer exact computations or is it okay to use (inexact) floating point numbers? The latter would speed up your calculations tremendously.
    – Henrik Schumacher
    Aug 29 at 9:07















Do you prefer exact computations or is it okay to use (inexact) floating point numbers? The latter would speed up your calculations tremendously.
– Henrik Schumacher
Aug 29 at 9:07




Do you prefer exact computations or is it okay to use (inexact) floating point numbers? The latter would speed up your calculations tremendously.
– Henrik Schumacher
Aug 29 at 9:07










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










Suppose you generate you table equivalently by



alist = Range[1, 6];
blist = Range[1, 6];
testtable1 = Table[a/b + a^(1/2), b, blist, a, alist];


Then



Table[(a/b + a^(1/2))^b, b, blist, a, alist]


can be obtained also by



testtable1^blist


and



Table[(a/b + a^(1/2))^a, b, blist, a, alist]


can be obtained by



testtable1^ConstantArray[alist, Length[blist]]


The key observation is that ^ (a.k.a. Power) has the attribute Listable.



For a preexisting table



testtable2 = RandomReal[-1, 1, 1000, 2000];


the following should raise each row to the power of its row count:



poweredbyrow = testtable2^Range[1, Length[testtable2]];


The same for powering by column number:



poweredbycol = 
testtable2^ConstantArray[
Range[1, Dimensions[testtable2][[2]]],
Length[testtable2]
];





share|improve this answer






















  • Correct me if I'm wrong, but this solution essentially relies on the fact that the first item in each entry in the table counts up from 0 to 5 - in which case, I gave a poor example, because that's not necessarily the case... I'll edit the original post.
    – Richard Burke-Ward
    Aug 29 at 8:58










  • Well, if you generate your table by a = RandomReal[-1, 1, 1000]; b = RandomReal[-1, 1, 2000]; testtable1 = Outer[Plus, b, a];, then you can use testtable1^b;. Btw.: Using the list a as powers can be done as follows: testtable1^ConstantArray[a, Length[b]];
    – Henrik Schumacher
    Aug 29 at 9:01











  • Hi Henrik (again!). Thanks for helping. This is really useful, but again it's dependent on the specific nature of the table. My situation is that I have a very big pre-existing array/table of data, defined only by its name. I want to raise each row to the power of the number of that row. Row 5, raise to the power of 5; row 2, raise to the power of 2...
    – Richard Burke-Ward
    Aug 29 at 9:09










  • Dear Richard, always at your service ;) I exanded my answer. Does it help you?
    – Henrik Schumacher
    Aug 29 at 9:15










  • Thanks again, Henrik. It's going to take me a bit of time to wade through that. I'm sure it's exactly right, but I need to go all the way back to my original calculations, and figure out each step of your cunning plan :-). I'll mark as answered after that, but would you mind checking back in, say, half an hour just to see if I have any further questions? Really appreciate your help.
    – Richard Burke-Ward
    Aug 29 at 9:18

















up vote
3
down vote













row $k$ raised to the power $k$:



MapIndexed[#^#2[[1]] &, testtable1, 1] // MatrixForm // TeXForm



$left(
beginarraycccccc
2 & 2+sqrt2 & 3+sqrt3 & 6 & 5+sqrt5 & 6+sqrt6 \
frac94 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^2 & 16 & left(frac52+sqrt5right)^2 &
left(3+sqrt6right)^2 \
frac6427 & left(frac23+sqrt2right)^3 & left(1+sqrt3right)^3 & frac100027 &
left(frac53+sqrt5right)^3 & left(2+sqrt6right)^3 \
frac625256 & left(frac12+sqrt2right)^4 & left(frac34+sqrt3right)^4 & 81 &
left(frac54+sqrt5right)^4 & left(frac32+sqrt6right)^4 \
frac77763125 & left(frac25+sqrt2right)^5 & left(frac35+sqrt3right)^5 & frac5378243125 &
left(1+sqrt5right)^5 & left(frac65+sqrt6right)^5 \
frac11764946656 & left(frac13+sqrt2right)^6 & left(frac12+sqrt3right)^6 & frac262144729 &
left(frac56+sqrt5right)^6 & left(1+sqrt6right)^6 \
endarray
right)$




column $k$ raised to the power $k$:



MapIndexed[#^#2[[2]] &, testtable1, 2] // MatrixForm // TeXForm



$left(
beginarraycccccc
2 & left(2+sqrt2right)^2 & left(3+sqrt3right)^3 & 1296 & left(5+sqrt5right)^5 & left(6+sqrt6right)^6
\
frac32 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^3 & 256 & left(frac52+sqrt5right)^5
& left(3+sqrt6right)^6 \
frac43 & left(frac23+sqrt2right)^2 & left(1+sqrt3right)^3 & frac1000081 &
left(frac53+sqrt5right)^5 & left(2+sqrt6right)^6 \
frac54 & left(frac12+sqrt2right)^2 & left(frac34+sqrt3right)^3 & 81 &
left(frac54+sqrt5right)^5 & left(frac32+sqrt6right)^6 \
frac65 & left(frac25+sqrt2right)^2 & left(frac35+sqrt3right)^3 & frac38416625 &
left(1+sqrt5right)^5 & left(frac65+sqrt6right)^6 \
frac76 & left(frac13+sqrt2right)^2 & left(frac12+sqrt3right)^3 & frac409681 &
left(frac56+sqrt5right)^5 & left(1+sqrt6right)^6 \
endarray
right) $




Also:



Transpose @ MapIndexed[#^#2[[1]] &, Transpose @ testtable1, 1]



same result







share|improve this answer






















    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f180831%2fraise-a-table-of-pre-existing-data-to-the-power-of-of-one-of-the-variables%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    Suppose you generate you table equivalently by



    alist = Range[1, 6];
    blist = Range[1, 6];
    testtable1 = Table[a/b + a^(1/2), b, blist, a, alist];


    Then



    Table[(a/b + a^(1/2))^b, b, blist, a, alist]


    can be obtained also by



    testtable1^blist


    and



    Table[(a/b + a^(1/2))^a, b, blist, a, alist]


    can be obtained by



    testtable1^ConstantArray[alist, Length[blist]]


    The key observation is that ^ (a.k.a. Power) has the attribute Listable.



    For a preexisting table



    testtable2 = RandomReal[-1, 1, 1000, 2000];


    the following should raise each row to the power of its row count:



    poweredbyrow = testtable2^Range[1, Length[testtable2]];


    The same for powering by column number:



    poweredbycol = 
    testtable2^ConstantArray[
    Range[1, Dimensions[testtable2][[2]]],
    Length[testtable2]
    ];





    share|improve this answer






















    • Correct me if I'm wrong, but this solution essentially relies on the fact that the first item in each entry in the table counts up from 0 to 5 - in which case, I gave a poor example, because that's not necessarily the case... I'll edit the original post.
      – Richard Burke-Ward
      Aug 29 at 8:58










    • Well, if you generate your table by a = RandomReal[-1, 1, 1000]; b = RandomReal[-1, 1, 2000]; testtable1 = Outer[Plus, b, a];, then you can use testtable1^b;. Btw.: Using the list a as powers can be done as follows: testtable1^ConstantArray[a, Length[b]];
      – Henrik Schumacher
      Aug 29 at 9:01











    • Hi Henrik (again!). Thanks for helping. This is really useful, but again it's dependent on the specific nature of the table. My situation is that I have a very big pre-existing array/table of data, defined only by its name. I want to raise each row to the power of the number of that row. Row 5, raise to the power of 5; row 2, raise to the power of 2...
      – Richard Burke-Ward
      Aug 29 at 9:09










    • Dear Richard, always at your service ;) I exanded my answer. Does it help you?
      – Henrik Schumacher
      Aug 29 at 9:15










    • Thanks again, Henrik. It's going to take me a bit of time to wade through that. I'm sure it's exactly right, but I need to go all the way back to my original calculations, and figure out each step of your cunning plan :-). I'll mark as answered after that, but would you mind checking back in, say, half an hour just to see if I have any further questions? Really appreciate your help.
      – Richard Burke-Ward
      Aug 29 at 9:18














    up vote
    2
    down vote



    accepted










    Suppose you generate you table equivalently by



    alist = Range[1, 6];
    blist = Range[1, 6];
    testtable1 = Table[a/b + a^(1/2), b, blist, a, alist];


    Then



    Table[(a/b + a^(1/2))^b, b, blist, a, alist]


    can be obtained also by



    testtable1^blist


    and



    Table[(a/b + a^(1/2))^a, b, blist, a, alist]


    can be obtained by



    testtable1^ConstantArray[alist, Length[blist]]


    The key observation is that ^ (a.k.a. Power) has the attribute Listable.



    For a preexisting table



    testtable2 = RandomReal[-1, 1, 1000, 2000];


    the following should raise each row to the power of its row count:



    poweredbyrow = testtable2^Range[1, Length[testtable2]];


    The same for powering by column number:



    poweredbycol = 
    testtable2^ConstantArray[
    Range[1, Dimensions[testtable2][[2]]],
    Length[testtable2]
    ];





    share|improve this answer






















    • Correct me if I'm wrong, but this solution essentially relies on the fact that the first item in each entry in the table counts up from 0 to 5 - in which case, I gave a poor example, because that's not necessarily the case... I'll edit the original post.
      – Richard Burke-Ward
      Aug 29 at 8:58










    • Well, if you generate your table by a = RandomReal[-1, 1, 1000]; b = RandomReal[-1, 1, 2000]; testtable1 = Outer[Plus, b, a];, then you can use testtable1^b;. Btw.: Using the list a as powers can be done as follows: testtable1^ConstantArray[a, Length[b]];
      – Henrik Schumacher
      Aug 29 at 9:01











    • Hi Henrik (again!). Thanks for helping. This is really useful, but again it's dependent on the specific nature of the table. My situation is that I have a very big pre-existing array/table of data, defined only by its name. I want to raise each row to the power of the number of that row. Row 5, raise to the power of 5; row 2, raise to the power of 2...
      – Richard Burke-Ward
      Aug 29 at 9:09










    • Dear Richard, always at your service ;) I exanded my answer. Does it help you?
      – Henrik Schumacher
      Aug 29 at 9:15










    • Thanks again, Henrik. It's going to take me a bit of time to wade through that. I'm sure it's exactly right, but I need to go all the way back to my original calculations, and figure out each step of your cunning plan :-). I'll mark as answered after that, but would you mind checking back in, say, half an hour just to see if I have any further questions? Really appreciate your help.
      – Richard Burke-Ward
      Aug 29 at 9:18












    up vote
    2
    down vote



    accepted







    up vote
    2
    down vote



    accepted






    Suppose you generate you table equivalently by



    alist = Range[1, 6];
    blist = Range[1, 6];
    testtable1 = Table[a/b + a^(1/2), b, blist, a, alist];


    Then



    Table[(a/b + a^(1/2))^b, b, blist, a, alist]


    can be obtained also by



    testtable1^blist


    and



    Table[(a/b + a^(1/2))^a, b, blist, a, alist]


    can be obtained by



    testtable1^ConstantArray[alist, Length[blist]]


    The key observation is that ^ (a.k.a. Power) has the attribute Listable.



    For a preexisting table



    testtable2 = RandomReal[-1, 1, 1000, 2000];


    the following should raise each row to the power of its row count:



    poweredbyrow = testtable2^Range[1, Length[testtable2]];


    The same for powering by column number:



    poweredbycol = 
    testtable2^ConstantArray[
    Range[1, Dimensions[testtable2][[2]]],
    Length[testtable2]
    ];





    share|improve this answer














    Suppose you generate you table equivalently by



    alist = Range[1, 6];
    blist = Range[1, 6];
    testtable1 = Table[a/b + a^(1/2), b, blist, a, alist];


    Then



    Table[(a/b + a^(1/2))^b, b, blist, a, alist]


    can be obtained also by



    testtable1^blist


    and



    Table[(a/b + a^(1/2))^a, b, blist, a, alist]


    can be obtained by



    testtable1^ConstantArray[alist, Length[blist]]


    The key observation is that ^ (a.k.a. Power) has the attribute Listable.



    For a preexisting table



    testtable2 = RandomReal[-1, 1, 1000, 2000];


    the following should raise each row to the power of its row count:



    poweredbyrow = testtable2^Range[1, Length[testtable2]];


    The same for powering by column number:



    poweredbycol = 
    testtable2^ConstantArray[
    Range[1, Dimensions[testtable2][[2]]],
    Length[testtable2]
    ];






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 29 at 9:10

























    answered Aug 29 at 8:43









    Henrik Schumacher

    36.7k249103




    36.7k249103











    • Correct me if I'm wrong, but this solution essentially relies on the fact that the first item in each entry in the table counts up from 0 to 5 - in which case, I gave a poor example, because that's not necessarily the case... I'll edit the original post.
      – Richard Burke-Ward
      Aug 29 at 8:58










    • Well, if you generate your table by a = RandomReal[-1, 1, 1000]; b = RandomReal[-1, 1, 2000]; testtable1 = Outer[Plus, b, a];, then you can use testtable1^b;. Btw.: Using the list a as powers can be done as follows: testtable1^ConstantArray[a, Length[b]];
      – Henrik Schumacher
      Aug 29 at 9:01











    • Hi Henrik (again!). Thanks for helping. This is really useful, but again it's dependent on the specific nature of the table. My situation is that I have a very big pre-existing array/table of data, defined only by its name. I want to raise each row to the power of the number of that row. Row 5, raise to the power of 5; row 2, raise to the power of 2...
      – Richard Burke-Ward
      Aug 29 at 9:09










    • Dear Richard, always at your service ;) I exanded my answer. Does it help you?
      – Henrik Schumacher
      Aug 29 at 9:15










    • Thanks again, Henrik. It's going to take me a bit of time to wade through that. I'm sure it's exactly right, but I need to go all the way back to my original calculations, and figure out each step of your cunning plan :-). I'll mark as answered after that, but would you mind checking back in, say, half an hour just to see if I have any further questions? Really appreciate your help.
      – Richard Burke-Ward
      Aug 29 at 9:18
















    • Correct me if I'm wrong, but this solution essentially relies on the fact that the first item in each entry in the table counts up from 0 to 5 - in which case, I gave a poor example, because that's not necessarily the case... I'll edit the original post.
      – Richard Burke-Ward
      Aug 29 at 8:58










    • Well, if you generate your table by a = RandomReal[-1, 1, 1000]; b = RandomReal[-1, 1, 2000]; testtable1 = Outer[Plus, b, a];, then you can use testtable1^b;. Btw.: Using the list a as powers can be done as follows: testtable1^ConstantArray[a, Length[b]];
      – Henrik Schumacher
      Aug 29 at 9:01











    • Hi Henrik (again!). Thanks for helping. This is really useful, but again it's dependent on the specific nature of the table. My situation is that I have a very big pre-existing array/table of data, defined only by its name. I want to raise each row to the power of the number of that row. Row 5, raise to the power of 5; row 2, raise to the power of 2...
      – Richard Burke-Ward
      Aug 29 at 9:09










    • Dear Richard, always at your service ;) I exanded my answer. Does it help you?
      – Henrik Schumacher
      Aug 29 at 9:15










    • Thanks again, Henrik. It's going to take me a bit of time to wade through that. I'm sure it's exactly right, but I need to go all the way back to my original calculations, and figure out each step of your cunning plan :-). I'll mark as answered after that, but would you mind checking back in, say, half an hour just to see if I have any further questions? Really appreciate your help.
      – Richard Burke-Ward
      Aug 29 at 9:18















    Correct me if I'm wrong, but this solution essentially relies on the fact that the first item in each entry in the table counts up from 0 to 5 - in which case, I gave a poor example, because that's not necessarily the case... I'll edit the original post.
    – Richard Burke-Ward
    Aug 29 at 8:58




    Correct me if I'm wrong, but this solution essentially relies on the fact that the first item in each entry in the table counts up from 0 to 5 - in which case, I gave a poor example, because that's not necessarily the case... I'll edit the original post.
    – Richard Burke-Ward
    Aug 29 at 8:58












    Well, if you generate your table by a = RandomReal[-1, 1, 1000]; b = RandomReal[-1, 1, 2000]; testtable1 = Outer[Plus, b, a];, then you can use testtable1^b;. Btw.: Using the list a as powers can be done as follows: testtable1^ConstantArray[a, Length[b]];
    – Henrik Schumacher
    Aug 29 at 9:01





    Well, if you generate your table by a = RandomReal[-1, 1, 1000]; b = RandomReal[-1, 1, 2000]; testtable1 = Outer[Plus, b, a];, then you can use testtable1^b;. Btw.: Using the list a as powers can be done as follows: testtable1^ConstantArray[a, Length[b]];
    – Henrik Schumacher
    Aug 29 at 9:01













    Hi Henrik (again!). Thanks for helping. This is really useful, but again it's dependent on the specific nature of the table. My situation is that I have a very big pre-existing array/table of data, defined only by its name. I want to raise each row to the power of the number of that row. Row 5, raise to the power of 5; row 2, raise to the power of 2...
    – Richard Burke-Ward
    Aug 29 at 9:09




    Hi Henrik (again!). Thanks for helping. This is really useful, but again it's dependent on the specific nature of the table. My situation is that I have a very big pre-existing array/table of data, defined only by its name. I want to raise each row to the power of the number of that row. Row 5, raise to the power of 5; row 2, raise to the power of 2...
    – Richard Burke-Ward
    Aug 29 at 9:09












    Dear Richard, always at your service ;) I exanded my answer. Does it help you?
    – Henrik Schumacher
    Aug 29 at 9:15




    Dear Richard, always at your service ;) I exanded my answer. Does it help you?
    – Henrik Schumacher
    Aug 29 at 9:15












    Thanks again, Henrik. It's going to take me a bit of time to wade through that. I'm sure it's exactly right, but I need to go all the way back to my original calculations, and figure out each step of your cunning plan :-). I'll mark as answered after that, but would you mind checking back in, say, half an hour just to see if I have any further questions? Really appreciate your help.
    – Richard Burke-Ward
    Aug 29 at 9:18




    Thanks again, Henrik. It's going to take me a bit of time to wade through that. I'm sure it's exactly right, but I need to go all the way back to my original calculations, and figure out each step of your cunning plan :-). I'll mark as answered after that, but would you mind checking back in, say, half an hour just to see if I have any further questions? Really appreciate your help.
    – Richard Burke-Ward
    Aug 29 at 9:18










    up vote
    3
    down vote













    row $k$ raised to the power $k$:



    MapIndexed[#^#2[[1]] &, testtable1, 1] // MatrixForm // TeXForm



    $left(
    beginarraycccccc
    2 & 2+sqrt2 & 3+sqrt3 & 6 & 5+sqrt5 & 6+sqrt6 \
    frac94 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^2 & 16 & left(frac52+sqrt5right)^2 &
    left(3+sqrt6right)^2 \
    frac6427 & left(frac23+sqrt2right)^3 & left(1+sqrt3right)^3 & frac100027 &
    left(frac53+sqrt5right)^3 & left(2+sqrt6right)^3 \
    frac625256 & left(frac12+sqrt2right)^4 & left(frac34+sqrt3right)^4 & 81 &
    left(frac54+sqrt5right)^4 & left(frac32+sqrt6right)^4 \
    frac77763125 & left(frac25+sqrt2right)^5 & left(frac35+sqrt3right)^5 & frac5378243125 &
    left(1+sqrt5right)^5 & left(frac65+sqrt6right)^5 \
    frac11764946656 & left(frac13+sqrt2right)^6 & left(frac12+sqrt3right)^6 & frac262144729 &
    left(frac56+sqrt5right)^6 & left(1+sqrt6right)^6 \
    endarray
    right)$




    column $k$ raised to the power $k$:



    MapIndexed[#^#2[[2]] &, testtable1, 2] // MatrixForm // TeXForm



    $left(
    beginarraycccccc
    2 & left(2+sqrt2right)^2 & left(3+sqrt3right)^3 & 1296 & left(5+sqrt5right)^5 & left(6+sqrt6right)^6
    \
    frac32 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^3 & 256 & left(frac52+sqrt5right)^5
    & left(3+sqrt6right)^6 \
    frac43 & left(frac23+sqrt2right)^2 & left(1+sqrt3right)^3 & frac1000081 &
    left(frac53+sqrt5right)^5 & left(2+sqrt6right)^6 \
    frac54 & left(frac12+sqrt2right)^2 & left(frac34+sqrt3right)^3 & 81 &
    left(frac54+sqrt5right)^5 & left(frac32+sqrt6right)^6 \
    frac65 & left(frac25+sqrt2right)^2 & left(frac35+sqrt3right)^3 & frac38416625 &
    left(1+sqrt5right)^5 & left(frac65+sqrt6right)^6 \
    frac76 & left(frac13+sqrt2right)^2 & left(frac12+sqrt3right)^3 & frac409681 &
    left(frac56+sqrt5right)^5 & left(1+sqrt6right)^6 \
    endarray
    right) $




    Also:



    Transpose @ MapIndexed[#^#2[[1]] &, Transpose @ testtable1, 1]



    same result







    share|improve this answer


























      up vote
      3
      down vote













      row $k$ raised to the power $k$:



      MapIndexed[#^#2[[1]] &, testtable1, 1] // MatrixForm // TeXForm



      $left(
      beginarraycccccc
      2 & 2+sqrt2 & 3+sqrt3 & 6 & 5+sqrt5 & 6+sqrt6 \
      frac94 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^2 & 16 & left(frac52+sqrt5right)^2 &
      left(3+sqrt6right)^2 \
      frac6427 & left(frac23+sqrt2right)^3 & left(1+sqrt3right)^3 & frac100027 &
      left(frac53+sqrt5right)^3 & left(2+sqrt6right)^3 \
      frac625256 & left(frac12+sqrt2right)^4 & left(frac34+sqrt3right)^4 & 81 &
      left(frac54+sqrt5right)^4 & left(frac32+sqrt6right)^4 \
      frac77763125 & left(frac25+sqrt2right)^5 & left(frac35+sqrt3right)^5 & frac5378243125 &
      left(1+sqrt5right)^5 & left(frac65+sqrt6right)^5 \
      frac11764946656 & left(frac13+sqrt2right)^6 & left(frac12+sqrt3right)^6 & frac262144729 &
      left(frac56+sqrt5right)^6 & left(1+sqrt6right)^6 \
      endarray
      right)$




      column $k$ raised to the power $k$:



      MapIndexed[#^#2[[2]] &, testtable1, 2] // MatrixForm // TeXForm



      $left(
      beginarraycccccc
      2 & left(2+sqrt2right)^2 & left(3+sqrt3right)^3 & 1296 & left(5+sqrt5right)^5 & left(6+sqrt6right)^6
      \
      frac32 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^3 & 256 & left(frac52+sqrt5right)^5
      & left(3+sqrt6right)^6 \
      frac43 & left(frac23+sqrt2right)^2 & left(1+sqrt3right)^3 & frac1000081 &
      left(frac53+sqrt5right)^5 & left(2+sqrt6right)^6 \
      frac54 & left(frac12+sqrt2right)^2 & left(frac34+sqrt3right)^3 & 81 &
      left(frac54+sqrt5right)^5 & left(frac32+sqrt6right)^6 \
      frac65 & left(frac25+sqrt2right)^2 & left(frac35+sqrt3right)^3 & frac38416625 &
      left(1+sqrt5right)^5 & left(frac65+sqrt6right)^6 \
      frac76 & left(frac13+sqrt2right)^2 & left(frac12+sqrt3right)^3 & frac409681 &
      left(frac56+sqrt5right)^5 & left(1+sqrt6right)^6 \
      endarray
      right) $




      Also:



      Transpose @ MapIndexed[#^#2[[1]] &, Transpose @ testtable1, 1]



      same result







      share|improve this answer
























        up vote
        3
        down vote










        up vote
        3
        down vote









        row $k$ raised to the power $k$:



        MapIndexed[#^#2[[1]] &, testtable1, 1] // MatrixForm // TeXForm



        $left(
        beginarraycccccc
        2 & 2+sqrt2 & 3+sqrt3 & 6 & 5+sqrt5 & 6+sqrt6 \
        frac94 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^2 & 16 & left(frac52+sqrt5right)^2 &
        left(3+sqrt6right)^2 \
        frac6427 & left(frac23+sqrt2right)^3 & left(1+sqrt3right)^3 & frac100027 &
        left(frac53+sqrt5right)^3 & left(2+sqrt6right)^3 \
        frac625256 & left(frac12+sqrt2right)^4 & left(frac34+sqrt3right)^4 & 81 &
        left(frac54+sqrt5right)^4 & left(frac32+sqrt6right)^4 \
        frac77763125 & left(frac25+sqrt2right)^5 & left(frac35+sqrt3right)^5 & frac5378243125 &
        left(1+sqrt5right)^5 & left(frac65+sqrt6right)^5 \
        frac11764946656 & left(frac13+sqrt2right)^6 & left(frac12+sqrt3right)^6 & frac262144729 &
        left(frac56+sqrt5right)^6 & left(1+sqrt6right)^6 \
        endarray
        right)$




        column $k$ raised to the power $k$:



        MapIndexed[#^#2[[2]] &, testtable1, 2] // MatrixForm // TeXForm



        $left(
        beginarraycccccc
        2 & left(2+sqrt2right)^2 & left(3+sqrt3right)^3 & 1296 & left(5+sqrt5right)^5 & left(6+sqrt6right)^6
        \
        frac32 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^3 & 256 & left(frac52+sqrt5right)^5
        & left(3+sqrt6right)^6 \
        frac43 & left(frac23+sqrt2right)^2 & left(1+sqrt3right)^3 & frac1000081 &
        left(frac53+sqrt5right)^5 & left(2+sqrt6right)^6 \
        frac54 & left(frac12+sqrt2right)^2 & left(frac34+sqrt3right)^3 & 81 &
        left(frac54+sqrt5right)^5 & left(frac32+sqrt6right)^6 \
        frac65 & left(frac25+sqrt2right)^2 & left(frac35+sqrt3right)^3 & frac38416625 &
        left(1+sqrt5right)^5 & left(frac65+sqrt6right)^6 \
        frac76 & left(frac13+sqrt2right)^2 & left(frac12+sqrt3right)^3 & frac409681 &
        left(frac56+sqrt5right)^5 & left(1+sqrt6right)^6 \
        endarray
        right) $




        Also:



        Transpose @ MapIndexed[#^#2[[1]] &, Transpose @ testtable1, 1]



        same result







        share|improve this answer














        row $k$ raised to the power $k$:



        MapIndexed[#^#2[[1]] &, testtable1, 1] // MatrixForm // TeXForm



        $left(
        beginarraycccccc
        2 & 2+sqrt2 & 3+sqrt3 & 6 & 5+sqrt5 & 6+sqrt6 \
        frac94 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^2 & 16 & left(frac52+sqrt5right)^2 &
        left(3+sqrt6right)^2 \
        frac6427 & left(frac23+sqrt2right)^3 & left(1+sqrt3right)^3 & frac100027 &
        left(frac53+sqrt5right)^3 & left(2+sqrt6right)^3 \
        frac625256 & left(frac12+sqrt2right)^4 & left(frac34+sqrt3right)^4 & 81 &
        left(frac54+sqrt5right)^4 & left(frac32+sqrt6right)^4 \
        frac77763125 & left(frac25+sqrt2right)^5 & left(frac35+sqrt3right)^5 & frac5378243125 &
        left(1+sqrt5right)^5 & left(frac65+sqrt6right)^5 \
        frac11764946656 & left(frac13+sqrt2right)^6 & left(frac12+sqrt3right)^6 & frac262144729 &
        left(frac56+sqrt5right)^6 & left(1+sqrt6right)^6 \
        endarray
        right)$




        column $k$ raised to the power $k$:



        MapIndexed[#^#2[[2]] &, testtable1, 2] // MatrixForm // TeXForm



        $left(
        beginarraycccccc
        2 & left(2+sqrt2right)^2 & left(3+sqrt3right)^3 & 1296 & left(5+sqrt5right)^5 & left(6+sqrt6right)^6
        \
        frac32 & left(1+sqrt2right)^2 & left(frac32+sqrt3right)^3 & 256 & left(frac52+sqrt5right)^5
        & left(3+sqrt6right)^6 \
        frac43 & left(frac23+sqrt2right)^2 & left(1+sqrt3right)^3 & frac1000081 &
        left(frac53+sqrt5right)^5 & left(2+sqrt6right)^6 \
        frac54 & left(frac12+sqrt2right)^2 & left(frac34+sqrt3right)^3 & 81 &
        left(frac54+sqrt5right)^5 & left(frac32+sqrt6right)^6 \
        frac65 & left(frac25+sqrt2right)^2 & left(frac35+sqrt3right)^3 & frac38416625 &
        left(1+sqrt5right)^5 & left(frac65+sqrt6right)^6 \
        frac76 & left(frac13+sqrt2right)^2 & left(frac12+sqrt3right)^3 & frac409681 &
        left(frac56+sqrt5right)^5 & left(1+sqrt6right)^6 \
        endarray
        right) $




        Also:



        Transpose @ MapIndexed[#^#2[[1]] &, Transpose @ testtable1, 1]



        same result








        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 29 at 9:30

























        answered Aug 29 at 8:42









        kglr

        158k8183382




        158k8183382



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f180831%2fraise-a-table-of-pre-existing-data-to-the-power-of-of-one-of-the-variables%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke