首页 > 其他分享 >MA2552 Introduction to Computing (DLI)

MA2552 Introduction to Computing (DLI)

时间:2024-10-05 19:12:04浏览次数:1  
标签:function 10 matrix Introduction MA2552 points array DLI size

MA2552 Introduction to Computing (DLI) 2024/25

Computer Assignment 1

  1. (10 points) Write a function that take as an input an array x and an integer m,and outputs a matrix of size length(x) × m, whose columns are the first m Taylorapproximations of either cos(x) or sin(x) (this choice is part of the inputs). Yourfunction should avoid using iterative loops.
  1. (10 points) A prime number which is one less than a power of 2 is called a ‘Mersenneprime’. For a given natural number n > 2, write a function which outputs a row vectorcontaining all Mersenne primes less than or equal to n.
  1. (10 points) The equation of an ellipse oriented along the x-y axis with semi-axis ofsize a and b, respectively, is given by x a  2 +  y b  2 = 1.In this exercise you will create a function that outputs an N-points discretisation of anellipse of semi-axis lengths a and b, that is rotated at an angle theta with respect tothe x axis.Write a function with header E = ellipse(a, b, theta, N) following the steps herebelow.(i) Using linspace, create an array of size 1xN consisting of evenly-spaced doublesbetween 0 and 2π.(ii) Create an array of size 2×N where the first/second row is the cosine/sine of thevalues of the array you created in (i). This will give you an N-points discretisationof a circleiii) The result of (ii) is an N-points discretisation of a circle with radius 1, where thex coordinate is the first row and the y coordinate is the second row. Scale eachcoordinate by a and b, respectively, to obtain the discrete version of an ellipsewith semi-axis lengths a and b.(iv) The matrix cos( sin(θ θ ) cos( ) sin( θ θ ) ) is a rotation matrix – it maps any given vectore u R 2 to another vector v R 2such that u= vand the angle between the u and v (anticlokwise) is θ. Usinthis, create an array of size 2× N whose columns are θ rotations of the columnsof the discretised ellipse of (iii).You can visualise your results using the command plot(E(1,:), E(2,:)), axis equal.
  1. (10 points) To read an image in MATLAB one can use the command I = imread(yourImage),which creates a multidimensional array I of size n×m×3 (n and m are the dimensionsof the image), where the first two index 代 写MA2552 Introduction to Computing (DLI)  dimensions indicate the indices of each pixel,and the third index indicate one of each the red, green, and blue (RGB) components of1MA2552 Introduction to Computing (DLI) 2024/25each color pixel. Create afunction that takes as an input a colour image and repaintst according to a given a mapping from the primary colours to the primary coloursthis mapping is also an input of your function). Show your results with one or moreimages of your choosing.
  1. (10 points) A square matrix H of size n is called a Hadamard matrix if its elementsare either 1 or -1, and H × Ht = nI, where I denotes the identity matrix. Write afunction that checks if a matrix is Hadamard.
  2. (10 points) A Hadamard matrix of size 2k can be obtained using the following recurrence relationWrite a recursive function that obtain such Hadamard matrix. Use the function ofquestion 2 to verify your method.
  1. (10 points) The Legendre polynomials satisfy the following recurrence relation.(2n + 1)xPn(x) = (n + 1)Pn+1(x) + nPn1(x), with P0(x) = 1 and P1(x) = x. Show that Pn(x) = O(x n ) for x → ∞.Hint: use inductive/recursive thinking.
  2. (10 points) (3 points) What is the big O complexity, as a function of n, of thefollowing code? Justify your answer.
  3. (10 points) Write a function that transforms an array of 0 and 1, to a float in decimals.The function should decide on the single or double precision depending on the lengthof the input array.

(10 points) Implement a code that read the excel file ‘LDIstudents.xls’ (in the ‘assesments / computer assignments’ folder in blackboard) and store the information of eachstudent in a MATLAB structure that you will call Student. For each group, calculatethe average mark as well as the standard deviation. Compute the correlation betweenthe marks of all students and the ‘Assistance to lectures’, ‘Assistance to tutorials’, andhe ‘Height’.2

