assignment 1a-d in Python. please explain your steps, thanks in
advance. This is the only information that we got for this practice
exercise, my teacher said that we should try to get the output
literally as in the example.
#source code:
import math
def fac(n):
if(n<=0):
return 1
else:
return n*fac(n-1)
print(fac(-1))
def cos1(x,n):
z=2
sum=1
for i in range(0,n):
if(i%2==0):
sum=sum-((x**z)/fac(z))
z=z+2
else:
sum=sum+((x**z)/fac(z))
z=z+2
return sum
def cos2(x,n):
return cos1(x,n)
i=0.0
print("x\tcos(x)\tcos1(x,10)\tcos2(x,10)\n")
while(i<=2.0):
print(str(i)+"\t"+str(math.cos(i))+"\t"+str(cos1(i,10))+"\t"+str(cos2(i,10)))
i=round(i+0.1,1)
#output:
#if you have any doubt comment below...
assignment 1a-d in Python. please explain your steps, thanks in advance. This is the only information...
Evaluate the integral for values of x from 0 to 3 in steps of 0.1 AND plot the integral. The program needs to be written in Python 3. Can only import numpy and matplotlib. CAN NOT use lambda functions or classes of any kind. Exercise 5.3: Consider the integral Plot of the integral from 0 to x 0.8 e: more hints You need to print E(x) with different x values. 0.6 1 Plotting the function will help The calculated values...
help with cse problem Lab Exercise #11 Assignment Overview You will work with a partner on this exercise during your lab session. Two people should work at one computer. Occasionally switch the person who is typing. Talk to each other about what you are doing and why so that both of you understand each step Part A: Class Date . Download the files for this laboratory exercise, then run the Python shell and enter the following commands: >>>import date >>help(...
Please Write in C++ (10-30) @ 11:55pm 1.9 HW7 This homework assignment gives you the opportunity to practice functions, functions that call other functions, reference variables, logical statements (what is meant by logical statement is a statement such as if, if/else if, switch), and input validation, HW7 (Graded out of 100) A talent competition has 5 judges, each of whom awards a score between 0 and 10 for each performer. Fractional scores, such as 8.3, are allowed. A performer's final...
C++ CODE /* This is program project 2 on page 695. * Before you begin the project, please read the project description * on page 695 first. * * Author: Your Name * Version: Dates */ #include <iostream> #include <cmath> #include <cassert> using namespace std; class Fraction { public: // constructor Fraction(int a, int b); // generate a fraction which is a/b Fraction(int a); // generate a fraction which is a/1 Fraction(); // generate a fraction which is 0/1. i.e...
use python IDEL Please highlight the answer 1 ווCIוסטIT Errors and Exceptions. There are two main types of errors: syntax errors and runtime errors. Syntax errors are detected by the Python interpreter before the program execution during the parsing stage (parsing is a process, during which the Python interpreter analyzes the grammatical structure of the program). Runtime errors are errors in a program that are not detected by the Python interpreter during its parsing stage. They are further divided into...
C++ CODE /* This is program project 2 on page 695. * Before you begin the project, please read the project description * on page 695 first. * * Author: Your Name * Version: Dates */ #include <iostream> #include <cmath> #include <cassert> using namespace std; class Fraction { public: // constructor Fraction(int a, int b); // generate a fraction which is a/b Fraction(int a); // generate a fraction which is a/1 Fraction(); // generate a fraction which is 0/1. i.e...
Python 3 Question Please keep the code introductory friendly and include comments. Many thanks. Prompt: The owners of the Annan Supermarket would like to have a program that computes the weekly gross pay of their employees. The user will enter an employee’s first name, last name, the hourly rate of pay, and the number of hours worked for the week. In addition, Annan Supermarkets would like the program to compute the employee’s net pay and overtime pay. Overtime hours, any...
python code，please！ Task 3:N ns Brute For In mathematics, the notion of permutation relates to the act of arranging all the members of a set into some sequence or order, or if the set is already ordered, rearranging (reordering) its elements, a process called permuting. The number of permutations on a set of n elements is given by n! (Read as n factorial). For example, there are 2!2 x 1- 2 permutations of 11,2), 2,1) and 3!-3x2x16 permutations of (1,2,3),...
C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a file. The encryption method being used on the file is called a shift cipher (Info Here). I will provide you with a sample encrypted message, the offset, and the decrypted message for testing. For this project I will provide you main.cpp, ShiftCipher.h, and ShiftCipher.cpp....
please show work!! Additional Algo 14-3 Standard Deviation of Demand Over Multiple Periods Each period, demand for apples is normally distributed with a mean of 290 and standard deviation of 70. Round your answer to two decimal places. What is the standard deviation of demand over 2 periods? Additional Algo 14-1 Inventory Position For a particular item, a firm has established an order-up-to level of 235 units. Currently, there are 65 units in stock, O backorders and 75 units scheduled...