How to create table with 2D function values?Calling Table with custom iteratorHow to create a Table of Tables with indexed variablesInstruct a Table to only evaluate until a condition is fulfilledCreate a table with inline conditionsHow could I make an Excel-like table?Exclude Infinite Value in Tableremove unevaluated cells from tableCreate a table indexed form a list giving a the index specificationsTable with conditionsCumulative total of columns in a matrix or table

Is balancing necessary on a full-wheel change?

Meaning of "individuandum"

What happens if I start too many background jobs?

I caught several of my students plagiarizing. Could it be my fault as a teacher?

What word means "to make something obsolete"?

Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?

Why was Germany not as successful as other Europeans in establishing overseas colonies?

Why is there a change in the number of degrees of freedom when the following modification is made?

I’ve officially counted to infinity!

If an enemy is just below a 10-foot-high ceiling, are they in melee range of a creature on the ground?

How to scale a verbatim environment on a minipage?

How to creep the reader out with what seems like a normal person?

Save terminal output to a txt file

Is it the same airport YUL and YMQ in Canada?

Can commander tax be proliferated?

Is it always OK to ask for a copy of the lecturer's slides?

Transfer over $10k

Is lying to get "gardening leave" fraud?

Junior developer struggles: how to communicate with management?

If 1. e4 c6 is considered as a sound defense for black, why is 1. c3 so rare?

Selecting a secure PIN for building access

Why is this a valid proof for the harmonic series?

Did we get closer to another plane than we were supposed to, or was the pilot just protecting our delicate sensibilities?

Applying a function to a nested list



How to create table with 2D function values?


Calling Table with custom iteratorHow to create a Table of Tables with indexed variablesInstruct a Table to only evaluate until a condition is fulfilledCreate a table with inline conditionsHow could I make an Excel-like table?Exclude Infinite Value in Tableremove unevaluated cells from tableCreate a table indexed form a list giving a the index specificationsTable with conditionsCumulative total of columns in a matrix or table













3












$begingroup$


Consider some function f[x,y]. I want to create a table in the form



table = x1,y1,f[x1,y1],x1,y2,f[x1,y2],...,x2,y1,f[x2,y1],x2,y2,f[x2,y2],...,


where $x_i,x_i+1$ and $y_i,y_i+1$ are separated by some distances $Delta x$, $Delta y$, and i ranges from 1 to some N.



The only way I know is to manually create a table



table=Join[Table[x1,y,f[x1,y],y,y1,yN,Deltay],Table[x2,y,f[x2,y],y,y1,yN,Deltay],...] 


However, this is not a smart way, especially for large N. Could you please provide some smarter way to build the table?










share|improve this question









$endgroup$







  • 1




    $begingroup$
    Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
    $endgroup$
    – Alexei Boulbitch
    Mar 22 at 14:32















3












$begingroup$


Consider some function f[x,y]. I want to create a table in the form



table = x1,y1,f[x1,y1],x1,y2,f[x1,y2],...,x2,y1,f[x2,y1],x2,y2,f[x2,y2],...,


where $x_i,x_i+1$ and $y_i,y_i+1$ are separated by some distances $Delta x$, $Delta y$, and i ranges from 1 to some N.



The only way I know is to manually create a table



table=Join[Table[x1,y,f[x1,y],y,y1,yN,Deltay],Table[x2,y,f[x2,y],y,y1,yN,Deltay],...] 


However, this is not a smart way, especially for large N. Could you please provide some smarter way to build the table?










share|improve this question









$endgroup$







  • 1




    $begingroup$
    Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
    $endgroup$
    – Alexei Boulbitch
    Mar 22 at 14:32













3












3








3





$begingroup$


Consider some function f[x,y]. I want to create a table in the form



table = x1,y1,f[x1,y1],x1,y2,f[x1,y2],...,x2,y1,f[x2,y1],x2,y2,f[x2,y2],...,


where $x_i,x_i+1$ and $y_i,y_i+1$ are separated by some distances $Delta x$, $Delta y$, and i ranges from 1 to some N.



The only way I know is to manually create a table



table=Join[Table[x1,y,f[x1,y],y,y1,yN,Deltay],Table[x2,y,f[x2,y],y,y1,yN,Deltay],...] 


However, this is not a smart way, especially for large N. Could you please provide some smarter way to build the table?










share|improve this question









$endgroup$




Consider some function f[x,y]. I want to create a table in the form



table = x1,y1,f[x1,y1],x1,y2,f[x1,y2],...,x2,y1,f[x2,y1],x2,y2,f[x2,y2],...,


