Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60180894
quadratic_function.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Apr 28, 03:06
Size
397 B
Mime Type
text/x-python
Expires
Tue, Apr 30, 03:06 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17203465
Attached To
R9484 sp4e-homework-lars-bertil
quadratic_function.py
View Options
import
numpy
as
np
# This function implements S(x) as given in the exercise sheet
def
quadratic_function
(
x
):
# create column vector of input array
x
.
reshape
(
-
1
,
1
)
# create matrix and vector coefficients of S(x) given in exercise sheet
A
=
np
.
array
([[
4
,
0
],
[
1
,
3
]])
b
=
np
.
array
([
0
,
1
])
.
transpose
()
# return S(x)
return
(
x
.
transpose
()
@
A
)
@
x
-
x
.
transpose
()
@
b
Event Timeline
Log In to Comment