Ask Your Question
0

Pattern matching in differential equations

asked 2013-08-18 11:04:58 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

We have the following functional equation: f(xy)+f(x(1-y))+f((1-x)y)+f((1-x)(1-y)) == f(x)+f(1-x)+f(y)+f(1-y) Differentiating by x then y we get a second order differential equation which contains the pattern g(t)=f'(t)+tf''(t) three times with different expressions for t.

How can I change the occurences of the patterns to the appropriate g(.)?

edit retag flag offensive close merge delete

Comments

@czsan: To display inline code, surround it within backticks `.

To display blocks of code, either indent them with 4 spaces, or select the corresponding lines and click the "code" button (the icon with '101 010'). Can you edit your question to do that?

slelievre gravatar imageslelievre ( 2016-07-20 09:23:50 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-07-19 21:35:41 +0100

jupsal gravatar image

Wildcards might help you here. For instance, I got this (not ideal) way to produce what you want:

x,y,t = var('x,y,t')
f = function('f'); g = function('g')
w0 = SR.wild(0); w1 = SR.wild(1)
pattern1 = w0*f(t).diff(t,2)(t = w0); pattern2 = w0*f(t).diff(t,2)(t = -w0)
eqn = f(x*y) + f(x*(1-y)) + f((1-x)*y) + f((1-x)*(1-y)) - f(x) - f(1-x) - f(y) -f(1-y)
eqn2d = eqn.diff(x,y)
eqn2d.subs( pattern1 == g(w0) - f(t).diff(t)(t=w0), pattern2 == g(-w0) + f(t).diff(t)(t=-w0) )

Now obviously it would be nice if Sage could just notice that pattern1 is related to pattern2, but I couldn't get it to work out (maybe someone better at Sage can?). It is worth noting that I also tried using

pattern = f(t).diff(t)(t = w0) + w0*f(t).diff(t,2)(t = w0)

but eqn2d seems to have no occurrences of that pattern: eqn2d.has(pattern) returns False. I would be curious to see if anyone has an explanation for this as well.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-18 11:04:58 +0100

Seen: 777 times

Last updated: Jul 19 '16