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...
Hello! I'm looking for help with this assignment. Complete a program in pseudocode and Python that performs the following tasks. Open the file called M4Lab1ii.py linked below these instructions in your M4 Content module in IDLE. Save as M4Lab1ii.py. Replace ii with your initials. [example for someone with the initials cc: M4Lab1cc.py] Complete Steps 1-7 as requested within the code’s comments. Run your program and test all four calculations, then exit the program. Save your program as M4Lab1ii.py using your...
Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a. while True: y = (x + a/x) / 2.0 if y == x: break x = y Part 2 Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between...
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...
USE Python 2.7(screen shot code with indentation and output exactly in the question) the task is: takes in a list of protein sequences as input and finds all the transmembrane domains and returns them in a list for each sequence in the list with given nonpolar regions and returns the lists for those. 1. This code should call two other functions that you write: regionProteinFind takes in a protein sequence and should return a list of 10 amino acid windows,...
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(...
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...
Part 1 Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a. while True: y = (x + a/x) / 2.0 if y == x: break x = y Part 2 Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the...
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...