subject
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.

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Abrake has a normal braking torque of 2.8 kip in and heat-dissipating cast-iron surfaces whose mass is 40 lbm. suppose a load is brought to rest in 8.0 s from an initial angular speed of 1600 rev/min using the normal braking torque; estimate the temperature rise of the heat dissipating surfaces.
Answers: 3
question
Engineering, 04.07.2019 18:10
True or false (explain) (110)[111] is a slip system in bcc metals . the {111} family in fcc contains 8 planes. resolved shear stress (rss) in single crystals is just related to the applied stress. critical resolved shear stress (crss) in single crystal metals is direct proportional to the number of defects in the structure
Answers: 2
question
Engineering, 04.07.2019 18:20
Apiston-cylinder device contains 0.1 m3 of liquid water and 0.9 m3 of water vapor in equilibrium at 800 kpa. heat is transferred at constant pressure until the temperature of water reaches 350 Β°c. determine (a) the quality of water at the initial state (b) the work associated with this process, (c) the heat associated with this process.
Answers: 2
question
Engineering, 04.07.2019 19:10
Tom is having a problem with his washing machine. he notices that the machine vibrates violently at a frequency of 1500 rpm due to an unknown rotating unbalance. the machine is mounted on 4 springs each having a stiffness of 10 kn/m. tom wishes to add an undamped vibration absorber attached by a spring under the machine the machine working frequency ranges between 800 rpm to 2000 rpm and its total mass while loaded is assumed to be 80 kg a) what should be the mass of the absorber added to the machine so that the natural frequency falls outside the working range? b) after a first trial of an absorber using a mass of 35 kg, the amplitude of the oscillation was found to be 10 cm. what is the value of the rotating unbalance? c) using me-3.5 kg.m, find the optimal absorber (by minimizing its mass). what would be the amplitude of the oscillation of the absorber?
Answers: 3
You know the right answer?
In pyhton!

We could, in principle, represent a polynomial as a list. For instance, we co...
Questions
question
Mathematics, 14.09.2020 19:01
question
Chemistry, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
Biology, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
English, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
Social Studies, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
English, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
French, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
Biology, 14.09.2020 19:01
question
Mathematics, 14.09.2020 19:01
question
Biology, 14.09.2020 19:01