where $x_i,x_i+1$ and $y_i,y_i+1$ are separated by some distances $Delta x$, $Delta y$, and i ranges from 1 to some N.



The only way I know is to manually create a table



table=Join[Table[x1,y,f[x1,y],y,y1,yN,Deltay],Table[x2,y,f[x2,y],y,y1,yN,Deltay],...] 


However, this is not a smart way, especially for large N. Could you please provide some smarter way to build the table?







table






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 14:23









John TaylorJohn Taylor

792211




792211







  • 1




    $begingroup$
    Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
    $endgroup$
    – Alexei Boulbitch
    Mar 22 at 14:32












  • 1




    $begingroup$
    Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
    $endgroup$
    – Alexei Boulbitch
    Mar 22 at 14:32







1




1




$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
Mar 22 at 14:32




$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
Mar 22 at 14:32










2 Answers
2






active

oldest

votes


















6












$begingroup$

x1 = 1; xN = 9; Δx = 3;
y1 = 0; yN = 5; Δy = 1;

table = Join @@ Table[i, j, f[i, j], i, x1, xN, Δx, j, y1, yN, Δy]



1, 0, f[1, 0], 1, 1, f[1, 1], 1, 2, f[1, 2], 1, 3,
f[1, 3], 1, 4, f[1, 4], 1, 5, f[1, 5],

4, 0, f[4, 0], 4, 1,
f[4, 1], 4, 2, f[4, 2], 4, 3, f[4, 3], 4, 4, f[4, 4], 4, 5,
f[4, 5],

7, 0, f[7, 0], 7, 1, f[7, 1], 7, 2, f[7, 2], 7, 3,
f[7, 3], 7, 4, f[7, 4], 7, 5, f[7, 5]




Also



table2 = ##, f @ ## & @@@ Tuples[Range[x1, xN, Δx], Range[y1, yN, Δy]]
table2 == table



True







share|improve this answer











