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
Junos[MX]: How to show VPLS instance associated with given subinterface
What is the English pronunciation of "pain au chocolat"?
Does the UK parliament need to pass secondary legislation to accept the Article 50 extension
Add big quotation marks inside my colorbox
Mimic lecturing on blackboard, facing audience
Pre-mixing cryogenic fuels and using only one fuel tank
Make a Bowl of Alphabet Soup
Why is short-wave infrared portion of electromagnetic spectrum so sensitive to fire?
Has any country ever had 2 former presidents in jail simultaneously?
Bridge building with irregular planks
What is Cash Advance APR?
How can I write humor as character trait?
How to create table with 2D function values?
It grows, but water kills it
Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?
What are the balance implications behind making invisible things auto-hide?
Can disgust be a key component of horror?
X marks the what?
Does the Catholic Church consider Constantine's vision of "by this symbol conquer" to be from God?
Example of factorization in a polynomial ring which is not an UFD
Do the primes contain an infinite almost arithmetic progression?
Can a college of swords bard use blade flourish on an OA from dissonant whispers?
How can I avoid dust and bubbles when installing window film?
How to get directions in deep space?
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
$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?
table
$endgroup$
add a comment |
$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?
table
$endgroup$
1
$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
4 hours ago
add a comment |
$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?
table
$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
table
asked 4 hours ago
John TaylorJohn Taylor
761211
761211
1
$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
4 hours ago
add a comment |
1
$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
4 hours ago
1
1
$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
4 hours ago
$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
4 hours ago
add a comment |
2 Answers
2
active
oldest
votes
$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
$endgroup$
add a comment |
$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.
$endgroup$
add a comment |
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',
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$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
$endgroup$
add a comment |
$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
$endgroup$
add a comment |
$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
$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
edited 4 hours ago
answered 4 hours ago
kglrkglr
189k10206424
189k10206424
add a comment |
add a comment |
$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.
$endgroup$
add a comment |
$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.
$endgroup$
add a comment |
$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.
$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.
answered 2 hours ago
bill sbill s
54.5k377156
54.5k377156
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
$begingroup$
Have a look at Menu/Help/WolframDocumentation/Table. That's what will help you.
$endgroup$
– Alexei Boulbitch
4 hours ago