Prev: Putting a Plot inside a Graphics function with other drawings
Next: Getting nice PlotMarkers, and some more ListPlot styling
From: dh on 12 Mar 2010 07:13 Hi Geico, here is a rule that puts all terms containing y to the left and those not containing y to the right of the equal sign: t1 = f[t] == h[t] y[t]^2 - g[t] y'[t]; t1 //. { Equal[x0___, x1___ + Longest[x2_ /; ! FreeQ[x2, y]] + x3___] :> Equal[-x2 + x0, x1 + x3], Equal[x1___ + Longest[x2_ /; FreeQ[x2, y]] + x3___, x0___] :> Equal[x1 + x3, x0 - x2] } Daniel On 09.03.2010 12:43, Geico Caveman wrote: > On 2010-03-08 04:22:07 -0700, Bob Hanlon<hanlonr(a)cox.net> said: > >> >> expr = f[t] + g[t] y'[t] == h[t] y[t]^2; >> >> Reverse[Expand[ >> Equal @@ >> Solve[expr /. >> f[t] -> -z*g[t], z][[1, 1]]] /. >> >> z -> -f[t]/g[t]] >> >> Derivative[1][y][t] - (h[t]*y[t]^2)/g[t] == -(f[t]/g[t]) >> >> Expand[ >> (First[expr] - Last[expr])/g[t]] == 0 >> >> f[t]/g[t] - (h[t]*y[t]^2)/g[t] + Derivative[1][y][t] == 0 >> >> >> Bob Hanlon >> >> ---- Geico Caveman<spammers-go-here(a)spam.invalid> wrote: >> >> ============= >> As a result of an Eliminate function, and subsequent (wrapper) >> simplification under some conditions, I am getting a non-linear >> differential equation. >> >> It looks like: >> >> f(t)+g(t) y'(t)=h(t) y^2(t) >> >> Is there a way to force mathematica to output this in the way a >> differential equation is best written: >> >> y'(t)+h(t)/g(t) y^(t) = -f(t)/g(t) >> >> or >> >> the transposed form with zero on RHS ? > > Thanks for your response (and the other person's response). > > So, I take it that there is no way to tell Mathematica to output it in > a standard form for differential equations, short of "doing it by hand" > ? > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh(a)metrohm.com> Internet:<http://www.metrohm.com> |