Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

C program files google drive googledrivesync exe

22/11/2021 Client: muhammad11 Deadline: 2 Day

Python Homework

Submit on Canvas a zip file containing your solution code for each problem (just the .py, .h, and .cpp files, please do not submit the solution/project files), turn in at least one .py and one .cpp file for each problem. Each problem specifies what you should title the file containing your solution so that the autograder can find it. Incorrectly named programs will not be graded and thus will get 0 points for the problem.

Since the assignment will be graded using an automated grading system you should have your program’s output match the sample output shown. If your program fails to run using Visual Studio 2017 it will receive zero points. If your program fails to run properly (runtime errors or wrong output) points will be deducted based on how correct is the program.

If you have any questions or concerns about the assignment do not hesitate to post on the discussion forum on canvas, send us message on canvas, or see us after class or during office hours.

Students are expected to write their source code from scratch, those who copy code from each other or web (including from Canvas examples) will be reported for cheating. We will also look at your code so do not just hard-code the answer and print it.

You have to write the solution both in Python and C++ (as exten- sion module). We recommend to first solve the problem in Python and then write the C++ extension code. Further, start with the pro- vided template. We will not penalize for 'self': unreferenced formal parameter warning. Additionally, the timings may differ, but we still expect you to match the formating, i.e, show the required number of significant digits. All input reading, timing, and printing must be done in Python.

1

1. Factorial: 10 points Files: factorial.py, factorialmodule.cpp

Compute a factorial of a given number, first in Python and then using C++ extension. The definition of a factorial of number n is as follows.

n! = n(n − 1)(n − 2)...1 (1)

Use int64_t in the C++ extension for the computations. In the wrapper function use PyLong_AsLongLong to convert from PyObject to int64_t and PyLong_FromLongLong to convert int64_t back to PyObject. Match the output format and use the provided timing code to measure the elapsed time for Python and C++ code.

Example Input

2 10 40

Expected Output

Case 0: Python: factorial of 10 is 3628800 Python: elapsed time 0.0056 ms C++: factorial of 10 is 3628800 C++: elapsed time 0.0112 ms Case 1: Python: factorial of 40 is 815915283247897734345611269596115894272000000000 Python: elapsed time 0.0073 ms C++: factorial of 40 is -70609262346240000 C++: elapsed time 0.0112 ms

2. Root Finding: 20 points File: root_finding.py, root_findingmodule.cpp

This assignment is to use Newton’s method to find the roots of an equation, starting the search at some point and finding the root to some desired accuracy or number of iterations. The equation you will be computing roots of is:

x5 + 6x4 + 3x3 − x − 50 (2)

2

Newton’s method works by starting from some (hopefully close) guess of the root and then iteratively updating it until we get close enough to the actual root of the equation. In other words, you iteratively compute the next best guess for the root using the following formula until convergence:

xn+1 = xn − f(xn) f ′(xn)

(3)

Your program does not need to compute f ′(x), instead compute the derivative by hand (or using WolframAlpha or however you prefer) and write the expression in your program. You can test for convergence by checking if xn+1 ≈ xn, specifically you should stop the root finding when the relative error has reached some threshold:

∣∣∣∣xn+1 − xnxn+1 ∣∣∣∣ ≤ ε (4)

or you have executed n iterations of the root finding method. You can find more information about Newton’s method on Wikipedia.

