# Defining a function as the integral of a previously defined function produces an error when when I try to plot it [closed]

I have a simple function defined in Mathematica, $m(L)$, and what I would like to do ideally is define a new function using the output of the indefinite integral of the old function, like so: $M(L) = \int m(L)\textrm{ }dl$.

Here is my code:

τ = 2.5/0.1;
η = 0.00002;
G = 5;
ρ = 1.8*10^-12;
m[L_] := (η*Exp[-L/(G*τ)])*2*ρ*L^3;
bigm[L_] := Integrate[m[L], L];


When I try to

Plot[bigm[L], {L, 0, 500}]


I get the error "Invalid Integration Variable or limit(s)".

I'm not sure where the error is, but I'm assuming I can't just define a function like this? How else could I assign a new function to the resultant function from the integral evaluation? Thanks!

• bigm is an indefinite integral so its argument must be a symbol for the integration to evaluate. The Plot calls bigm with a numeric argument which causes the Invalid Integration Variable error message. – Bob Hanlon Dec 7 '17 at 1:17

In addition to Nasser's approach you can also define bigm like this

τ = 2.5/0.1;
η = 0.00002;
G = 5;
ρ = 1.8*10^-12;

m[l_] := (η*Exp[-l/(G*τ)])*2*ρ*l^3

bigm[l_, l0_] = Integrate[m[\[FormalL]], {\[FormalL], l0, l}];


Then you can plot without using Evaluate because you will have already done the evaluation.

Plot[bigm[l, 0], {l, 0, 500}] or

Plot[bigm[l, 150], {l, 0, 500}] You need to apply Evaluate inside Plot

τ         = 2.5/0.1;
η         = 0.00002;
G0        = 5;
ρ         = 1.8*10^-12;
m[L0_]    := (η*Exp[-L0/(G0*τ)])*2*ρ*L0^3
bigm[L0_] := Integrate[m[L0],L0];

Plot[ Evaluate[bigm[L0]] , {L0,0,50} ] So that bigm[L0] gets evaluated, which is and then used by Plot. This is because Plot Holds its argument. • Worked like a charm, thanks! I've used Evaluate for my NDSolve plot environments but didn't know I had to do that here. – admbmb Dec 7 '17 at 1:42