Ask Your Question
0

How do I make functional substitutions?

asked 2012-10-22 16:16:35 +0100

daniel.e2718 gravatar image

I want to substitute one function for another. Consider this:

v = function('x')
u(x) = (v(x)+v(-x))/2
delta = 10^(-90)
u(delta).subs(v=gamma(x))

The very last line is what I'm trying to accomplish. I know it's the wrong command, but I'm wanting to make the substitution $v(x)\to\Gamma(x)$.

Is there a way along these lines to do such a functional substitution?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-10-22 16:40:05 +0100

Eviatar Bach gravatar image

updated 2012-10-22 16:45:56 +0100

I think you want v = function('v') for the first line; the first argument is the name of the function.

Here's the full code:

v = function('v')
u(x) = (v(x) + v(-x))/2
delta = 10^(-90)
u(delta).substitute_function(v, gamma)

I'm puzzled as to why it doesn't work if v is defined as v = function('v', x). Anyone know?

edit flag offensive delete link more

Comments

1

*Exactly* what I was looking for! Thanks! EDIT: Good question though. Why doesn't it work if you specify the variable of the function?

daniel.e2718 gravatar imagedaniel.e2718 ( 2012-10-22 17:26:34 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-10-22 16:16:35 +0100

Seen: 420 times

Last updated: Oct 22 '12