Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Compile and ascription' topicStudent Support Forum > General > "Compile and ascription"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
11/08/12 2:15pm

Can you reproduce this?

In[1]:= fc=Compile[{x},x^2+1]; fc[3]

Out[2]= 10.

In[3]:= g=x^2+1; gc=Compile[{x},g]; gc[3]

From In[3]:= CompiledFunction::cfse: Compiled expression 1 + x^2 should be a machine-size real number.

From In[3]:= CompiledFunction::cfex: External evaluation error at instruction 2; proceeding with uncompiled evaluation.

Out[5]= 1 + x^2

In[6]:= g=x^2+1; gc=Compile[{x},Evaluate[g]]; gc[3]

Out[8]= 10.

URL: ,

Subject (listing for 'Compile and ascription')
Author Date Posted
Compile and ascription PhysicsGuy 11/08/12 11:10am
Re: Compile and ascription Bill Simpson 11/08/12 2:15pm
Re: Re: Compile and ascription PhysicsGuy 11/08/12 3:19pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic