recall a function
02-19-2015, 03:07 PM
Post: #1
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
recall a function
hi,
please, I need hints to recall a function in the same program passing parameters.

The second function of this code won't work:
Code:
 EXPORT gammad(k,t,n) BEGIN local f; f:= (n^(k-1)*e^(-n/t))/(t^k*Gamma(k)); return f; END; EXPORT gamma_cdf(k,t,n) BEGIN local f,u; f:= int(gammad(k,t,u), u, 0, n); return f; END ;

How to pass "u" as variable for the integral?

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
02-19-2015, 03:32 PM
Post: #2
 bobkrohn Member Posts: 142 Joined: Dec 2014
RE: recall a function
use a List?

L1(1):=f;
L1(2):=u;

RETURN L1;

or just...

RETURN {f,u}
02-19-2015, 03:39 PM
Post: #3
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: recall a function
or just...
RETURN {f,u}
[/quote]

no, I'm not using list:

my program has two functions:
from the second I want recall the first to make an integral, using u as "du".

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
02-19-2015, 05:02 PM
Post: #4
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: recall a function
Any symbolic manipulation is going to require the CAS, with exception for a few commands. To get around this, you could try:

Code:
EXPORT gamma_cdf(k,t,n) BEGIN local f:= int((X^(k-1)*e^(-X/t))/(t^k*Gamma(k)), X, 0, n); return f; END ;

Sometimes it is possible to also quote an expression (e.g. 'X' vs X) although in HPPPL, quoted objects are still (generally) evaluated.

Graph 3D | QPI | SolveSys
02-19-2015, 05:12 PM
Post: #5
 salvomic Senior Member Posts: 1,394 Joined: Jan 2015
RE: recall a function
(02-19-2015 05:02 PM)Han Wrote:  Any symbolic manipulation is going to require the CAS, with exception for a few commands. To get around this, you could try:
...

thank you!
I didn't remember that...

with X it works!

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)