1
$\begingroup$

I have two symbolic differential equations and I want to used them in another equation as follows:

eq1 = Dt[Ai] == mt*δfm + 2*Ω^2;
eq2 = Dt[Ri] == h*δmm + 2*Ω^2;
ya = Ai*Ri;
Dt[ya]

Ri Dt[Ai] + Ai Dt[Ri]

Instead, I want output that inserts Dt[Ai] and Dt[Ri] and gives the simplified form.

$\endgroup$

closed as off-topic by bbgodfrey, user9660, MarcoB, Bob Hanlon, Öskå Jan 8 '16 at 18:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – bbgodfrey, Community, MarcoB, Bob Hanlon, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Jan 7 '16 at 1:23
  • $\begingroup$ Do you not get error messages from your code? $\endgroup$ – Michael E2 Jan 7 '16 at 1:24
  • $\begingroup$ Perhaps ya = Ai Ri; Simplify[Dt[ya] /. {Dt[Ai]->h δfm + 2 Ω^2, Dt[Ri]->mt δmm + 2 Ω^2}] $\endgroup$ – Bill Jan 7 '16 at 1:44
  • $\begingroup$ Hi i mistakenly posted the wrong equations. I have updated the post. $\endgroup$ – aly Jan 7 '16 at 2:18
  • $\begingroup$ @bill & Michael. Thanks for your quick answer. I want a solution with the way i have defined because i will need those differential equation several times in many equations and following the routine you recommended will be bulky when used every time. $\endgroup$ – aly Jan 7 '16 at 2:30
2
$\begingroup$

If you want teach Mathematica to make the substitution automatically, you should define special evaluation rules for Dt[Ai] and Dt[Ri] with UpSet (^=).

Dt[Ai] ^= mt*\[Delta]fm + 2*\[CapitalOmega]^2;
Dt[Ri] ^= h*\[Delta]mm + 2*\[CapitalOmega]^2;
ya = Ai Ri;
Dt[ya]

Ri (mt δfm + 2 Ω^2) + Ai (h δmm + 2 Ω^2)

$\endgroup$
1
$\begingroup$

You can also replace the head of your equations, turning them temporarily into Rule objects for the purpose of the substitution.

eq1 = Dt[Ai] == mt*δfm + 2*Ω^2;
eq2 = Dt[Ri] == h*δmm + 2*Ω^2;
ya = Ai*Ri;
Dt[ya]

Dt[ya] /. Rule @@@ {eq1, eq2}

(* Ri Dt[Ai] + Ai Dt[Ri] *)

(* Ri (mt δfm + 2 Ω^2) + Ai (h δmm + 2 Ω^2) *)
$\endgroup$
0
$\begingroup$

I got the solution that satisfies me:

eq1 = Dt[Ai] == mt*δfm + 2*Ω^2
eq2 = Dt[Ri] == h*δmm + 2*Ω^2;
ya = Ai*Ri;

result = Simplify[Dt[ya] /.{Dt[Ai] -> eq1, Dt[Ri] -> eq2}]

I am satisfied with the solution but if you have a better solution, please share. Thanks to Bill as I derived the solution following his answer.

$\endgroup$
  • $\begingroup$ This gives result in form of __ == __ == __, is this really what you expect? $\endgroup$ – Kuba Jan 8 '16 at 7:59
  • $\begingroup$ It gives me the correct results $\endgroup$ – aly Jan 30 '16 at 13:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.