# Substitution does not work while substituting with a value from list [closed]

I am writing a program which iteratively solve and make substitution from a list. As I have shown in the code substitution works when I enter the value directly (Input 100). When I extract the same value from a list and substitute (102),It does not seem to work. I have checked the FullForm for both and they are same.

x''[t] /. x -> Function[{t}, A Cos[t]]

(* -A Cos[t] *)

xsol[[1]]

(* A Cos[t] *)

x''[t] /. x -> Function[{t}, xsol[[1]]]

(* 0 *)


I am new to Mathematica. Could someone please explain the right method to do it. Thanks

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Mar 15 '15 at 18:30
• Please precisely specify xsol[[1]]. – bbgodfrey Mar 15 '15 at 18:34
• Try x''[t] /. x -> Function[{t}, Evaluate@xsol[[1]]] – Nasser Mar 15 '15 at 18:34
• @Nasser Thanks it worked. – feminkk Mar 15 '15 at 18:36
• The reason that Evaluate is needed is that Function has attribute HoldAll – Bob Hanlon Mar 15 '15 at 20:29