0
$\begingroup$

I wanted to see what would happen if I took

    (E^(-3 (1 + d) t) (1 + 3 d + 2 E^(3 (1 + d) t) - 
   E^((-3 - d) t + 3 (1 + d) t) - 3 d E^((-3 - d) t + 3 (1 + d) t) + 
   6 E^((-3 - d) t + 3 (1 + d) t) C[1] + 
   6 d E^((-3 - d) t + 3 (1 + d) t) C[1]))/(6 (1 + d))

And substituted

1/(3 + 3 d) + C[1]

for some arbitrary variable w

So I wrote:

(E^(-3 (1 + d) t) (1 + 3 d + 2 E^(3 (1 + d) t) - 
E^((-3 - d) t + 3 (1 + d) t) - 3 d E^((-3 - d) t + 3 (1 + d) t) + 
6 E^((-3 - d) t + 3 (1 + d) t) C[1] + 
6 d E^((-3 - d) t + 3 (1 + d) t) C[1]))/(6 (1 + d)) /. 
 1/(3 + 3 d) + C[1] -> w

And I got the same output as input:

enter image description here

So I am wondering how to substitute out the C1s and replace them with w. Thank you for your help.

$\endgroup$
5
  • 1
    $\begingroup$ it works for me. Did you try with clean kernel? !Mathematica graphics $\endgroup$
    – Nasser
    Jul 27, 2019 at 13:21
  • $\begingroup$ Yes, I've added a picture. $\endgroup$ Jul 27, 2019 at 13:41
  • $\begingroup$ So ClearAll[t,d] didn't work, but ClearAll[t,d,x,y,w] did. However, all it did was to give me the initial expression with no modifications. I want to get rid of the C1s and to put in w. How do I make mathematics do this? I'll edit the question accordingly. $\endgroup$ Jul 27, 2019 at 13:49
  • $\begingroup$ I want to get rid of the C1s and to put in w then just do stuff /. C[1] -> w $\endgroup$
    – Nasser
    Jul 27, 2019 at 13:57
  • $\begingroup$ What I meant was: I want to get rid of the C1s in such a way that 1/(3 + 3 d) + C[1] -> w . So there are no C1s remaining but w is in the expression $\endgroup$ Jul 27, 2019 at 14:00

2 Answers 2

1
$\begingroup$

If the objective is to replace the C[1], write your replacement that way.

expr /. C[1] -> w - 1/(3 + 3 d) // Simplify
(* 
  (1 + 2*E^(3*(1 + d)*t) + E^(2*d*t)*(-3 + 6*w) + d*(3 + E^(2*d*t)*(-3 + 6*w)))/
  (E^(3*(1 + d)*t)*(6*(1 + d)))
*)

The pattern to the left of -> must match the FullForm of the subexpression you're attempting to rewrite, and for a complicated subexpression, that's tricky.

$\endgroup$
0
$\begingroup$

Does this produce the result you are looking for?

(E^(-3 (1 + d) t) (1 + 3 d + 2 E^(3 (1 + d) t) - 
      E^((-3 - d) t + 3 (1 + d) t) - 
      3 d E^((-3 - d) t + 3 (1 + d) t) + 
      6 E^((-3 - d) t + 3 (1 + d) t) C[1] + 
      6 d E^((-3 - d) t + 3 (1 + d) t) C[1]))/(6 (1 + d)) /. C[1] -> w
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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