0
$\begingroup$

Suppose I have an expression where random numbers in exponentials are multiplied and this expression will keep on iterating such that more of such terms will occur. But I need to keep those terms as separate instances since each of them contains a separate random number. Although HoldForm[] keeps the expression from being evaluated but it doesn't solve the problem.

For example, I have this Exp[RandomReal[]]^2, but I need this Exp[RandomReal[]]*Exp[RandomReal[]], without getting multiplied into whole squared form.

Thanks, in advance for helping.

$\endgroup$
4
  • $\begingroup$ Inactivate[Exp[RandomReal[]] Exp[RandomReal[]] Exp[RandomReal[]], Times]? $\endgroup$
    – kglr
    Jul 5, 2018 at 7:25
  • $\begingroup$ ... or Inactivate[Exp[RandomReal[]] Exp[RandomReal[]] Exp[RandomReal[]], Times|Exp]? $\endgroup$
    – kglr
    Jul 5, 2018 at 7:26
  • $\begingroup$ Thanks, kglr! It worked. $\endgroup$
    – Devil
    Jul 5, 2018 at 7:38
  • $\begingroup$ posted the comments as answer. $\endgroup$
    – kglr
    Jul 5, 2018 at 7:48

1 Answer 1

1
$\begingroup$

You can Inactivate the functions Times or both Times and Exp:

Inactivate[Exp[RandomReal[]] Exp[RandomReal[]] Exp[RandomReal[]], Times] (* or *)
Inactivate[Exp[RandomReal[]] Exp[RandomReal[]] Exp[RandomReal[]], Times|Exp]

enter image description here

$\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.