axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-mail] Beginner problem with repeat


From: Robert Funnell
Subject: [Axiom-mail] Beginner problem with repeat
Date: Wed, 17 Oct 2007 20:02:26 -0400 (EDT)

I just started using Axiom recently and have obtained very useful numerical solutions of a set of equations. I am now trying to embed the solve in a loop so I can easily try different parameter values, and I can't get it to work within the loop.

Appended below is a simple test. The solve within the loop is just silently skipped over, while the solve outside the loop gives me the expected result. Am I doing something silly? Or, rather, what am I doing that is silly?

(The comment lines marked bad1 and bad2 are attempts to make the loop more elegant. They don't work, but that's another story.)

- Robert

Test case
---------

)clear all
)set output algebra test_results.txt

eq1 == p^2 + 2*P + 5 = 0; precision := 1.e-6;
plist == [1000,2000,3000]

--bad1 for ip in 1..3 repeat
--bad1   p == plist.ip
--bad2 for p in plist repeat

-- for some reason the solves don't get executed
ip := 0;
for ipp in 1..3 repeat
  ip := ip + 1;
  p == plist.ip;
  output("p=",p);
  solve(eq1,precision)

-- the following solve does get executed
output("p=",p)
solve(eq1,precision)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]