Message Boards Message Boards

0
|
5346 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Manipulate table-functions?

Posted 7 years ago

Hi,

I am searching for a solution regarding following situation. To be more precise, to what extend can a table-function be manipulated?

L = 2; 
Q = 2; 
K = 3; 
M = 3; 

A = 2; 

rpixel = 10.0; 
dphi = 2*Pi/L ;
deltaphiGrad = 10.0; 
deltaphi = 
deltar = 1.0;  

phi[l_, q_, m_] := l*dphi + q*deltaphi/m - dphi/2(* --- Position in Phi --- *)
xcontrol = MatrixForm[Table[phi[l, q, m], {m, 1, M}, {l, 1, L}, {q, 0, m*A*(Q - 1)}]]

In the last line I have a table-function which generates 2 fields of numbers, wherein the 1st row contains 3 values, 2nd row 5 values and the 3rd row 7 values. With the variable A it is possible to extend the values in each row.

Question: My goal is that the variable A should only be applied when m will be incremented to 2.

xcontrol = MatrixForm[Table[phi[l, q, m], {m, 1, M}, {l, 1, L}, {q, 0, m*A*(Q - 1)}]]

This leads that the 1st row will be computed independently of A and only the 2nd and 3rd row will be extended. So, do I have a possibility to manipulate the table-function to achieve that? Maybe some kind of programmatic table functions are needed?

Many thanks in advance for some hints!

POSTED BY: Nikki Peter
3 Replies
Posted 7 years ago

Can you list the rows that you want? Without evaluating your phi function, just list the values for each {l,q,m} that you want and how many of those you want and what order you want them in. Perhaps with that someone can reverse engineer how to create that list of lists.

POSTED BY: Bill Simpson
Posted 7 years ago

Hi Bill,

thanks for your reply! The variable K defines the row value. When I use your example I get only 2 rows, instead of 3 (K=3) And M should also be held flexible, meaning all integer values for M should be used.

POSTED BY: Nikki Peter
Posted 7 years ago

The help pages for Table show

Table[expr,{i,imin,imax}]

which increments i by 1

and

Table[expr,{i,imin,imax,di}]

which increments i by di

So perhaps

M = 5;
xcontrol = MatrixForm[Table[phi[l, q, m], {m, 1, M, 2}, {l, 1, L}, {q, 0, m*A*(2 - 1)}]]

which increments m by 2

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract