# 代做MATH36031、辅导MATLAB语言编程

MATH36031 Problem solving by computer.
Project 1 - deadline 27th October 2023, time 1100hrs. Submission of the
project is via Blackboard.
In the tasks required for this project you are asked to use an algorithm which originates
from the Vedic system of mathematics developed in India several hundred years ago. The
algorithm is described in the video clip which is available via Blackboard in the Projects
folder.
1. Write a function myrandi(n) which takes as input a positive integer n and generates
as output a string a1, a2, . . . , an containing the digits of a positive number a1a2 . . . an.
Here the ak are random integers 0 ≤ ak ≤ 9.
2. Watch the video clip to learn about the algorithm used to multiply two numbers. In
the video clip, the algorithm is described for multiplication of numbers up to 5 digits
long. Your task is to generalise the algorithm to work out the patterns to multiply two
n digit numbers. In your report you should describe and explain how this algorithm
works.
3. Write a function vedicmultiply to implement this algorithm and such that
c=vedicmultiply(a,b) returns a string c which contains all the digits of the multiplication of a and b (which are input as a string). Also the integers represented by
a and b can have a different number of digits. In your report you should explain and
provide details of any testing and validation that you have done.
Example c=vedicmultiply(’12’,’34’) returns c=’408’.
function [ myans ] = vedicmultiply (a ,b)
% vedicmultiply computes the product a*b
% vedcimultiply computes the product of the numbers a*b where
% a and b are input as strings (to allow for long integers )
% usage : a= '12345 '; b= '123 ' c= vedicmultiply (a,b)
% myans is a list containing all the digits of the answer
%
4. Use your myrandi and vedicmultiply functions to give all the digits in the multiplication of two randomly-chosen random positive numbers a and b where a is of length
30 and b is of length 40. The full output (showing all the digits) should be given in
5. Produce a clearly labelled plot showing N, the number of digits in the integer along the
x−axis versus T the average time to do 100 multiplications using two positive random
integers each with N digits, on the y−axis. Ideally take N = 10 : 10 : 50.
1
 All coding must be done in MATLAB and you are required to submit your MATLAB
functions and m (or mlx)-files via the Blackboard submission box. Project reports
in pdf form only should be submitted via the Turnitin submission box. Remember
the Turnitin software will automatically scan reports for plagiarism.
 Please ask if you need help on any commands, or whether there are built-in commands/functions to accomplish certain tasks (especially important if you think you have a
good approach to the questions, but do not know the related commands).
 The default datatype is double (decimal number), and be aware of possible side effects
when using the numbers as integers. Remember that the same question can be solved
by different approaches, and the same approach can be implemented in different ways.
All relevant commands should be covered during the lectures or tutorial exercises,
but you are free to explore your own. Make critical judgement to choose the best
approach/implementation.
 Aim for efficiency of the code, which is an additional marking criteria, besides the
generic rubric. Although you only need to record the answer for the given input,
make sure that the computational time or memory does not increase significantly with
larger input parameters (these issues will be mentioned constantly during the class
demonstrations).
 List the complete code of the whole code for solving the tasks at the end of each
question, or in an appendix. Make your source code more readable, by keeping the
indentation and stylistic features, and can be copied from the electronic file.
 The results reported in your report must be reproducible from your codes. Remember
that markers will be able to run the codes in case of any doubts and any inconsistencies
between reported results and actual results from running codes will lead to reports
being marked down.
2
Guidelines for the report.
1. Have a look at the generic rubric and frequently asked questions, which is given on
Blackboard in the Projects folder and about how your report will be marked. The
rubric also describes the intended learning outcomes about what you are expected to
achieve at the end.
2. Avoid copying (too many) sentences directly from the project description, and try to
restate the problem with your own words or examples if possible.
3. You may use your report in the future as evidences of written work, so take it seriously.
4. Your target audience is a fellow student on your course: explain the questions so that
the report can be understood without this project description and your approach can
be implemented in another computer. The report should indicate to the reader how
well you understand the problem and the approach you have taken, the validation and
other checks that you made to ensure your results are credible. Reports submitted
containing codes only and with no explanations of how the problem was solved, will
result in a failing mark, even though the codes may work perfectly well and give the
5. Balance the explanation of the approach and the comments in the code. Avoid undercommenting and over-commenting.
6. Aim for precision and clarity of writing (discussed in Week 5).
7. Keep your page length not exceeding eight A4 pages, with a font size no smaller
than 11, and page margins no smaller than 2cm. There is no need for a title page for
a relative short report like this. If more than 8 pages are submitted only the
first 8 pages will be marked and the rest of the submission will be ignored.
8. Since there is no final exam, you are advised to spend at least 15 hours on each project.
9. The submission box (via Blackboard and Turnitin) for each project will be open
two weeks before the deadline, and you are encouraged to submit an early draft to
see how Turnitin works on Blackboard. Only your last submission will be marked.
Anything submitted after the deadline (except for those with approved extensions)
will be subject to late penalties. Any late penalty will be applied by the Teaching and
Learning Support Office according to the Undergraduate Student Handbook, and any
extension has to be approved from the Office too (not from the lecturer).