Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica loop help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121369] Re: Mathematica loop help
  • From: Anshuman <anshumanbgg at gmail.com>
  • Date: Mon, 12 Sep 2011 04:23:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hey Bill,

Thanks a lot for your help (and also Don's  who emailed me).
I had written my code as an algorithm so I can get my idea across. Thanks to both your help, the code as follows works:

I wanted to solve for G1 and G2 and spit out x,y,and two functions of x and y, namely F1 and F2, in my table.

Table[{x,y,F1(x,y),F2(x,y)}/.FindRoot[{G1[x,y]==0,G2[x,y]==0},{x,30},{y,40}],{a,0,10,1}]

However,

1. FindRoot is sensitive to the start point choice. Since I have some idea about the direction in which my Roots might move when I alter the parameters in my loop, I was wondering if I could add new start points for FindRoot with every iteration. What is happening right now is that your code works for a while (For example from {a,0,5,1} and then starts giving errors so I have to run the code twice, once from {a,0,5,1} with start point {x,30},{y,40} and then {a,6,10,1} but with different start point for FindRoot say {x,55},{y,70}. Could I put the solution of iteration #i as the FindRoot start point for iteration #i+1?

2. Also, What if I wanted to do something more complicated than simply compute formulae like Cos[x+y] from my FindRoot solutions but wanted to something more involved, say some Solve or another FindRoot , and then have the final output in a table. Is there a way to write a more complicated program that spits our a table in the end. 

Thanks a lot,
A




  • Prev by Date: Re: Manipulate inside module
  • Next by Date: Re: PolynomialMod
  • Previous by thread: Re: Mathematica loop help
  • Next by thread: Problem with complex integration in Mathematica 7.0.1