# Multiplicate in an Integration with time [closed]

I am calculating the area of a step response.

I try to use this Integral Criterion for my Calculation. The time t is multiplicated with the control error xd raised to the second power.

The problem is, that I dont know how to multiplicate the time with the control error xd in Mathematica. So my Integral looks like this:

My code is:

  fp2pi[tn_, kpr_, kps_, t1_, t2_?NumberQ] :=
NIntegrate[(1 - (InverseLaplaceTransform[(kpr kps (1 + 1/(s tn)))/(
s (1 + s t1) (1 + s t2) (1 + (
kpr kps (1 + 1/(s tn)))/((1 + s t1) (1 + s t2)))), s,
t]))^2, {t, 0, Infinity}, WorkingPrecision -> 5];


Here I am writing the function in a list, with different values for tn:

list = {};
Do[{values = Function[x, fp2pi[x, 3, 1, 1, 2]] /@ {i},
AppendTo[list, values]
}, {i, 1, 5}];
Print[list];


Thank you :)

-

## closed as off-topic by Michael E2, RunnyKine, Simon Woods, rasher, Oleksandr R.May 4 '14 at 19:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, RunnyKine, Simon Woods, rasher, Oleksandr R.
If this question can be reworded to fit the rules in the help center, please edit the question.

NIntegrate[t * xd[t]^2, {t, 0, Infinity}], where xd[t] is your control error expression. –  Michael E2 May 4 '14 at 16:31
@MichaelE2 if I am doing like this fp2pi[tn_, kpr_, kps_, t1_, t2_?NumberQ] := NIntegrate[ t*(1 - (InverseLaplaceTransform[(kpr kps (1 + 1/(s tn)))/( s (1 + s t1) (1 + s t2) (1 + ( kpr kps (1 + 1/(s tn)))/((1 + s t1) (1 + s t2)))), s, t]))[t]^2, {t, 0, Infinity}, WorkingPrecision -> 5]; it gives me that error: NIntegrate::inumr: "The integrand t\ (1-12(1/12-(E^Times[<<2>>] (Times[<<2>>]+Sin[<<1>>]))/(12 Sqrt[239])))[t]^2 has evaluated to non-numerical values for all sampling points in the region with boundaries {{[Infinity],0}}. " –  Daniel Zemljic May 4 '14 at 17:22
@MichaelE2 and if I define xd = (1 - (InverseLaplaceTransform[(kpr kps (1 + 1/(s tn)))/( s (1 + s t1) (1 + s t2) (1 + ( kpr kps (1 + 1/(s tn)))/((1 + s t1) (1 + s t2)))), s, t])); , and then work with fp2pi[tn_, kpr_, kps_, t1_, t2_?NumberQ] := NIntegrate[t*xd[t]^2, {t, 0, Infinity}, WorkingPrecision -> 5]; it also gives me the same error. –  Daniel Zemljic May 4 '14 at 17:27
At the end of your integrand you have ...)[t]^2 -- why? I don't think the [t] is needed. By xd[t] I meant the whole expression. –  Michael E2 May 4 '14 at 17:29
In other words, you should take my first comment to mean that you should use NIntegrate[t * xd^2, {t, 0, Infinity}], where where xd is your control error expression. –  Michael E2 May 4 '14 at 17:32

Adding t * to the integrand produces a list of numbers without error:

fp2pi[tn_, kpr_, kps_, t1_, t2_?NumberQ] := NIntegrate[
t *
(1 - (InverseLaplaceTransform[(kpr kps (1 + 1/(s tn)))/(s (1 +
s t1) (1 +
s t2) (1 + (kpr kps (1 + 1/(s tn)))/((1 + s t1) (1 +
s t2)))), s, t]))^2,
{t, 0, Infinity},
WorkingPrecision -> 5];

list = {};
Do[{values = Function[x, fp2pi[x, 3, 1, 1, 2]] /@ {i},
AppendTo[list, values]}, {i, 1, 5}];
Print[list];

(* {{2.0262},{0.64149},{0.46002},{0.48530},{0.60192}} *)


Here is a more succinct way to get the (flat) list of numbers:

list = Function[x, fp2pi[x, 3, 1, 1, 2]] /@ Range[5]
(* {2.0262, 0.64149, 0.46002, 0.48530, 0.60192} *)

-
Haha thank you very much :) I dont know why it`s know working, because I have tried it like this a few days ago. However thank you –  Daniel Zemljic May 4 '14 at 17:56
@DanielZemljic You're welcome. –  Michael E2 May 4 '14 at 17:57