Ask Your Question

# How do I make functional substitutions?

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 close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

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?

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?

( 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

## Stats

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

Seen: 210 times

Last updated: Oct 22 '12