2 More specific title; corrected spelling, removed greetings
source | link

Loop over a list of lists and apply a function with different arguments for each list

Greetengs,im totally new here. I cant fined answer at other simular questions, so i create a new one.

I have optical spectra in the following format:

spectra = {{x1,y1},{x2,y2},...,{xn,yn}}

Where x -are wavenumbers and y -is intensity. I want to modify my intensity, e.g. divide by 3. So iI use nextthe following code for that:

modyfiedspectra = Transpose[{spectra[[All, 1]], spectra[[All, 2]]/3}]

But when I have a list of different spectra, i dontI don't know how to loop over it. For example I have a list of 2 spectra:

listofspectra = {{{x1,y1},{x2,y2},...,{xn,yn}},{{x1,y1},{y2,y2},...,{xn,yn}}}

And now iI want to divide intensity of each spectra by different numbers. E.g:

divideby = {3,5}

So, output should be something like that:

(*{{{x1,y1/3},{x2,y2/3},...,{xn,yn/3}},{{x1,y1/5},{x2,y2/5},...,{xn,yn/5}}}*)

So the question: how to loop over a list of lists and apply a function with different arguments for each list?

P.S. Sorry for my English.

Loop over list of lists

Greetengs,im totally new here. I cant fined answer at other simular questions, so i create a new one.

I have optical spectra in the following format:

spectra = {{x1,y1},{x2,y2},...,{xn,yn}}

Where x - wavenumbers and y - intensity. I want modify my intensity, e.g. divide by 3. So i use next code for that:

modyfiedspectra = Transpose[{spectra[[All, 1]], spectra[[All, 2]]/3}]

But when I have list of different spectra, i dont know how to loop over it. For example I have list of 2 spectra:

listofspectra = {{{x1,y1},{x2,y2},...,{xn,yn}},{{x1,y1},{y2,y2},...,{xn,yn}}}

And now i want divide intensity of each spectra by different numbers. E.g:

divideby = {3,5}

So, output should be something like that:

(*{{{x1,y1/3},{x2,y2/3},...,{xn,yn/3}},{{x1,y1/5},{x2,y2/5},...,{xn,yn/5}}}*)

So the question: how to loop over list of lists and apply function with different arguments for each list?

P.S. Sorry for my English.

Loop over a list of lists and apply a function with different arguments for each list

I have optical spectra in the following format:

spectra = {{x1,y1},{x2,y2},...,{xn,yn}}

Where x are wavenumbers and y is intensity. I want to modify my intensity, e.g. divide by 3. So I use the following code for that:

modyfiedspectra = Transpose[{spectra[[All, 1]], spectra[[All, 2]]/3}]

But when I have a list of different spectra, I don't know how to loop over it. For example I have a list of 2 spectra:

listofspectra = {{{x1,y1},{x2,y2},...,{xn,yn}},{{x1,y1},{y2,y2},...,{xn,yn}}}

And now I want to divide intensity of each spectra by different numbers. E.g:

divideby = {3,5}

So, output should be something like that:

(*{{{x1,y1/3},{x2,y2/3},...,{xn,yn/3}},{{x1,y1/5},{x2,y2/5},...,{xn,yn/5}}}*)

So the question: how to loop over a list of lists and apply a function with different arguments for each list?

1
source | link

Loop over list of lists

Greetengs,im totally new here. I cant fined answer at other simular questions, so i create a new one.

I have optical spectra in the following format:

spectra = {{x1,y1},{x2,y2},...,{xn,yn}}

Where x - wavenumbers and y - intensity. I want modify my intensity, e.g. divide by 3. So i use next code for that:

modyfiedspectra = Transpose[{spectra[[All, 1]], spectra[[All, 2]]/3}]

But when I have list of different spectra, i dont know how to loop over it. For example I have list of 2 spectra:

listofspectra = {{{x1,y1},{x2,y2},...,{xn,yn}},{{x1,y1},{y2,y2},...,{xn,yn}}}

And now i want divide intensity of each spectra by different numbers. E.g:

divideby = {3,5}

So, output should be something like that:

(*{{{x1,y1/3},{x2,y2/3},...,{xn,yn/3}},{{x1,y1/5},{x2,y2/5},...,{xn,yn/5}}}*)

So the question: how to loop over list of lists and apply function with different arguments for each list?

P.S. Sorry for my English.