====== MultiplyByEnergy ======
###
Multiplies a spectrum //G($\omega$)// by its energy, i.e. //Gnew($\omega$) = $\omega\times$G($\omega$)//.
###
===== Example =====
###
Take the spectrum defined in the file [[documentation:language_reference:objects:spectra:start|definitions.Quanty]] and multiply it by its energy.
###
==== Input ====
dofile("definitions.Quanty")
GOmega = Spectra.MultiplyByEnergy(G)
G.Print({{"file","Spectra.dat"}})
GOmega.Print({{"file","Spectra.MultiplyByEnergy.dat"}})
gnuplotScript = gnuplotHead .. [[
set output "Spectra.MultiplyByEnergy.ps"
plot "Spectra.dat" using 1:(-$3 ) title 'T1' with lines ls 1,\
"Spectra.MultiplyByEnergy.dat" using 1:(-$3) title 'T1 * Energy' with lines ls 2
]]
file = io.open("Spectra.MultiplyByEnergy.gnuplot", "w")
file:write(gnuplotScript)
file:close()
os.execute("gnuplot Spectra.MultiplyByEnergy.gnuplot")
os.execute("convert -density 1024 Spectra.MultiplyByEnergy.ps -resize 1024 Spectra.MultiplyByEnergy.png")
==== Result ====
###
The resulting picture is:
###
{{:documentation:language_reference:objects:spectra:functions:spectra.multiplybyenergy.png?nolink |}}
===== Available functions =====
{{indexmenu>.#1}}