Deconvolution/1D: Difference between revisions

add RPL
(New post.)
(add RPL)
Line 1,432:
array F: -3 -6 -1 8 -6 3 -1 -9 -9 3 -2 5 2 -2 -7 -1
array G: 24 75 71 -34 3 22 -45 23 245 25 52 25 -67 -96 96 31 55 36 29 -43 -7
</pre>
 
=={{header|RPL}}==
{{trans|D}}
When translating to RPL, it is mandatory to take into account that:
* array indexes start at 1
* For loop variables, j shall be preferred to i, which is the name of the internal constant that equals √-1
* FOR..NEXT loops are executed at least once
≪ → g f
≪ g SIZE f SIZE - 1 + 1 →LIST 0 CON
1 g 1 GET f 1 GET / PUT
2 OVER SIZE '''FOR''' n
g n GET
1 n f SIZE - 0 MAX +
n 1 - '''FOR''' j
OVER j GET
f n j - 1 + GET * -
'''NEXT'''
f 1 GET / n SWAP PUT
'''NEXT'''
≫ ≫ '<span style="color:blue">DECONV</span>' STO
 
≪ [-8 -9 -3 -1 -6 7]
[-3 -6 -1 8 -6 3 -1 -9 -9 3 -2 5 2 -2 -7 -1]
[24 75 71 -34 3 22 -45 23 245 25 52 25 -67 -96 96 31 55 36 29 -43 -7]
→ h f g
≪ g f <span style="color:blue">DECONV</span> h ==
g h <span style="color:blue">DECONV</span> f == AND
≫ ≫ ‘<span style="color:blue">TASK</span>’ STO
{{out}}
<pre>
1: 1
</pre>
 
1,150

edits