Integrals commands

Hi,

is there any other command besides intsimp that allows to perform a standard integral but allowing for more inputs in the integrad procedure besides the integrating variable?

Thanks!

1 Answer



0



The inthp4 function will integrate a function over a specified range. It is a little more difficult to use, because you need to place your extra arguments inside of DS structures and pass those into your function.

Since you have the source code for intsimp (or alternatively intquad1), you could make a new version that passes two inputs to the function being integrated. You would need to change the procedure prototype from this:

proc intsimp(&f,xl,tol);

to something like:

proc intsimp2args(&f,xl,tol,extra_arg);

and then inside the new function intsimp2args, you would add this new argument, extra_arg to the inputs being passed to your function, which is called f inside of intsimp. For example, this line:

sfa = f(xl[2]);

would need to be changed to:

sfa = f(xl[2], extra_input);

aptech

1,773

Your Answer

1 Answer

0

The inthp4 function will integrate a function over a specified range. It is a little more difficult to use, because you need to place your extra arguments inside of DS structures and pass those into your function.

Since you have the source code for intsimp (or alternatively intquad1), you could make a new version that passes two inputs to the function being integrated. You would need to change the procedure prototype from this:

proc intsimp(&f,xl,tol);

to something like:

proc intsimp2args(&f,xl,tol,extra_arg);

and then inside the new function intsimp2args, you would add this new argument, extra_arg to the inputs being passed to your function, which is called f inside of intsimp. For example, this line:

sfa = f(xl[2]);

would need to be changed to:

sfa = f(xl[2], extra_input);

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.