# Solve Function: How can I remove x-> from the output?

Posted 9 years ago
16458 Views
|
3 Replies
|
2 Total Likes
|
 Using the Solve function to find Temperature of a system, I receive an output ofT -> xHow can I remove the T -> from the output so I can use the number in a graph (or whatever)?Example of code: For[i = 1, i < 18, i++, AppendTo[intTemp, Solve[tungParabola == (vcData[[1, i, 1]]/vcData[[1, i, 2]])/w150] [[2]] ] ] 
3 Replies
Sort By:
Posted 4 years ago
 hello, i am attaching a file. I am getting this solution for my problem. again i want this values as an input to next stage of programming. so i want to replace '==' sign by equal sign. How can i do this ? Attachments:
Posted 9 years ago
 Excellent! That solved my problem.Thank you!
Posted 9 years ago
 Solve is giving you a Rule for T, which is much more polite than setting the variable T to some value. You can use the Rule by a Replace, for which the shortcut is /. (PS. It's a good idea to begin user symbols with lower case, so they don't override Mathematica definitions. ) In[1]:= solution = Solve[3 x + 5 == 2, x] Out[1]= {{x -> -1}} In[2]:= solutionForX = x /. solution Out[2]= {-1} In[3]:= (* You get the nested list because Solve has the possibility \ of offering multiple solutions. You can de-nest like this *) solutionForX = x /. solution[[1]] Out[3]= -1 In[4]:= (* this has set the value for solutionForX *) In[5]:= solutionForX Out[5]= -1 In[6]:= (* you could have set a value for x, but that can be annoying \ if you later want to use it without definition, asn in In[1] *) x = x /. solution[[1]] Out[6]= -1 In[7]:= x Out[7]= -1