I have a list of polynomials (all with the variable x) called lyle and a function that accesses this list and evaluates it at certain value, but after I do that the polynomials are permanently evaluated at that value given before. How do I fix this? Here's the function:

ChebyChase[n_, p_] := (Block[{x}, comb = lyle[[n + 1]]; x = p; Return[comb];])

closed as off-topic by MarcoB, m_goldberg, ilian, Michael E2, Jens Jul 27 '15 at 20:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, m_goldberg, ilian, Michael E2, Jens
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I cannot reproduce the issue you say that you have. Can you post a small working example? You could also use ChebyChase[n_, p_] := lyle[[n+1]] /. x -> p instead. $\endgroup$ – C. E. Jul 27 '15 at 16:48
  • $\begingroup$ Your code is overly complicated, just use Block[{x = p}, lyle[[n + 1]]] but I suspect the real problem is previous definitions of your function so evaluate ClearAll[ChebyChase] and try your definition again. $\endgroup$ – MikeLimaOscar Jul 27 '15 at 16:55
  • $\begingroup$ Sorry, I was testing it too, and it doesn't change the values in lyle. The bulk of my code (not shown) somehow changes the values in lyle. The function seems to work though. I'll have to figure how what's going on in the rest of the code. $\endgroup$ – user31035 Jul 27 '15 at 16:59
  • $\begingroup$ Perhaps you have a = instead of a == in the "bulk" of your code. $\endgroup$ – Michael E2 Jul 27 '15 at 18:43

Browse other questions tagged or ask your own question.