Message Boards Message Boards

0
|
11048 Views
|
15 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Integrate integral C2 were the integand is a table and the output g1 table

Attachments:
15 Replies
Posted 10 years ago

Is the following what you want? You're given a table of pairs {f,C2} and you want to end up a table of pairs {f,(2*Integrate[C2])^0.5} ? If so, the following should work:

(* Create an example table where there are pairs {f,C1} *)
a = 5/100;
U = 13200;
L = 100;
C1 = Exp[-a (2 \[Pi] f \[Xi])/U ] * Cos[(2  \[Pi]  f \[Xi])/U]
C2 = Table[{f, C1}, {f, 0, 1000, 5}]

(* Take the table of pairs of {f,C1} and create a table of pairs \
{f,(2*Integrate[C1^0.5])^0.5} *)
C3 = Table[{C2[[i, 
     1]], (2 NIntegrate[C2[[i, 2]]^0.5, {\[Xi], 0, L}])^0.5}, {i, 
   Length[C2]}]

(When you say in your Notebook that the X's aren't right, is that because the X's (or rather your values for f) were integrated, too?)

POSTED BY: Jim Baldwin
Attachments:
POSTED BY: Anton Antonov

Luke, I think we are using different versions of Mathematica. What is your version?

POSTED BY: Anton Antonov
Attachments:
Posted 10 years ago
POSTED BY: Jim Baldwin

May be I do not understand the question. NIntegrate handles vector and matrix integrands. This is what I get with the table C2 at the end of the notebook in the original message:

In[16]:= NIntegrate[C2, {\[Xi], 0, 1}]

Out[16]= {{0., 1.}, {5., 0.99994}, {10., 0.999877}, {15., 
  0.999813}, {20., 0.999747}, {25., 0.999679}, {30., 0.999609}, {35., 
  0.999537}, {40., 0.999464}, {45., 0.999388}, {50., 0.999311}, {55., 
  0.999232}, {60., 0.999151}, {65., 0.999068}, {70., 0.998983}, {75., 
  0.998896}, {80., 0.998807}, {85., 0.998717}, {90., 0.998624}, {95., 
  0.99853}, {100., 0.998434}, {105., 0.998336}, {110., 
  0.998236}, {115., 0.998134}, {120., 0.998031}, {125., 
  0.997925}, {130., 0.997818}, {135., 0.997709}, {140., 
  0.997598}, {145., 0.997485}, {150., 0.99737}, {155., 
  0.997253}, {160., 0.997135}, {165., 0.997014}, {170., 
  0.996892}, {175., 0.996768}, {180., 0.996642}, {185., 
  0.996514}, {190., 0.996384}, {195., 0.996253}, {200., 
  0.996119}, {205., 0.995984}, {210., 0.995847}, {215., 
  0.995708}, {220., 0.995567}, {225., 0.995424}, {230., 
  0.99528}, {235., 0.995133}, {240., 0.994985}, {245., 
  0.994835}, {250., 0.994683}, {255., 0.994529}, {260., 
  0.994373}, {265., 0.994216}, {270., 0.994056}, {275., 
  0.993895}, {280., 0.993732}, {285., 0.993567}, {290., 
  0.993401}, {295., 0.993232}, {300., 0.993061}, {305., 
  0.992889}, {310., 0.992715}, {315., 0.992539}, {320., 
  0.992361}, {325., 0.992182}, {330., 0.992}, {335., 0.991817}, {340.,
   0.991632}, {345., 0.991445}, {350., 0.991256}, {355., 
  0.991065}, {360., 0.990873}, {365., 0.990678}, {370., 
  0.990482}, {375., 0.990284}, {380., 0.990084}, {385., 
  0.989883}, {390., 0.989679}, {395., 0.989474}, {400., 
  0.989267}, {405., 0.989058}, {410., 0.988847}, {415., 
  0.988635}, {420., 0.98842}, {425., 0.988204}, {430., 
  0.987986}, {435., 0.987766}, {440., 0.987544}, {445., 
  0.987321}, {450., 0.987096}, {455., 0.986869}, {460., 
  0.98664}, {465., 0.986409}, {470., 0.986176}, {475., 
  0.985942}, {480., 0.985706}, {485., 0.985468}, {490., 
  0.985228}, {495., 0.984987}, {500., 0.984743}, {505., 
  0.984498}, {510., 0.984251}, {515., 0.984002}, {520., 
  0.983752}, {525., 0.983499}, {530., 0.983245}, {535., 
  0.982989}, {540., 0.982731}, {545., 0.982472}, {550., 
  0.982211}, {555., 0.981947}, {560., 0.981682}, {565., 
  0.981416}, {570., 0.981147}, {575., 0.980877}, {580., 
  0.980605}, {585., 0.980331}, {590., 0.980055}, {595., 
  0.979778}, {600., 0.979499}, {605., 0.979218}, {610., 
  0.978935}, {615., 0.978651}, {620., 0.978364}, {625., 
  0.978076}, {630., 0.977786}, {635., 0.977495}, {640., 
  0.977201}, {645., 0.976906}, {650., 0.976609}, {655., 
  0.976311}, {660., 0.97601}, {665., 0.975708}, {670., 
  0.975404}, {675., 0.975098}, {680., 0.974791}, {685., 
  0.974481}, {690., 0.97417}, {695., 0.973858}, {700., 
  0.973543}, {705., 0.973227}, {710., 0.972909}, {715., 
  0.972589}, {720., 0.972268}, {725., 0.971944}, {730., 
  0.971619}, {735., 0.971293}, {740., 0.970964}, {745., 
  0.970634}, {750., 0.970302}, {755., 0.969968}, {760., 
  0.969633}, {765., 0.969295}, {770., 0.968956}, {775., 
  0.968616}, {780., 0.968273}, {785., 0.967929}, {790., 
  0.967583}, {795., 0.967236}, {800., 0.966887}, {805., 
  0.966536}, {810., 0.966183}, {815., 0.965828}, {820., 
  0.965472}, {825., 0.965114}, {830., 0.964755}, {835., 
  0.964393}, {840., 0.96403}, {845., 0.963665}, {850., 
  0.963299}, {855., 0.962931}, {860., 0.962561}, {865., 
  0.962189}, {870., 0.961816}, {875., 0.961441}, {880., 
  0.961064}, {885., 0.960686}, {890., 0.960306}, {895., 
  0.959924}, {900., 0.95954}, {905., 0.959155}, {910., 
  0.958768}, {915., 0.958379}, {920., 0.957989}, {925., 
  0.957597}, {930., 0.957204}, {935., 0.956808}, {940., 
  0.956411}, {945., 0.956013}, {950., 0.955612}, {955., 
  0.95521}, {960., 0.954806}, {965., 0.954401}, {970., 
  0.953994}, {975., 0.953585}, {980., 0.953175}, {985., 
  0.952763}, {990., 0.952349}, {995., 0.951933}, {1000., 0.951516}}
POSTED BY: Anton Antonov
Posted 10 years ago

I think the integral you want can be integrated explicitly:

L=.;
a=.;
f=.;
U=.;
c2 = Exp[-a(2\[Pi] f \[Xi])/U ] * Cos[(2  \[Pi]  f \[Xi])/U]
integral = Integrate[c2^2 \[Xi],{\[Xi],0,L}]

with the following result

E^(-((2 a f \[Pi] \[Xi])/U)) Cos[(2 f \[Pi] \[Xi])/U]

(U (a^2 (-1+a^2) U+(1+a^2)^2 U-E^(-((4 a f L \[Pi])/U)) ((1+a^2)^2 (4 a f L \[Pi]+U)+a^2 (4 a (1+a^2) f L \[Pi]+(-1+a^2) U) Cos[(4 f L \[Pi])/U]-2 a^2 (2 (1+a^2) f L \[Pi]+a U) Sin[(4 f L \[Pi])/U])))/(32 a^2 (1+a^2)^2 f^2 \[Pi]^2)

Then a table could be constructed with (2*integral)^0.5.

POSTED BY: Jim Baldwin
Posted 10 years ago

How about something like either the two ways below? One uses Map and the other uses Table.

L = 100
f[z_] := NIntegrate[z, {x, 0, L}]
t = {{1, Exp[-0.1 x] Cos[2.3 x]}, {2, Exp[-0.2 x] Cos[4.3 x]}}
Map[f, t[[All, 2]]]
Table[NIntegrate[t[[i, 2]], {x, 0, L}], {i, Length[t]}]
POSTED BY: Jim Baldwin

You don't need to use Map or Table. NIntegrate handles vector and matrix integrands:

In[358]:= NIntegrate[t[[All, 2]], {x, 0, L}]
Out[358]= {0.0188565, 0.0107933}
POSTED BY: Anton Antonov

This is a reply to all ---Thanks I provided equations as examples; do not want to apply equations in the integral.

My input (integrand) to the integral is a "Table"; see the Table at the end of the example in nb. I want to input a similar table into the integral; the table could have 500 (X, Y) terms; don't want to do this term by term. The "X" part is not effected by the integration; only the "Y" part. After integration only a table of (X,Y) terms (numbers) will remain. I'm going to do this about 150 times.

My customer provides me a the "table" which is a cross power spectral density and this integrated result is a generalize force.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract