Prev: Putting a Plot inside a Graphics function with other drawings
Next: Getting nice PlotMarkers, and some more ListPlot styling
From: Geico Caveman on 7 Mar 2010 05:13 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 ?
From: Bob Hanlon on 8 Mar 2010 06:22 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 ?
From: Alexei Boulbitch on 8 Mar 2010 06:22 (* This is your equation *) eq1 = f[t] + g[t]*y'[t] == h[t]*y[t]^2; (* That is how you would transform it also by hand *) eq2 = (eq1[[1]] - eq1[[1, 1]])/eq1[[1, 2, 1]]; eq3 = (eq1[[2]] + eq1[[1, 1]])/eq1[[1, 2, 1]]; (* That is the result *) eqRes = eq2 == eq3 \!\(\*SuperscriptBox["y", "\[Prime]", MultilineFunction->None]\)[t] == (f[t] + h[t] y[t]^2)/g[t] 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 ? -- Alexei Boulbitch, Dr., habil. Senior Scientist IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 Contern Luxembourg Phone: +352 2454 2566 Fax: +352 2454 3566 Website: www.iee.lu This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.
From: Geico Caveman on 9 Mar 2010 06:43 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" ?
From: magma on 11 Mar 2010 06:37
On Mar 9, 12:43 pm, Geico Caveman <spammers-go-h...(a)spam.invalid> wrote: > On 2010-03-08 04:22:07 -0700, Bob Hanlon <hanl...(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-h...(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" > ? No, you come to the wrong conclusion. The task you require is not too difficult to program. You can create a function which takes an equation (== sign) and rearranges everything as you wish. You need to learn programming Mathematica a bit. It is well worth. I have no time to do it for you right now. Perhaps some other member. Try yourself. It is a very rewarding experience. |