| 1 | initial version |
The error you reported is attributable to your initial allocation, which, by default, creates vectors of Integers, in which one cannot store floats. Try :
Ptetx = zero_vector(RR, 101)
Ptety = zero_vector(RR, 101)
Ptetz = zero_vector(RR 101)
(you can also try RDF : look up this in previous questions...).
However, this is not sufficient : it happens that your functions have no root for some i values, and this is not caught by your code, which stops at the first occurrence. You should bracket your root findings in try: except constructs (or, alternatively, use utility functions wrapping find_root in such constructs).
An interesting problem is to record this "no solution" occurrence in your results vectors. A possibility is RR("NaN"), but this depends in a large part on what you plan to do with these results...
HTH,
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.