Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have several functions (let a[x] and b[x]), defined as expressions with integrals and differentiations. I want to perform some manipulations with these expressions - for example, ask Mathematica to simplify a[x] + b[x] without evaluations of integrals. Hold doesn't works (as I tried) as I used to expand functions a[x] and b[x] first. I think, that I could replace Integrate and D with some meaningless heads integrate and d, and then expand functions with another meaningless symbol x, but I can't achieve this, because Mathematica tries first to perform integrations and fails.

Example:

a[t_] := Integrate[t, {x, -∞, ∞}]
b[t_] := Integrate[t^2, {x, -∞, ∞}]
a[t]+b[t]  (* this doesn't works, as it "evaluates" integrals; 
              I want to see simple sum *)

ADDED: I want to see something like myIntegrate[t, {x, -∞, ∞}]+myIntegrate[t^2, {x, -∞, ∞}]. Really, a and b are more complicated, and they contain more than one integrals. I want Mathematica to perform expression simplification keeping integrals unevaluated. I could manually modify definition for a and b, but they are rather complicated, and don't want to keep two copies (one with Integrate, and one with some myIntegrate).

share|improve this question
1  
What's the result you'd like to achieve for your example? –  Leonid Shifrin Apr 2 at 9:19
    
@LeonidShifrin Edited question, added an output example that I want to achieve. –  Yury Apr 2 at 13:46
    
@Yury As it looks after added explanation it seems me that you want to make unnecessary complication of the problem. In such a case as a first step I simply define the functions under the integrals (in your case t and t^2) and then operate with them, transforming and adding a Jacobian, if needed, but not integrating them. I integrate the result in a second step as soon as I am satisfied with the results of the first step.. My solution offered below is only useful, if you want to suppress the integration for the purpose of a demonstration, such as giving a talk. –  Alexei Boulbitch Apr 2 at 13:53

1 Answer 1

One way of doing this would be using Defer or HoldForm. For example, let us define the functions a and b as follows:

 a[t_] := Defer[Integrate[t, {x, -∞, ∞}]]
 b[t_] := Defer[Integrate[t^2, {x, -∞, ∞}]]

and

 a1[t_] := HoldForm[Integrate[Exp[-t], {x, 0, ∞}]]
 b1[t_] := HoldForm[Integrate[Exp[-t^2], {x, 0, ∞}]]

They both return unevaluated function. Then the function:

 mySum[expr1_, expr2_] := ReplacePart[expr1, {1, 1} -> expr1[[1, 1]] + expr2[[1, 1]]]

does the job.

mySum[a1[t], b1[t]]

The result looks as follows:

enter image description here

The same will take place with the functions a[t] and b[t]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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