Mathematica loop help

• To: mathgroup at smc.vnet.net
• Subject: [mg121148] Mathematica loop help
• From: Anshu <anshumanbgg at gmail.com>
• Date: Wed, 31 Aug 2011 06:05:45 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```Hi,

I'm new to mathematica and I'm running into trouble with loops.

I have some parameters, say {a,b,c} and some variables, say {x,y}. I want to solve two non linear equations in x and y using FindRoot for a range of parameter space, say {a,0,100} and {b,-20,20} and {c,55,95}, say, all integers and in increments of 1 and store the solutions in a matrix. varying one parameter at a time so I can keep track of things.

My FindRoot is spitting out solutions when I run it one by one, punching in different parameter values but I would like to loop it, store the solutions and then print it out in a table.

So I wanna do something like this:

While {a,0,100,1}
A[i,j]:= FindRoot[{ f(x,y)==0&& g(x,y)==0},{{x,40},{y,200}}]
end loop

Print A[i,j] in a table. (i indexes parameter 'a' while j=1,2 indexes the two solutions)

Can someone please tell me how to do this. Right now I am trying to run a Do Loop but my mathematica is freezing, while when I run FindRoot just once for a fixed parameter value, I am getting solutions instantaneously.

Thanks a lot

```

• Prev by Date: Re: avoid combining like terms in algebraic expression
• Next by Date: Sudden memory-usage increase with SparseArray
• Previous by thread: TransformedDistribution
• Next by thread: Sudden memory-usage increase with SparseArray