HomeWork... bleh!
There is no "Array" Type, Use the "Variant" Type to hold Arrays
Polynomials work on numbers, not Ranges (Cells). To set an array to cell values,
Dim Myarray as Variant
MyArray = Range("A1:C3").Value
To pass an Array to a Function that will return an array
Function Polys(Input As Variant) As Variant
Since the math only works on one value at a time, you will need to iterate thru each Value in the (2d)array
Dim Rw as Long, Cl As Long
For Rw = Lbound(Array, 1) to Ubound(array, 1)
For Cl = Lbound(Array, 2) to Ubound(array, 2)
x = Array(Rw, Cl)
xx = (x ^ 2 + 1 / 2 * x + 2)
Next
Next
You also need an array to hold the result of the math, It must be the same size (dimensions) as the input array
Dim Result As Variant
Redim Result(Ubound(Input, 1),Ubound(Input, 2))
In Code
For Rw = Lbound(Array 1) to Ubound(array 1)
For Cl = Lbound(Array 2) to Ubound(array 2)
x = Array(Rw, Cl)
Result(Rw, Cl) = (x ^ 2 + 1 / 2 * x + 2)
Finally, after all that, set the Function = Result
'
'
Next
Next
FunctionValues = Result
End Function
Your code should handle when only one value is passed to the Function
Function Polys(...)...
If IsArray(Input) then
'Do all the above coding
Else
Result = (Input^ 2 + 1 / 2 * Input + 2
End If
FunctionValues = Result
End Function