 
 
 
 
 
 
Re: Question regarding Compile
- To: mathgroup at smc.vnet.net
- Subject: [mg33741] Re: Question regarding Compile
- From: Madhusudan Singh <ar at sc.hc.de>
- Date: Wed, 10 Apr 2002 00:50:05 -0400 (EDT)
- Organization: University of Michigan Electrical Engineering and Computer Science
- References: <a8m33c$oaq$1@smc.vnet.net> <a8tt4m$fmg$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks for your response.
>
> You can not do *what* ? and what may
>
> f5 = Compile[{{x, _Real}}, Sin[x]]
>
> f[x_] := x^2
>
> Plot[f[f5[x]], {x, 0, Pi}]
>
> do ?
This works. I was using a syntax like :
Compile[{x}, expression] as the help stated that _Real was the default.
However, it seems that I need to write it as ;
Compile[{x,_Real},expression].
That said, the expressions that I am working with, are :
integrand := Compile[{{y, _Real}, {x1, _Real}, {x2, _Real}}, f1[pl[argument[y]] + x1, x2, c]];
pl[] is an array, f1 and argument are functions (fairly simple functions).
c is a constant.
answer1[x1_, x2_] := Exp[-2 Integrate[integrand[y, x1, x2], {y, a, b}]];
a=0, b~1e-8
I get an error :
CompiledFunction::cfsa: Argument y at position should be a machine-size
real number.
when I try to use answer1 with
jt3=q NIntegrate[v[x1, 50, 0.2] g3[0.2, x1, 50] partjt3[x1]
answer1[0.0, x1], {x1, 50, maxpl + dummyinfinity}, Method -> MonteCarlo, MaxPoints -> 10000];
v, g3, partjt3 are simple functions.
As you can see, this is quite complicated. However, since a and b are
fixed numbers, and nowhere near machine precision, I do not not understand
the error above.
This is leading to other errors later.
Any ideas ?
Thanks again.

