In pyhton!

We could, in principle, represent a polynomial as a list. For instance, we co...

Engineering, 13.03.2020 19:52, pearlielb

# In pyhton!

We could, in principle, represent a polynomial as a list. For instance, we could write

1+2x−3x2+2x41+2x−3x2+2x4

as

[ 1,2,-3,0,2

where the ith index corresponds to xixi . If we wrote a polynomial this way, we would also like an easy way to evaluate that polynomial for a specified value of xx ; i. e., for x=1.5x=1.5 ,

1+2×1.5−3×1.52+2×1.54=7.3751+2×1.5− 3×1.52+2×1.54=7.375

Compose a function polyeval( coefs, x ) which accepts a list of polynomial coefficients from lowest to highest order (as above) and a value x at which to evaluate the polynomial, and returns a float corresponding to the value of the polynomial evaluated at x.

A good way to start your code would be:

def polyeval( coefs, x ):

value = ??? # an accumulator pattern

# with some kind of loop here

return value

For instance, polyeval( [ 1,1,0,1 ],1 ) (1+x+x31+x+x3 for x=1x=1 ) should return 3.0. polyeval( [ 0,1,0,-2,1 ],-1 ) (x−2x3+x4x−2x3+x4 for x=−1x=−1 ) should return 2.0.

Answers: 1

Engineering, 03.07.2019 14:10, bryneosburn

Line joining liquid phase with liquid and solid phase mixture is known as: a) liquidus b) solidus c) tie line d) none of the mentioned

Answers: 2

Engineering, 03.07.2019 15:10, breannaasmith1122

Two flowing streams of argon gas are adiabatically mixed to form a single flow/stream. one stream is 1.5 kg/s at 400 kpa and 200 c while the second stream is 2kg/s at 500 kpa and 100 ? . it is stated that the exit state of the mixed single flow of argon gas is 150 c and 300 kpa. assuming there is no work output or input during the mixing process, does this process violate either the first or the second law or both? explain and state all your assumptions.

Answers: 1

Engineering, 04.07.2019 03:10, lauriepdx17

What precautions should you take to prevent injuries when dealing with heavy loads?

Answers: 1

Engineering, 04.07.2019 18:10, DestyHilBan1183

Adouble-strand no. 60 roller chain is used to transmit power between a 13-tooth driving sprocket rotating at 300 rev/min and a 52-tooth driven sprocket. a) what is the allowable horsepower of this drive? b) estimate the center-to-center distance if the chain length is 82 pitches. c) estimate the torque and bending force on the driving shaft by the chain if the actual horsepower transmitted is 30 percent less than the corrected (allowable) power.

Answers: 3

Chemistry, 21.04.2020 22:31

History, 21.04.2020 22:31

Biology, 21.04.2020 22:31

English, 21.04.2020 22:31