Ask Your Question

Revision history [back]

click to hide/show revision 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,