Message Boards Message Boards

0
|
3709 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

List construction

Posted 9 years ago

Hi,

How do I construct a list of f[x,y] where x runs from 1 to T, y<=x but y<=K? Right now I'm using

Table[f[x,y],{x,1,T},{y,1,x}]

and then using Cases to pick the elements I want. But this is inefficient because Table outputs more elements than necessary (i.e. those for which y>K).

POSTED BY: Miguel Olivo-V
Posted 9 years ago

Nevermind, just realized Mathematica can handle

Table[f[x,y],{x,1,T},{y,1,Min[x,K]}]
POSTED BY: Miguel Olivo-V
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