Quick Excerpt of generic convergence sequence in Python


N_inf =
N = 
v =
y =
i =
x = N_inf == set(v in y is all(i) in N(v[i] >= v[i+1]))

What are the simplest declarations that allow this code to compile?

Just to get the code to compile, you can put anything you like as the declarations. What’s simplest? I guess you could use 0 for all of them:

N_inf = 0
v = 0
y = 0
i = 0
x = N_inf == set(v in y) is all(i) in N(v[i] >= v[next(i)])

That will compile fine, because the Python compiler does not do compile-time type checking.

If you want it to run without error, I don’t think it can be done:

  1. callable object N is not defined (NameError);

  2. the in operator always returns True or False, neither of which is iterable;

  3. so set(v in y) will raise TypeError.

I fixed the code to match your advice

Thank you