AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] making a function in pawn (https://forums.alliedmods.net/showthread.php?t=197158)

tmp2 09-29-2012 14:48

[help] making a function in pawn
 
Hey all mates, i am trying to find a way to copy a function i've got in excel to pawn.

The function is GAMMADIST
http://office.microsoft.com/en-us/ex...005209101.aspx

anyone has any idea how to use/make this function properly in pawn?
its very important and any help will be appreciated.

Best regards, tmp2.

fysiks 09-29-2012 15:41

Re: [help] making a function in pawn
 
I'm not sure how hard this would be. You would need to find out how the gammadist function works and implement that.

tmp2 09-29-2012 18:17

Re: [help] making a function in pawn
 
yea that is obvious , but the thing is , i am having problems trying to implement that.

the function is:
http://officeimg.vo.msecnd.net/en-us...A006051146.gif

now how do i get this into pawn?

fysiks 09-29-2012 21:10

Re: [help] making a function in pawn
 
What problems are you having?

nikhilgupta345 09-29-2012 23:18

Re: [help] making a function in pawn
 
Quote:

Originally Posted by fysiks (Post 1809345)
What problems are you having?

Probably on how to implement that one symbol in the denominator to the left or (alpha). I think that's another function within itself or something, not completely sure.

fysiks 09-29-2012 23:25

Re: [help] making a function in pawn
 
Quote:

Originally Posted by nikhilgupta345 (Post 1809407)
Probably on how to implement that one symbol in the denominator to the left or (alpha). I think that's another function within itself or something, not completely sure.

That is capital Gamma. According to wikipedia, it's actually a simple function.

meTaLiCroSS 09-29-2012 23:28

Re: [help] making a function in pawn
 
Quote:

Originally Posted by nikhilgupta345 (Post 1809407)
Probably on how to implement that one symbol in the denominator to the left or (alpha). I think that's another function within itself or something, not completely sure.

Besides that detail, the function would be:

PHP Code:

gammadist(xabeta)
{
    static const 
e_value 2.72
    
return (1/power(betaa) * themiscoperator a) * power(xa-1) * power(e_value, -(x/beta))


EDIT:

Quote:

Originally Posted by fysiks (Post 1809413)
That is capital Gamma. According to wikipedia, it's actually a simple function.

It's equal to (n - 1)!, any way for expressing the ! operator?

nikhilgupta345 09-29-2012 23:43

Re: [help] making a function in pawn
 
Quote:

Originally Posted by meTaLiCroSS (Post 1809415)
Besides that detail, the function would be:

PHP Code:

gammadist(xabeta)
{
    static const 
e_value 2.72
    
return (1/power(betaa) * themiscoperator a) * power(xa-1) * power(e_value, -(x/beta))


EDIT:



It's equal to (n - 1)!, any way for expressing the ! operator?

The easiest way to do factorials would probably be just to make a simple recursive function.

PHP Code:

public factorial(int n)
{
    if(
== 1)
        return 
1;
        
    return 
factorial(1);




All times are GMT -4. The time now is 08:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.