Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The ContourPlot is applied 5 times with this code:

i = Range[1, 5]
j = Range[1, 5]
ContourPlot[x^2/i + y^2/j == 1, {x, -5, 5}, {y, -5, 5}]

However, I would like it to be applied 5 separate times for each 5 values of i (so 25 times in total). So a plot for (i=1 and j=1), (i=1 and j=2), (i=1 and j=3)... etc.

How do I create such a nested loop?

share|improve this question
    
Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – belisarius is forth yesterday

2 Answers 2

up vote 5 down vote accepted
Show[ContourPlot[x^2/#1 + y^2/#2== 1,{x, -5, 5},{y, -5, 5}] & @@@ Tuples[Range@5, {2}]]

Mathematica graphics

share|improve this answer

Using Table:

Table[ContourPlot[x^2/i + y^2/j == 1, {x, -5, 5}, {y, -5, 5}], {i, 5}, {j, 5}]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.