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

Post Reply:
Name:
Email Address:

Please send email when my message is replied to.

Url (optional):
Subject:
Message: view original message?
Attachment (optional):
Please answer this:1+5 =



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. http://reference.wolfram.com/mathematica/tutorial/GeneratingCAndFortranExpressions.html http://reference.wolfram.com/mathematica/CCodeGenerator/tutorial/Overview.html