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, 04.07.2019 18:10
Coiled springs ought to be very strong and stiff. si3n4 is a strong, stiff material. would you select this material for a spring? explain.
Answers: 2
Engineering, 04.07.2019 18:10
Draw the engineering stress-strain curve for (a) bcc; (b) fcc metals and mark important points.
Answers: 1
Engineering, 04.07.2019 18:20
Vibration monitoring this technique uses the noise or vibration created by mechanical equipment and in seme cases by plant systems to detemine their actual condtion. a)- true b)- false
Answers: 2
Engineering, 04.07.2019 18:20
Refrigerant-134a enters the compressor of a refrigerator as superheated vapor at 0.14 mpa and -10Β°c at a rate of 0.05 ka/s and leaves at 0.8 mpa and 50Β°c. the refrigerant is cooied in the condenser to 0.72 mpa and 26'c. it is then throttled to 0.15 mpa. sketch the t-s diagram for the system and evaluate: 6) the rate of heat removai from the refrigerated space (kw), it) the power input to the compressor (kw), ii) the isentropic efficiency of the compressor (%), and iv) the cop of the refrigerator.
Answers: 2
Mathematics, 19.12.2020 01:00
Geography, 19.12.2020 01:00
Social Studies, 19.12.2020 01:00
History, 19.12.2020 01:00
Mathematics, 19.12.2020 01:00
Mathematics, 19.12.2020 01:00
Mathematics, 19.12.2020 01:00
Mathematics, 19.12.2020 01:00
Chemistry, 19.12.2020 01:00
Mathematics, 19.12.2020 01:00
SAT, 19.12.2020 01:00