Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61303668
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, May 5, 19:59
Size
397 B
Mime Type
text/x-python
Expires
Tue, May 7, 19:59 (2 d)
Engine
blob
Format
Raw Data
Handle
17493095
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