For computing absolute values, sine, cosine and powers you will want to use some of the functions in the cmath header (#include ), documented here.

The input to your program for each case will be the x value to start the search at followed by the number of iterations n and the tolerance ε. Your program should then find the root of equation (1) starting the search at x until the root is found to the desired tolerance or you have run the maximum number of iterations. When your program has found the root to within the desired precision or run out of iterations print it out to match the format below. Your program will need to run for at least one iteration to find the error between the guess and where we think the root is, even if the guess is exactly on.

You can reuse our/your solution from the previous homework.

Example Input

6 -5.2 100 1e-10 -1.0 100 1e-6 -5 1000 1e-10 1 10 1e-4 -7 100 1e-7 1 5 1e-10

Expected Output

3

https://en.wikipedia.org/wiki/Newton's_method
http://en.cppreference.com/w/cpp/header/cmath
Case 0: Python: root is -5.390653718237257 Python: elapsed time 0.0347 ms C++: root is -5.390653718237257 C++: elapsed time 0.0020 ms Case 1: Python: root is -5.390653718237257 Python: elapsed time 0.0188 ms C++: root is -5.390653718237257 C++: elapsed time 0.0017 ms Case 2: Python: root is -5.390653718237257 Python: elapsed time 0.0112 ms C++: root is -5.390653718237257 C++: elapsed time 0.0017 ms Case 3: Python: root is 1.5264066185662863 Python: elapsed time 0.0102 ms C++: root is 1.5264066185662863 C++: elapsed time 0.0017 ms Case 4: Python: root is -5.390653718237257 Python: elapsed time 0.0122 ms C++: root is -5.390653718237257 C++: elapsed time 0.0020 ms Case 5: Python: root is 1.5264080242772753 Python: elapsed time 0.0086 ms C++: root is 1.5264080242772753 C++: elapsed time 0.0026 ms

3. Lists: 30 points Files: lists.py, listsmodule.cpp

Implement a function that computes a sum of a given list both in Python and then as an extension in C++. Print the sum as in the example output and measure the time it took to compute the sum.

Implement a function that counts the occurences of a specified number in a list. The function needs to take two arguments, a list of numbers and a number for which to count occurrences. Print the output to match the example below.

Do not use built-in functions to compute the sum or count.

Documentation of list object manipulation functions

4

https://docs.python.org/3/c-api/list.html
Example Input

3 1 2 3 4 5 6 7 8 9 9 1 1 1 1 1 1 2 1 1 9 8 5 1 9 9 0 7

Example Output

Case 0: Python: sum 45 Python: elapsed time 0.0017 ms Python: 9 occurs 1 times Python: elapsed time 0.0122 ms C++: sum 45 C++: elapsed time 0.0119 ms C++: 9 occurs 1 times C++: elapsed time 0.0122 ms Case 1: Python: sum 8 Python: elapsed time 0.0010 ms Python: 1 occurs 6 times Python: elapsed time 0.0119 ms C++: sum 8 C++: elapsed time 0.0013 ms C++: 1 occurs 6 times C++: elapsed time 0.0017 ms Case 2: Python: sum 42 Python: elapsed time 0.0033 ms Python: 7 occurs 0 times Python: elapsed time 0.0013 ms C++: sum 42 C++: elapsed time 0.0010 ms C++: 7 occurs 0 times C++: elapsed time 0.0013 ms

4. Sudoku Solver: 40 points Files: sudoku_solver.py, sudoku_solvermodule.cpp and the provided files sudoku.py, sudoku.h without modifications

Use the provided sudoku solver (sudoku.py and sudoku.h) to solve sudoku

5

board both in Python and C++. If there is a solution, then convert it to a list of lists and return it back to Python where you print it in the format below. If there is no solution, return None. Represent the sudoku board as a list of lists, where each list is a row.

For the C++ extension you will need to convert sudoku board (list of lists) to the struct sudoku_board, pass it into the solver alongside another board’s pointer where the solution will be stored if found. Convert the solution (if any) back to list of lists and return it to Python interpreter. If there is no solution, return None and as for the Python solver print no solution.

Example Input

2 0 0 0 0 0 0 0 0 0 6 0 0 1 9 5 0 0 0 0 9 8 0 0 0 0 6 0 8 0 0 0 6 0 0 0 3 4 0 0 8 0 3 0 0 1 7 0 0 0 2 0 0 0 6 0 6 0 0 0 0 2 8 0 0 0 0 4 1 9 0 0 5 0 0 0 0 8 0 0 7 9 6 0 0 0 0 0 0 0 0 6 0 0 1 9 5 0 0 0 0 9 8 0 0 0 0 6 0 8 0 0 0 6 0 0 0 3 4 0 0 8 0 3 0 0 1 7 0 0 0 2 0 0 0 6 0 6 0 0 0 0 2 8 0 0 0 0 4 1 9 0 0 5 0 0 0 0 8 0 0 7 9

Expected Output

Case 0: Python: 3 4 5 6 7 8 9 1 2 6 7 2 1 9 5 3 4 8 1 9 8 3 4 2 5 6 7 8 5 9 7 6 1 4 2 3 4 2 6 8 5 3 7 9 1 7 1 3 9 2 4 8 5 6 9 6 1 5 3 7 2 8 4 2 8 7 4 1 9 6 3 5 5 3 4 2 8 6 1 7 9 Python: elapsed time 960.8519 ms C++:

6

3 4 5 6 7 8 9 1 2 6 7 2 1 9 5 3 4 8 1 9 8 3 4 2 5 6 7 8 5 9 7 6 1 4 2 3 4 2 6 8 5 3 7 9 1 7 1 3 9 2 4 8 5 6 9 6 1 5 3 7 2 8 4 2 8 7 4 1 9 6 3 5 5 3 4 2 8 6 1 7 9 C++: elapsed time 9.8189 ms Case 1: Python: no solution Python: elapsed time 224.6007 ms C++: no solution C++: elapsed time 2.1440 ms

7

Python Homework 3
1. Factorial: 10 points
2. Root Finding: 20 points
3. Lists: 30 points
4. Sudoku Solver: 40 points

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Accounting & Finance Specialist
Assignment Helper
Assignment Hub
Smart Tutor
High Quality Assignments
A Grade Exams
Writer Writer Name Offer Chat
Accounting & Finance Specialist

ONLINE

Accounting & Finance Specialist

I am an academic and research writer with having an MBA degree in business and finance. I have written many business reports on several topics and am well aware of all academic referencing styles.

$26 Chat With Writer
Assignment Helper

ONLINE

Assignment Helper

This project is my strength and I can fulfill your requirements properly within your given deadline. I always give plagiarism-free work to my clients at very competitive prices.

$31 Chat With Writer
Assignment Hub

ONLINE

Assignment Hub

I have read your project description carefully and you will get plagiarism free writing according to your requirements. Thank You

$36 Chat With Writer
Smart Tutor

ONLINE

Smart Tutor

After reading your project details, I feel myself as the best option for you to fulfill this project with 100 percent perfection.

$30 Chat With Writer
High Quality Assignments

ONLINE

High Quality Assignments

I am an academic and research writer with having an MBA degree in business and finance. I have written many business reports on several topics and am well aware of all academic referencing styles.

$29 Chat With Writer
A Grade Exams

ONLINE

A Grade Exams

I will provide you with the well organized and well research papers from different primary and secondary sources will write the content that will support your points.

$28 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Understanding and managing organizational behavior 6th edition powerpoint - Healthcare Informatics and Technology - Positive thinking discussions - Week 3 Writing Assignment - Essay - Salesmanship - Data analysis 17 base percentages lesson 12.2 answers - Heritage questions for students - Learning or cognitive personality theories podcast - Tv commercial analysis examples - NEED IN 6 HOURS or LESS - Http www testingforschools com code - Hanging beam span table - Rhaposdy on a windy night - Driving force car club - Discussion - Manchester united human resource management - A survey of hinduism pdf - Data analytics simulation strategic decision making chegg - Sleep no more macbeth doth murdered sleep - Aveox 27 26 7 av electric motor - Discussion Board (respond to student post below) - Molar mass of c3h8o - 95 kidderminster drive wantirna - Valence electrons in each group - Jaworski's ski store is completing the accounting process - Is steel a good conductor - Three overriding scm activities within and between firms include - Use the above adjusted trial balance - Physical threat to information systems? Fire? Hurricanes? Sabotage? Terrorism? - Business & Finance Discussion - Elodea cell structure and function - Bromine and potassium iodide equation - Information systems infrastructure evolution and trends - Python Assignment with two-items association rule (due in 5 hrs) - A molecule is best described as - How to calculate ideal cycle time - Week 5 MM - Dulux miller mood review - Nelson mandela make poverty history speech - Hsc atar subject scaling - Suppose the baseball hall of fame in cooperstown - Amanda bean's amazing dream printable - Discussion - Density of mercury in kg m3 - DNP-DPI Project- QUALITY IMPROVEMENT PROJECT - 1 page in APA 6th Format Operational Excellence - Boy overboard teaching activities - Inventory shrinkage and internal controls - Costco wholesale corporation financial statement analysis a solution - Is mosquito larvae a decomposer - Iam in federated cloud applications - Kenneth goldsmith pdf - MGMT - Gofree wifi 1 module manual - Socrates philosophies prophecies of atrocities - How to spell dos and don'ts - Rules for solving equations - Wais iv determining strengths and weaknesses - As nzs 3500 free download - Chem 110 psu final exam - Porphyrin is a pigment in blood protoplasm - A puzzle with many pieces development of the periodic table - Jesus hopped the a train sparknotes - Quality of life - Maxi maxi mini mini - Samovar and porter definition of culture - Homeowners insurance give you both property and liability protection - Explain the business benefits of a data driven website - Hannah hoch the beautiful girl analysis - General aviation research - Frankenstein literary analysis essay - Techniques of transaction exposure management - According to your text, the first step in minimizing your debilitative emotions is to - Inverse trigonometric functions table - Husband Wife' +91-9799046502 Divorce LOVE Problem Solution Specialist Molvi Ji. - 120000 aud after tax - Fisher ury and patton 1991 - Undulate in a sentence - M&l manufacturing case study solution - Nature or nurture reading passage - Food as thought mary maxfield pdf - Last post carol ann duffy annotated - Costco outbound logistics - Who invented the sundial - Evaluating Research Questions, Hypotheses, and Quantitative Research Designs 8110j - InfoTech in a Global Economy - Ideo organizational culture - Case Study - High modality words meaning - John newton damp proofing systems - The moths helena maria viramontes - What is the difference between virtual and actual representation - Notes from a young black chief - Assignment 450 words - Unlicensed part 15 devices - Airpods pro marketing - BU204 Assignment 2 - Rabbi sasson hai shoshani - Response