Passing each element of a list as an argument to a single parameter function [closed]

Consider a single parameter function:

g[w_] := w^2 +1;

Consider a list:

slist= Range[0, 100, 1];

Now when I apply function g to slist :

g @@ slist

I get the output:

g[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]

How do I pass each element of the list so that w^2+1 gets evaluated using each element of slist as argument.

=================

=================

2 Answers
2

=================

g[w_] := w^2 + 1
slist = Range[0, 100, 1];
g[slist]

{1,2,5,10,17,26,37,50,65,82,101,122,145,170,197,226,257,290,325,362,401,442,485,530,577,626,677,730,785,842,901,962,1025,1090,1157,1226,1297,1370,1445,1522,1601,1682,1765,1850,1937,2026,2117,2210,2305,2402,2501,2602,2705,2810,2917,3026,3137,3250,3365,3482,3601,3722,3845,3970,4097,4226,4357,4490,4625,4762,4901,5042,5185,5330,5477,5626,5777,5930,6085,6242,6401,6562,6725,6890,7057,7226,7397,7570,7745,7922,8101,8282,8465,8650,8837,9026,9217,9410,9605,9802,10001}

or

Map[g, slist]

or

g /@ slist

Some alternatives for thought food…

slist /. x_Integer:>g[x]

…or…

Last@Last@Reap[Scan[Sow[g[#]]&,slist]]