I have the following expression:

sol1 = 
  (11 + 3*δ - 11*θ + 4*m*θ - 3*δ*θ - 8*Sqrt[(-(2 + δ))*(-1 + θ)*(1 - θ + m*θ)])/(4 + 4*δ)

I want to plug numbers into $ \theta $ that range from $ 0.1 $ to $ 0.9 $.

Does anybody know how to do this more efficiently than using a loop? I tried to use For and Do, but I am not sure how to implement the procedure I want correctly.


closed as off-topic by Chris K, Michael E2, Henrik Schumacher, m_goldberg, Bob Hanlon Aug 8 at 4:19

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." – Chris K, Michael E2, Henrik Schumacher, m_goldberg, Bob Hanlon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ For a one-shot use, ReplaceAll (/.) suffices: e.g., sol1 /. θ -> Range[.1, .9, .1]. If repeated usage is intended, SetDelayed (:=) is more appropriate. $\endgroup$ – Αλέξανδρος Ζεγγ Aug 6 at 6:27
  • $\begingroup$ @ΑλέξανδροςΖεγγ - it is worth pointing out that the reason that ReplaceAll works here is that all of the operations used in sol1 are Listable $\endgroup$ – Bob Hanlon Aug 6 at 18:58

You can use Table for that and specify the step you want:

Table[sol1, {θ,0.1,0.9,0.1}]

Not the answer you're looking for? Browse other questions tagged or ask your own question.