MathGroup Archive 2005

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

Search the Archive

Re: Do loops in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55182] Re: [mg55170] Do loops in Mathematica
  • From: "Matthias Bode" <lvsaba at hotmail.com>
  • Date: Wed, 16 Mar 2005 05:35:57 -0500 (EST)
  • References: <200503150522.AAA09704@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

what about Table[ ]?

Try:
TableForm[Table[

{a, Solve[x^2 + 3*x + a == 0, x]},

{a, 2, 6}]]

Looks nice, doesn't it?

Best regards,

MATTHIAS BODE
Torres Sofer III, depto. 9 A
Pedro Borda #1072
esq. Ismael Vásquez
COCHABAMBA/BOLIVIA

CEL: +591-70 71 56 64
TEL/FAX: +591-4-4 53 34 17
LVSABA at HOTMAIL.COM

----- Original Message -----
From: "dumb_founded" <andreajagger_8 at hotmail.com>
To: mathgroup at smc.vnet.net
Subject: [mg55182] [mg55170] Do loops in Mathematica


> I am having trouble setting up Do loops in Mathematica.  Even when I
> put in a return statement, I get no output.  Below is a concrete
> example of code I am putting in:
>
> Do[{p = Solve[x^2 + 3*x + 1 == 0, x], Return[2*p]}, {i, 1}]
>
>
> I get nothing out of it.
>
> Here is a sketch of the code I want to construct but am scared to
> because of the above problem I keep encountering.
>
> (1) the first expression in the Do loop calls the FindRoot function on
> nonlinear function of x that involves a constant c.  The constant c is
> in curly brackets at the end of the Do loop specifying a beginning
> value for c and an ending value for c.
> (2) I take the root found in the previous expression and I use it to
> calculate two numerical integrals
> (3) I add or subtract the two numerical integrals found in the previous
> expressions and I return the value of this expression (and this
> expression alone).
>
>
> I am having a headache figuring out this simple chore.  Mathematica
> simply refuses to behave.
>
>


  • Prev by Date: Re: Wolfram plugin for Google Desktop Search
  • Next by Date: Re: Do loops in Mathematica
  • Previous by thread: Do loops in Mathematica
  • Next by thread: Re: Do loops in Mathematica