Mathematica 9 is now available
Student Support Forum
Student Support Forum > General > > "Compile result of Solve command"

Post Reply:
Email Address:

Please send email when my message is replied to.

Url (optional):
Message: view original message?
Attachment (optional):
Please answer this:3+4 =

Original Message (ID '547017') By jf:
You need to use the output of Solve (a Rule) to derive an expression for a. In[1]:= eqn=a+b+c==0 ; res=Solve[eqn,a] Out[2]= {{a->-b-c}} In[3]:= temp = a /. First[res] Out[3]= -b-c In[4]:= cfun=Compile[{b,c},Evaluate[temp]] Out[4]= CompiledFunction[{b,c}, -b-c,-CompiledCode-] In[5]:= cfun[3.,4.] Out[5]= -7. Compiling to C code is non-trivial.