$endgroup$




















    2












    $begingroup$

    This would be a nice answer (using the Outer product to create the 2D array):



    x1 = 1; xN = 9; dx = 3;
    y1 = 0; yN = 5; dy = 1;
    Partition[Flatten[
    Outer[Through[List, f[#1, #2]] &, Range[x1, xN, dx], Range[y1, yN, dy]]], 3]


    except that Outer returns too many levels -- hence the Flatten and Partition are needed to remove the extra brackets. Answer is the same as kglr's.






    share|improve this answer









    $endgroup$













      Your Answer








      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',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      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%2f193773%2fhow-to-create-table-with-2d-function-values%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6












      $begingroup$

      x1 = 1; xN = 9; Δx = 3;
      y1 = 0; yN = 5; Δy = 1;

      table = Join @@ Table[i, j, f[i, j], i, x1, xN, Δx, j, y1, yN, Δy]



      1, 0, f[1, 0], 1, 1, f[1, 1], 1, 2, f[1, 2], 1, 3,
      f[1, 3], 1, 4, f[1, 4], 1, 5, f[1, 5],

      4, 0, f[4, 0], 4, 1,
      f[4, 1], 4, 2, f[4, 2], 4, 3, f[4, 3], 4, 4, f[4, 4], 4, 5,
      f[4, 5],

      7, 0, f[7, 0], 7, 1, f[7, 1], 7, 2, f[7, 2], 7, 3,
      f[7, 3], 7, 4, f[7, 4], 7, 5, f[7, 5]




      Also



      table2 = ##, f @ ## & @@@ Tuples[Range[x1, xN, Δx], Range[y1, yN, Δy]]
      table2 == table



      True







      share|improve this answer











      $endgroup$

















        6












        $begingroup$

        x1 = 1; xN = 9; Δx = 3;
        y1 = 0; yN = 5; Δy = 1;

        table = Join @@ Table[i, j, f[i, j], i, x1, xN, Δx, j, y1, yN, Δy]



        1, 0, f[1, 0], 1, 1, f[1, 1], 1, 2, f[1, 2], 1, 3,
        f[1, 3], 1, 4, f[1, 4], 1, 5, f[1, 5],

        4, 0, f[4, 0], 4, 1,
        f[4, 1], 4, 2, f[4, 2], 4, 3, f[4, 3], 4, 4, f[4, 4], 4, 5,
        f[4, 5],

        7, 0, f[7, 0], 7, 1, f[7, 1], 7, 2, f[7, 2], 7, 3,
        f[7, 3], 7, 4, f[7, 4], 7, 5, f[7, 5]




        Also



        table2 = ##, f @ ## & @@@ Tuples[Range[x1, xN, Δx], Range[y1, yN, Δy]]
        table2 == table



        True







        share|improve this answer











        $endgroup$















          6












          6








          6





          $begingroup$

          x1 = 1; xN = 9; Δx = 3;
          y1 = 0; yN = 5; Δy = 1;

          table = Join @@ Table[i, j, f[i, j], i, x1, xN, Δx, j, y1, yN, Δy]



          1, 0, f[1, 0], 1, 1, f[1, 1], 1, 2, f[1, 2], 1, 3,
          f[1, 3], 1, 4, f[1, 4], 1, 5, f[1, 5],

          4, 0, f[4, 0], 4, 1,
          f[4, 1], 4, 2, f[4, 2], 4, 3, f[4, 3], 4, 4, f[4, 4], 4, 5,
          f[4, 5],

          7, 0, f[7, 0], 7, 1, f[7, 1], 7, 2, f[7, 2], 7, 3,
          f[7, 3], 7, 4, f[7, 4], 7, 5, f[7, 5]




          Also



          table2 = ##, f @ ## & @@@ Tuples[Range[x1, xN, Δx], Range[y1, yN, Δy]]
          table2 == table



          True







          share|improve this answer











          $endgroup$



          x1 = 1; xN = 9; Δx = 3;
          y1 = 0; yN = 5; Δy = 1;

          table = Join @@ Table[i, j, f[i, j], i, x1, xN, Δx, j, y1, yN, Δy]



          1, 0, f[1, 0], 1, 1, f[1, 1], 1, 2, f[1, 2], 1, 3,
          f[1, 3], 1, 4, f[1, 4], 1, 5, f[1, 5],

          4, 0, f[4, 0], 4, 1,
          f[4, 1], 4, 2, f[4, 2], 4, 3, f[4, 3], 4, 4, f[4, 4], 4, 5,
          f[4, 5],

          7, 0, f[7, 0], 7, 1, f[7, 1], 7, 2, f[7, 2], 7, 3,
          f[7, 3], 7, 4, f[7, 4], 7, 5, f[7, 5]




          Also



          table2 = ##, f @ ## & @@@ Tuples[Range[x1, xN, Δx], Range[y1, yN, Δy]]
          table2 == table



          True








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 22 at 14:36

























          answered Mar 22 at 14:30









          kglrkglr

          190k10209427




          190k10209427





















              2












              $begingroup$

              This would be a nice answer (using the Outer product to create the 2D array):



              x1 = 1; xN = 9; dx = 3;
              y1 = 0; yN = 5; dy = 1;
              Partition[Flatten[
              Outer[Through[List, f[#1, #2]] &, Range[x1, xN, dx], Range[y1, yN, dy]]], 3]


              except that Outer returns too many levels -- hence the Flatten and Partition are needed to remove the extra brackets. Answer is the same as kglr's.






              share|improve this answer









              $endgroup$

















                2












                $begingroup$

                This would be a nice answer (using the Outer product to create the 2D array):



                x1 = 1; xN = 9; dx = 3;
                y1 = 0; yN = 5; dy = 1;
                Partition[Flatten[
                Outer[Through[List, f[#1, #2]] &, Range[x1, xN, dx], Range[y1, yN, dy]]], 3]


                except that Outer returns too many levels -- hence the Flatten and Partition are needed to remove the extra brackets. Answer is the same as kglr's.






                share|improve this answer









                $endgroup$















                  2












                  2








                  2





                  $begingroup$

                  This would be a nice answer (using the Outer product to create the 2D array):



                  x1 = 1; xN = 9; dx = 3;
                  y1 = 0; yN = 5; dy = 1;
                  Partition[Flatten[
                  Outer[Through[List, f[#1, #2]] &, Range[x1, xN, dx], Range[y1, yN, dy]]], 3]


                  except that Outer returns too many levels -- hence the Flatten and Partition are needed to remove the extra brackets. Answer is the same as kglr's.






                  share|improve this answer









                  $endgroup$



                  This would be a nice answer (using the Outer product to create the 2D array):



                  x1 = 1; xN = 9; dx = 3;
                  y1 = 0; yN = 5; dy = 1;
                  Partition[Flatten[
                  Outer[Through[List, f[#1, #2]] &, Range[x1, xN, dx], Range[y1, yN, dy]]], 3]


                  except that Outer returns too many levels -- hence the Flatten and Partition are needed to remove the extra brackets. Answer is the same as kglr's.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 22 at 16:06









                  bill sbill s

                  55.1k377159




                  55.1k377159



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Mathematica Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193773%2fhow-to-create-table-with-2d-function-values%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript