Re: Separating functions
- To: mathgroup at smc.vnet.net
- Subject: [mg128471] Re: Separating functions
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Tue, 23 Oct 2012 00:55:57 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
Hi,
I have a problem in identification. In the middle of the solution of a wave propagation problem on a regular lattice using a separation-of-variables method, I get a function of the form
F(x,y,t)= f(x,y) g(t)
in which x,y are space coordinates and t is time. Both can be very complicated and vary from problem to problem, but Mathematica' Simplify is able to factor them. Here is a fairly trivial 1D example with an F output by //InputForm:
Bx*(-5*Em - 3*Em*=CE=BD + 2*a^2*=CF=81*=CF=89^2 - 2*a^2*=CE=BD^2*=CF=81*=CF=89^2 + 4*Em*(1 + =CE=BD)*Cos[(a*kx)/
Sqrt[2]] - Em*(-1 + =CE=BD)*Cos[Sqrt[2]*a*kx])*(Cos[t*=CF=89] - I*Sin[t*=CF=89]))/(2*c0^2*(-1 + =CE=BD^2)*=CF=81)
Here g(t)=(Cos[t*=CF=89] - I*Sin[t*=CF=89])). For more complicated 2D cases, F(x,y,t) becomes a array of product functions, each taking 20-30 lines.
Question: is there a way to separate f(x,y) and g(t) that does not require external intervention?
Thanks.
Hi, Carlos,
Your function does not seem to be a Mathematica expression. For this reason I just invent a function as an example. Assume here is your function:
F[x, y, t] = (Sin[x + y] + Exp[x*y])*(x + y)/(x^2*y^3)*
Sin[t]*(1 + Exp[Cos[t]])
((1 + E^Cos[t]) (x + y) Sin[t] (E^(x y) + Sin[x + y]))/(x^2 y^3)
Let us first transform it into a list:
List @@ F[x, y, t]
{1 + E^Cos[t], 1/x^2, 1/y^3, x + y, Sin[t], E^(x y) + Sin[x + y]}
This list inevitably contains terms either dependent upon t or upon x and y. If one calculates its derivative with respect to t, he will receive zeros on those places, where any function of x and y stays:
D[List @@ F[x, y, t], t]
{-E^Cos[t] Sin[t], 0, 0, 0, Cos[t], 0}
Than we can get their positions:
Position[D[List @@ F[x, y, t], x], 0]
{{1}, {3}, {5}}
If we collect the terms from those positions we end up with the terms dependent only upon x and y, but not t. Let us collect everything together:
ff = Fold[Times, 1,
Take[List @@ F[x, y, t], #] & /@
Position[D[List @@ F[x, y, t], t], 0] // Flatten]
((x + y) (E^(x y) + Sin[x + y]))/(x^2 y^3)
This is your function f[x,y]. To het g[t] just divide:
F[x, y, t]/ff
(1 + E^Cos[t]) Sin[t]
This is g.
Have fun, Alexei
Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG
Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44
e-mail: alexei.boulbitch at iee.lu