Write a program that determines the Riemann integral of a function f on the interval [0,1] in different ways.

Write a program that determines the Riemann integral of a function f on the interval [0,1] in different ways.Output the results of the calculations and the plot for the function f= sin(πx) as an example.  First divide the interval into n equal sub intervals   and then determine the values of the corresponding upper and lower sums   Now calculate the integral of f symbolically using SymPy and numerically using np.trapz() and again output the results using the example f= sin(πx).Plot the function f and the staircase functions belonging to the upper and lower sum using Matplotlib (all together in one plot).

Read More

Write a program that encodes an input plaintextxwith a one-time pad.Start by assigning a number to each letter,a→0,…,z→25, using string.asciilowercase to get the alphabet.

Write a program that encodes an input plaintextxwith a one-time pad.Start by assigning a number to each letter,a→0,…,z→25, using string.asciilowercase to get the alphabet. For simplicity, you can assume that x contains only the letters a,b,c,…z.First write two functions that you can use to convert a given text intoa list of numbers (and back to the ̈uck).Now you can encode the plaintext by linking it to the one-time pad. Use a list of random numbers from 0 to 25 as the one-time pad, which is exactly as long as the plaintext x to be encrypted. To encrypt, calculate (digit by digit) x⊕p, where ⊕ means a bitwise xor ˆ. Now output the generated ciphertext y to the user.The programme should also be able to decrypt again. What plaintext do you get if you give y = [21, 16, 20, 4, 22, 6, 14, 2, 2, 29, 17, 5, 16,27, 20,…

Read More

A donut is defined by the following parameter representation: Write a classDonut whose constructor takes over R and r. ̈Consider sensible default values.

A donut is defined by the following parameter representation: Write a classDonut whose constructor takes over R and r. ̈Consider sensible default values.  If R > r does not apply, then issue a warning to the user and adjust R so that the assurance is fulfilled.Use NumPy to implement the methods for x,y and z.Find out how to calculate the surface area and volume of the donut and implement both methods.The method ___str___ should return a string repr ̈presentation.  Also implement the operator>: one donut should be larger than the other if its volume is larger.Plot the donut on the screen with the method show and the matplotlib (tip: the NumPy function meshgrid is helpful here).  Set the boundaries for the three axes so that the donut fits well in the plot window, turn off the axis labels and use the OrRd colormap.  Set the viewing height of the plot…

Read More

Create a list of the respective energy values for a mini-drone with a mass of 250g, a midi-drone with a mass of 570g and a maxi-drone with a mass of 900g for the heights 1 to 120 metres (step size 1m).

Attention:You must not use loops in this task! A drone of massem(in kilograms) has a potential energy (in joules) of E=mgh(gis the acceleration due to gravity ofrounded 9.81m/s2) at height h (in metres). Create a list of the respective energy values for a mini-drone with a mass of 250g, a midi-drone with a mass of 570g and a maxi-drone with a mass of 900g for the heights 1 to 120 metres (step size 1m).  Plot the list with Matplotlib so that the x- and y-axis start at 1 (and end at sensible maximum values) and the values as points of three different colours are plotted.  Add a title and axis labels. At what height do the three drones exceed 79J? Give the result in one line in text form.  Our mini-drone flies at a height of 30m with a horizontal speed of 10m/s. The battery runs out and the drone…

Read More

Write a program that reads a list of scores and then assigns grades based on the following scheme:

Write a program that reads a list of scores and then assigns grades based on the following scheme: The grade is A if score is >= best – 10. The grade is B if score is >= best- 20. The grade is C if score is > = best – 30 The grade is D if score is >= best-40. The grade is F otherwise Output:   Solved by verified study co-pilot   All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area. Add to Solution Cart Contact Us Student review: (31 ratings) 30 out of 31 people found this solution helpful.

Read More