Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Mathematica] Symbolic integrals simplification

  1. Jun 3, 2010 #1
    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:
     
  2. jcsd
  3. Jun 3, 2010 #2

    phyzguy

    User Avatar
    Science Advisor

    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.
     
  4. Jun 3, 2010 #3
    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:
     
  5. Jun 3, 2010 #4

    alphysicist

    User Avatar
    Homework Helper

    Hi guerom00,

    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?
     
  6. Jun 3, 2010 #5
    Really ?! Not for me…

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

    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: May 4, 2017
  7. Jun 3, 2010 #6

    alphysicist

    User Avatar
    Homework Helper

    Here's what it gives for me:

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

    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: May 4, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: [Mathematica] Symbolic integrals simplification
Loading...