Thread Subject: how to convert this line of Matlab code into Fortran?

Subject: how to convert this line of Matlab code into Fortran?

From: Linus Utopia

Date: 8 Jul, 2007 00:08:47

Message: 1 of 6

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!

Subject: how to convert this line of Matlab code into Fortran?

From: Rune Allnor

Date: 7 Jul, 2007 21:29:45

Message: 2 of 6

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

Subject: how to convert this line of Matlab code into Fortran?

From: nospam@see.signature (Richard Maine)

Date: 7 Jul, 2007 21:50:15

Message: 3 of 6

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

Subject: how to convert this line of Matlab code into Fortran?

From: Linus Utopia

Date: 8 Jul, 2007 01:16:29

Message: 4 of 6


"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!

Subject: how to convert this line of Matlab code into Fortran?

From: Gib Bogle

Date: 8 Jul, 2007 22:29:28

Message: 5 of 6

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.

Subject: how to convert this line of Matlab code into Fortran?

From: Glen Herrmannsfeldt

Date: 8 Jul, 2007 23:49:45

Message: 6 of 6

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

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com