Beginner problem with repeat
Robert Funnell <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.user |
|---|---|
| Message-ID | <[email protected]> |
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)