[Scilab-users] gamma function overloading

classic Classic list List threaded Threaded
4 messages Options
Carrico, Paul-2 Carrico, Paul-2
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] gamma function overloading

Dear All

 

In the Scilab doc it’s mentioned that gamma function can be overloaded by complex number, but how to proceed?

 

A = complex(4,4)

gamma_A = gamma(A)

 

 

à la ligne    12 de la fonction %s_gamma ( C:\scilab-6.0.2\modules\special_functions\macros\%s_gamma.sci ligne 22 ) dans la fonction native gamma

%s_gamma: Function not defined for the given argument type.

Check arguments or define function %s_gamma_user() for overloading.

 

 

 

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: gamma function overloading

Le 09/08/2019 à 11:52, Carrico, Paul a écrit :

Dear All

 

In the Scilab doc it’s mentioned that gamma function can be overloaded by complex number, but how to proceed?

 

A = complex(4,4)

gamma_A = gamma(A)

 

 

à la ligne    12 de la fonction %s_gamma ( C:\scilab-6.0.2\modules\special_functions\macros\%s_gamma.sci ligne 22 ) dans la fonction native gamma

%s_gamma: Function not defined for the given argument type.

Check arguments or define function %s_gamma_user() for overloading.

 


--> function r = %s_gamma_user(a)
  >     r = [];

  >     disp("OK")

  > endfunction


--> gamma(%i)
 OK
 ans  =
    []


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Carrico, Paul-2 Carrico, Paul-2
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] Re: gamma function overloading

Thanks Samuel,

 

What I’m doing wrong?

 

function r=%s_gamma_user(a)

    r = gamma(a);

endfunction

 

A = complex(4,4)

gamma_A = gamma(A

 

Limite de récursion atteinte (1000).

 

 

De : users [mailto:[hidden email]] De la part de Samuel Gougeon
Envoyé : vendredi 9 août 2019 12:41
À : [hidden email]
Objet : [EXTERNAL] Re: [Scilab-users] gamma function overloading

 

Le 09/08/2019 à 11:52, Carrico, Paul a écrit :

Dear All

 

In the Scilab doc it’s mentioned that gamma function can be overloaded by complex number, but how to proceed?

 

A = complex(4,4)

gamma_A = gamma(A)

 

 

à la ligne    12 de la fonction %s_gamma ( C:\scilab-6.0.2\modules\special_functions\macros\%s_gamma.sci ligne 22 ) dans la fonction native gamma

%s_gamma: Function not defined for the given argument type.

Check arguments or define function %s_gamma_user() for overloading.

 

 

--> function r = %s_gamma_user(a)
  >     r = [];
  >     disp("OK")
  > endfunction


--> gamma(%i)
 OK
 ans  =
    []


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Re: [EXTERNAL] Re: gamma function overloading

Hello Paul,

> De : Carrico, Paul
> Envoyé : vendredi 9 août 2019 13:36
>
> What I'm doing wrong?
>
> function r=%s_gamma_user(a)
>     r = gamma(a);
> endfunction
>
> A = complex(4,4)
> gamma_A = gamma(A
>
> Limite de récursion atteinte (1000).

You're calling recursively gamma without an end condition.

It seems that gamma() looks like

function r=gamma(a)

    if isreal(a) then <usual gamma function>

    else r=%s_gamma_user(a)

endfunction

So you should define how to compute the gamma of a complex yourself.

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users