[Mathematica] Symbolic integrals simplification

  • Context: Mathematica 
  • Thread starter Thread starter guerom00
  • Start date Start date
  • Tags Tags
    Integrals Mathematica
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 5K views
guerom00
Messages
90
Reaction score
0
Hello everyone,

I have a symbolic expression like Integrate[a*f[t],{t,0,y}] and I want Mathematica to write it as a*Integrate[f[t],{t,0,y}] i.e. whatever does not depend explicitly on t is a constant which can be factored out of the integral.
How can I do this ?

TIA :smile:
 
Physics news on Phys.org
I do this kind of thing by using the ReplaceAll (/.) function to replace one expression by the expression I want. For example:

In[1]:=Stuff = g[Integrate[a f[t], {t, 0, y}]]

In[2]:=Stuff = Stuff /. Integrate[a f[t], {t, 0, y}] -> a Integrate[f[t], {t, 0, y}]

This way everything will get replaced with the expression in the form you want.

Hope this helps.
 
Thank you for your answer. Unfortunately, in my case it is just not practical as the expression I want to simplify is just too big :smile:
Any other idea ? :smile:
 
Hi guerom00,

guerom00 said:
Hello everyone,

I have a symbolic expression like Integrate[a*f[t],{t,0,y}] and I want Mathematica to write it as a*Integrate[f[t],{t,0,y}] i.e. whatever does not depend explicitly on t is a constant which can be factored out of the integral.
How can I do this ?

TIA :smile:

Can you give more information about your problem and what is represented by a in your complex expression? I mean, if I just type in the above expression from your post, it does factor the a out of the integral. Or if I define a to be some simple function of t, it does factor out constants. Can you give a simple example to show what's happening for you?
 
alphysicist said:
I mean, if I just type in the above expression from your post, it does factor the a out of the integral.

Really ?! Not for me…

[PLAIN]http://img413.imageshack.us/img413/993/picture2op.jpg

My real application is too complicated to be posted on the forum. That's symbolic expression for Magnus expansion of some matrix…
 
Last edited by a moderator:
guerom00 said:
Really ?! Not for me…

[PLAIN]http://img413.imageshack.us/img413/993/picture2op.jpg

My real application is too complicated to be posted on the forum. That's symbolic expression for Magnus expansion of some matrix…

Here's what it gives for me:

[PLAIN]http://img10.imageshack.us/img10/9724/mathtt.png

so I guess it must just be a difference in versions (unless somehow your a was defined from somewhere else). Sorry I can't help; hopefully someone else can reproduce the behavior.
 
Last edited by a moderator: