How to resolve the algorithm Apply a callback to an array step by step in the RLaB programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Apply a callback to an array step by step in the RLaB programming language

Table of Contents

Problem Statement

Take a combined set of elements and apply a function to each element.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Apply a callback to an array step by step in the RLaB programming language

Source code in the rlab programming language

>> x = rand(2,4)
 0.707213207   0.275298961   0.396757763   0.232312312
 0.215619868   0.207078017   0.565700032   0.666090571
>> sin(x)
 0.649717845   0.271834652   0.386430003   0.230228332
 0.213952984   0.205601224   0.536006923   0.617916954

x = rand(2,4);
y = zeros(2,4);
for (i in 1:2)
{
  for (j in 1:4)
  {
    y[i;j] = sin( x[i;j] );
  }
}

x = <<>>;
for (i in 1:9)
{
  x.[i] = rand();
}

y = <<>>;
for (i in members(x))
{
  y.[i] = sin( x.[i] );
}

  

You may also check:How to resolve the algorithm Terminal control/Unicode output step by step in the Phix programming language
You may also check:How to resolve the algorithm Guess the number/With feedback step by step in the Clojure programming language
You may also check:How to resolve the algorithm Draw a pixel step by step in the ZX Spectrum Basic programming language
You may also check:How to resolve the algorithm Array concatenation step by step in the langur programming language
You may also check:How to resolve the algorithm Averages/Pythagorean means step by step in the F# programming language