Hi all,
In my Matlab code, I have the following function call:
y=maple('binomial', h, n+1);
where "h" is in fact a negative irrational number(that's why we use maple to
help), "n" is a positive integer.
Now how to rewrite this in Fortran?
thanks!
|
|
0
|
|
|
|
Reply
|
linus_utopia (52)
|
7/8/2007 4:08:47 AM |
|
On 8 Jul, 06:08, "Linus Utopia" <linus_uto...@gmail.com> wrote:
> Hi all,
>
> In my Matlab code, I have the following function call:
>
> y=maple('binomial', h, n+1);
>
> where "h" is in fact a negative irrational number(that's why we use maple to
> help), "n" is a positive integer.
>
> Now how to rewrite this in Fortran?
I am almost certain that fortran has a 'system' command. Use that to
call maple with the above parameters.
Another option is to call maple via a COM service, provided you
run on windows and your fortran compiler supports COM.
Rune
|
|
0
|
|
|
|
Reply
|
allnor (8474)
|
7/8/2007 4:29:45 AM
|
|
Rune Allnor <allnor@tele.ntnu.no> wrote:
> I am almost certain that fortran has a 'system' command.
No, Fortran per se does not have a system "command". Many vendors
provide a nonstandard intrinisc procedure for the purpose. It is often
named system, although there are occasionally different names, and the
details vary even among the ones where it is named system.
But it is not part of "Fortran".
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
|
|
0
|
|
|
|
Reply
|
nospam47 (9742)
|
7/8/2007 4:50:15 AM
|
|
"Richard Maine" <nospam@see.signature> wrote in message
news:1i0whtr.98r0td1bno6aeN%nospam@see.signature...
> Rune Allnor <allnor@tele.ntnu.no> wrote:
>
>> I am almost certain that fortran has a 'system' command.
>
> No, Fortran per se does not have a system "command". Many vendors
> provide a nonstandard intrinisc procedure for the purpose. It is often
> named system, although there are occasionally different names, and the
> details vary even among the ones where it is named system.
>
> But it is not part of "Fortran".
>
> --
> Richard Maine | Good judgement comes from experience;
> email: last name at domain . net | experience comes from bad judgement.
> domain: summertriangle | -- Mark Twain
Calling back to Matlab will be slow.
I wanted to see a Fortran equivalent of computing Binomial(m, n) where "m"
is arbitrary real number...
Thanks!
|
|
0
|
|
|
|
Reply
|
linus_utopia (52)
|
7/8/2007 5:16:29 AM
|
|
Linus Utopia wrote:
> "Richard Maine" <nospam@see.signature> wrote in message
> news:1i0whtr.98r0td1bno6aeN%nospam@see.signature...
>> Rune Allnor <allnor@tele.ntnu.no> wrote:
>>
>>> I am almost certain that fortran has a 'system' command.
>> No, Fortran per se does not have a system "command". Many vendors
>> provide a nonstandard intrinisc procedure for the purpose. It is often
>> named system, although there are occasionally different names, and the
>> details vary even among the ones where it is named system.
>>
>> But it is not part of "Fortran".
>>
>> --
>> Richard Maine | Good judgement comes from experience;
>> email: last name at domain . net | experience comes from bad judgement.
>> domain: summertriangle | -- Mark Twain
>
> Calling back to Matlab will be slow.
>
> I wanted to see a Fortran equivalent of computing Binomial(m, n) where "m"
> is arbitrary real number...
I suggest you google for Fortran code to compute the binomial function.
Certainly this is not part of the language, but almost certainly
you'll be able to locate existing Fortran code for this.
|
|
0
|
|
|
|
Reply
|
bogle (300)
|
7/8/2007 10:29:28 AM
|
|
Linus Utopia wrote:
(snip)
> Calling back to Matlab will be slow.
> I wanted to see a Fortran equivalent of computing
> Binomial(m, n) where "m" is arbitrary real number...
http://en.wikipedia.org/wiki/Binomial_theorem#Newton.27s_generalized_binomial_theorem
It shouldn't be too hard to write as a loop in Fortran.
http://en.wikipedia.org/wiki/Binomial_coefficient#Example
gives a way to evaluate them which should reduce the probability
of overflow.
-- glen
|
|
0
|
|
|
|
Reply
|
gah (12248)
|
7/9/2007 7:49:45 AM
|
|
Linus: for your info.
SLAC Bionom and it's references from Netlib:
http://www.netlib.org/cgi-bin/netlibfiles.pl?filename=slatec/fnlib/binom.f
Skip Knoble
On Sun, 8 Jul 2007 01:16:29 -0400, "Linus Utopia" <linus_utopia@gmail.com> wrote:
-|
-|"Richard Maine" <nospam@see.signature> wrote in message
-|news:1i0whtr.98r0td1bno6aeN%nospam@see.signature...
-|> Rune Allnor <allnor@tele.ntnu.no> wrote:
-|>
-|>> I am almost certain that fortran has a 'system' command.
-|>
-|> No, Fortran per se does not have a system "command". Many vendors
-|> provide a nonstandard intrinisc procedure for the purpose. It is often
-|> named system, although there are occasionally different names, and the
-|> details vary even among the ones where it is named system.
-|>
-|> But it is not part of "Fortran".
-|>
-|> --
-|> Richard Maine | Good judgement comes from experience;
-|> email: last name at domain . net | experience comes from bad judgement.
-|> domain: summertriangle | -- Mark Twain
-|
-|Calling back to Matlab will be slow.
-|
-|I wanted to see a Fortran equivalent of computing Binomial(m, n) where "m"
-|is arbitrary real number...
-|
-|Thanks!
-|
|
|
0
|
|
|
|
Reply
|
SkipKnobleLESS1 (689)
|
7/9/2007 1:08:59 PM
|
|
|
6 Replies
41 Views
(page loaded in 0.089 seconds)
|