Re: Executing function in mathematica function problem
- To: mathgroup at smc.vnet.net
- Subject: [mg69984] Re: [mg69931] Executing function in mathematica function problem
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Thu, 28 Sep 2006 06:18:11 -0400 (EDT)
- References: <200609271006.GAA00287@smc.vnet.net> <acbec1a40609270739j59174f60o9c714ac9e3b9f228@mail.gmail.com> <451ad4d709e49@wp.pl>
I am not sure the syntax you gave is correct, but assuming it approximates what you fed into Mathematica, I think you may be experiencing problems due to an attempted symbolic evaluation. I'd recommend using SetDelayed if your external function F1 appears on the right hand side of a function definition. If you don't, the right hand side will be evaluated symbolically (and then stored). In addition to using SetDelayed, you should probably also constrain the left hand side to only match numeric arguments. myFun[x:_Integer|_Real]:=F1[x]; I apologize if I misdiagnosed the problem. On 9/27/06, Krzysztof Lisowski <krzysztof.lisowski at wp.pl> wrote: > No, tge function's argument is passed as vector with one value > > Dnia 27-09-2006 o godz. 16:39 Chris Chiasson napisa³(a): > > does your procedure from the other system accept symbolic arguments? > > > > On 9/27/06, krzysztof.lisowski at wp.pl <krzysztof.lisowski at wp.pl> wrote: > > > Hello, > > > I've created simple procedure in another system, which takes one > > parameter > > > (x(1)) as argument function and returns one value. After compilation, > > > with 'mex -l fnc.m' command I've created a shared library. > > > In Mathematica's script I load this function with: > > > > > > link = Install["f:\\f1.exe"]; > > > F1[0.5] # I have a correct result > > > > > > Then I define such argument, which are part of a function > > > fCE=F1[x1]; f > > > C[{x1_}]=fCE; > > > > > > and execute the Mathematica function FNC[...,fC,...]. > > > > > > The FNC is defined as follow FNC[...,fC_,...]:=Block[{..., > > > fCi,...,cog,} > > > .... > > > bva:=If[cog && Abs[#]>fm, Sign[#]fm, #]&; > > > fCi:=(++if; bva[N[fC[#]]]ix)&; > > > ... > > > ] > > > when I try execute such a script I have a error; > > > Part::partw: Part 1 of {} does not exist... > > > > > > Any sugestions... > > > > > > KL > > > > > > > > > > > > -- > > http://chris.chiasson.name/ > > > > > ---------------------------------------------------- > Nadci±gaj± wirusy, znamy sposób by z nimi walczyæ. > Odwied¼ aptetkê w pasaz.wp.pl - Kliknij: > http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fd11.html&sid=884 > > > -- http://chris.chiasson.name/
- References:
- Executing function in mathematica function problem
- From: "krzysztof.lisowski@wp.pl" <krzysztof.lisowski@wp.pl>
- Executing function in mathematica function problem