I have an equation: $$ \frac{d\text{$\phi $0}}{dx} \left(-\frac{\text{A1}(x) \frac{d\text{A0}}{dx}}{\text{A0}(x)^2}+\frac{\frac{d\text{A1}}{dx}}{\text{A0}(x)}+\frac{\text{B1}(x) \frac{d\text{B0}}{dx}}{\text{B0}(x)^2}-\frac{\frac{d\text{B1}}{dx}}{\text{B0}(x)}-\frac{2 \text{c1}(x) \frac{d\text{c0}}{dx}}{\text{c0}(x)^2}+\frac{2 \frac{d\text{c1}}{dx}}{\text{c0}(x)}\right)-\frac{2 \text{B0}(x) \text{$\phi $0}(x)}{x^4}-\frac{2 \left(\frac{d^2\text{$\phi $0}}{dx^2}+\frac{2 \frac{d\text{$\phi $0}}{dx}}{x}\right) \frac{d\text{$\phi $1}}{dx}}{\frac{d\text{$\phi $0}}{dx}} $$ and I want to replace $$\frac{A1(x)}{A0(x)} $$ and $$\frac{B1(x)}{B0(x)} $$ and $$\frac{c1(x)}{c0(x)} $$ with u(x) , v(x) , w(x) what pattern can I use?
Asked
Active
Viewed 249 times
0
-
2please, provide the expression in Mathematica form as well. – garej Mar 13 '16 at 10:46
-
Could try this: How to group certain symbolic expressions? – Chris Degnen Mar 13 '16 at 10:48
2 Answers
1
Mathematica often is not cooperative with respect to simplification, but in this case it works well as follows.
-((2 b0[x] ϕ0[x])/x^4) + (-((a1[x] Derivative[1][a0][x])/a0[x]^2) +
Derivative[1][a1][x]/a0[x] - (b1[x] Derivative[1][b0][x])/b0[x]^2 +
Derivative[1][b1][x]/b0[x] + 2 (-((c1[x] Derivative[1][c0][x])/c0[x]^2) +
Derivative[1][c1][x]/c0[x])) Derivative[1][ϕ0][x] - (2 Derivative[1][ϕ1][x]
(2 Derivative[1][ϕ0][x] + (ϕ0^′′)[x]))/Derivative[1][ϕ0][x]
% //. {D[a1[x]/a0[x], x] -> D[u[x], x], D[b1[x]/b0[x], x] -> D[v[x], x],
D[c1[x]/c0[x], x] -> D[w[x], x]}
(* (-2*b0[x]*ϕ0[x])/x^4 + (Derivative[1][u][x] + Derivative[1][v][x] +
2*Derivative[1][w][x])*Derivative[1][ϕ0][x] -
(2*Derivative[1][ϕ1][x]*(2*Derivative[1][ϕ0][x] + Derivative[2][ϕ0][x]))/
Derivative[1][ϕ0][x] *)
bbgodfrey
- 61,439
- 17
- 89
- 156
0
there might be another way:
f[num_, den_, d_] := Module[{a1 = num, ao = den},
(a1/ao^2) -> (a1/ao) /. (a1/ao) -> d[x]]
a1[x]/ao[x]^2 /. f[a1[x], ao[x], u] (* u[x] *)
b1[x]/bo[x]^2 /. f[b1[x], bo[x], v] (* v[x] *)
c1[x]/co[x]^2 /. f[c1[x], co[x], w] (* w[x] *)
Ali Hashmi
- 8,950
- 4
- 22
- 42