标签:function,10,matrix,Introduction,MA2552,points,array,DLI,size
From: https://www.cnblogs.com/comp9021/p/18447976

相关文章

  • Introduction to X86-64 Assembly Programming
    Project3:IntroductiontoX86-64AssemblyProgrammingGradingFormGoalInthisprojectyouwillwriteprogramsinx86-64assemblylanguage.Itisimportantthatyoulearnthex86-64assemblylanguagesinceitistheoneyouuseeverydayinyourPC,Ma......
  • CPSC 219: Introduction to Computer Science II
    CPSC219:IntroductiontoComputerScienceIIAssignment1:ProceduralJava–SnakeGameCourse:CPSC233S24DueDate:Friday,Sept.27,2024Version:1.1.1Weight:10%Objective:WriteaJavaprogramwithastandardproceduralstructureandsavetheworkto......
  • 学习笔记:A Introduction to inertial navigation
    3.2MEMS陀螺的误差特性本节我们分析MEMS陀螺中存在的误差,以及它们对积分后的信号(也就是旋转)的影响。3.2.1常量零偏角速度陀螺的零偏是它在不忍受任何转动时的平均输出,单位度每小时。如果对一个\(\epsilon\)大小的常量零偏进行积分,会导致一个随时间线性增长的角度误差:\(\theta......
  • CSCI1120 Introduction to Computing Using C++
    CSCI1120IntroductiontoComputingUsingC++,Fall2024/25DepartmentofComputerScienceandEngineering,TheChineseUniversityofHongKongCopyright©2024CSE,CUHKPage1of8Assignment2:GumballMachinesDue:23:59,Thu3Oct2024Filename:gumball.......
  • CITS2402 Introduction to Data Science
    CITS2402Introduction to Data ScienceSemester2, 2024AssignmentAssessed,worth 20%. Due: 11:59pm,Friday 4th  October 20241 AimThisassignmentaimstoinvestigatethesimilaritiesanddifferencesbetweenAustraliaandNew Zealand regarding......
  • 个人翻译Introduction to Linear Algebra, 5th Edition 10.2节(仅用于交流学习,非盈利)
    本书的翻译仅为交流学习!才疏学浅,不当的地方还望指正。请勿于其它用途!PDF文件 链接一:  https://pan.baidu.com/s/1ENKxfP_QJBaZHXlQ_xdxzw?pwd=9nej提取码:9nej 链接二:https://download.csdn.net/download/sinat_21706867/89817586以下只贴出本PDF截图 ......
  • CS 417/517: Introduction to Human Computer Interaction
    CS417/517:IntroductiontoHumanComputerInteraction Project1(Fall2024)1IntroductionInthisassignment,yourtaskistoimplementaConvolutionalNeuralNetwork(CNN)andevaluatetsperformanceinclassifyinghandwrittendigits.Aftercompleti......
  • COMP90049, Introduction to Machine Learning
    SchoolofComputingandInformationSystemsTheUniversityofMelbourneCOMP90049,IntroductiontoMachineLearning,Semester22024Assignment2:PredictingSupremeCourtRulingsReleased:Friday,September6th2024.Due:StageI:Friday,October4th5pm......
  • MySQL variables:thread_handling
    在使用MySQL数据库时,我们经常会遇到多个客户端同时访问数据库的情况。为了处理并发请求,MySQL提供了thread_handling参数,用于控制线程的管理方式thread_handling参数的作用thread_handling参数用于控制MySQL如何处理客户端的连接请求。它可以影响数据库的性能、吞吐量以......
  • ECON 3720: Introduction to Econometrics
    ECON3720:IntroductiontoEconometricsProblemSet03FallSemester2024Due:September27th2024Pleasesubmittheproblemsetnolaterthan5PMonSeptember27th2024.SubmittheproblemsettoyourTA’smailboxintheMonroeHallbasement.Failureto......