讲解:MACM 401、Maple worksheet、Java,Python、Java,c++SQL|MACM 401/MATH 801Assignment 1, Spring 2019.Michael MonaganThis assignment is to be handed in by 4pm Monday January 21st.Hand in to Dropoff box 1A outside AQ 4100.Late penalty: 20% for up to 48 hours late. Zero after that.For problems involving Maple calculations and Maple programming, please submit a printout of aMaple worksheet.Question 1 (15 marks): Karatsuba’s AlgorithmReference: Algorithm 4.2 in the Geddes text.(a) By hand, calculate 5432 × 3829 using Karatsuba’s algorithm. You will need to do threemultiplications involving two digit integers. Do the first one, 54 × 38, using Karatsuba’salgorithm (recursively). Do the other two using any method.(b) Let T(n) be the time it takes to multiply two n digit integers using Karatsuba’s algorithm.We will assume (for simplicity) that n = 2kfor some k > 0. Then for n > 1, we haveT(n) ≤ 3T(n/2) + cn for some constant c > 0 and T(1) = d for some constant d > 0.First show that 3k = nlog2 3. Now solve the recurrence relation and show that T(n) =(2c + d)nlog2 3 2cn thus concluding that T(n) ∈ O(nlog2 3) = O(n1.585). Show your working.(c) Show that T(2n)/T(n) ~ 3, that is, if we double the length of the integers then the time forKaratsuba’s algorithm increases by a factor of 3 (asymptotically).Question 2 (15 marks): GCD Algorithms(a) Implement the binary GCD algorithm in Maple as the Maple procedure named BINGCD tocompute the GCD of two positive integers a and b. Use the Maple functions irem(a,b) andiquo(a,b) for dividing by 2.Your Maple code will have a main loop in it. Each time round the loop please print outcurrent values of (a, b) using the commandprintf(a=%d b=%d\n,a,b);so that you and I can see the algorithm working. Test your procedure on the integers a =16 × 3 × 101 and b = 8 × 3 × 203.(b) I think Maple’s command GCD(A,B) mod p; uses the Euclidean algorithm to compute theGCD of two polynomials A(x) and B(x) in the ring Zp[x]. [ We will show later that for twopolynomials A(x) and B(x) of degree d, the Euclidean algorithm does O(d2) arithmetic operationsin Zp. ] Let’s verify if this could true by timing Maple’s Gcd(A,B) mod p; commandand seeing if the times are quadratic in the degree d. Execute the following code in Mapleand test to see if the times you get are quadratic in d. Justify your answer. Hint: if T(d) isthe time and T(d) is quadratic in d, what should T(2d)/T(d) approach when d large?1d := 1000;p := prevprime(2^30);for i to 7 doA := Randpoly(d,x) mod p;B := Randpoly(d,x) mod p;st := time();G := Gcd(A,B) mod p;tt := time()-st;printf(deg=%d G=%a time=%7.3fsecs \n,d,G,tt);d := 2*d;od:Question 3 (20 marks): The Gaussian IntegersLet G be the subset of the complex numbers C defined by G = { x + y i : x, y ∈ Z, i =√1 }.G is called the set of Gaussian integers and is usually denoted by Z[i].(a) Why is G an integral domain?What are the units in G?Let a, b ∈ G. In order to define the remainder of a divided by b we need a measure v : G → N forthe size of a non-zero Gaussian integer. We cannot use v(x + iy) = |x + iy| =px2 + y2 the lengthof the complex代做MACM 401作业、代写Maple worksheet作业、代做Java,Python语言作业、代写Java,c+ number x + iy because it is not an integer valued function. We will instead use thenorm N(x + iy) = x2 + y2for v(x + iy).(b) Show that for a, b ∈ G, N(ab) = N(a)N(b).Show that for a, b ∈ G with b 6= 0, N(ab) ≥ N(a).(c) Let a, b ∈ G with b 6= 0. Find a definition for the quotient q and remainder r satisfyinga = b q + r with r = 0 or v(r) 2 + y2. Using yourdefinition calculate the quotient and remainder of a = 63 + 10i divided by b = 7 + 43i.Hint: consider the real and imaginary parts of the complex number a/b and consider howto choose the quotient of a divided b. Note, you must prove that your definition for theremainder r satisfies r = 0 or v(r) will help you. Now since part (b) implies v(ab) ≥ v(b) for non-zero a, b ∈ G, this establishesthat G is a Euclidean domain.(d) Finally write a Maple procedure REM such that REM(a,b) computes the remainder r of adivided b using your definition from part (c). Now compute the gcd of a = 63 + 10i andb = 7 + 43i using the Euclidean algorithm and your REM procedure. You should get 2 + 3i upto multiplication by a unit. Also, test your procedure on a = 330 and b = ?260.Note, in Maple I is the symbol used for the complex number i and you can use the Re andIm commands to pick off the real and imaginary parts of a complex number. Also, the roundfunction may be useful. For example> a := 2+5/3*I;a := 2 + 5/3 I> Re(a);22> Im(a);5/3> round(a);2 + 2 IQuestion 4 (10 marks): The Extended Euclidean AlgorithmReference: Algorithm 2.2 in the Geddes text.Given a, b ∈ Z, the extended Euclidean algorithm solves sa + tb = g for s, t ∈ Z and g = gcd(a, b).More generally, for i = 0, 1, ..., n, n+ 1 it computes integers (ri, si, ti) where r0 = a, r1 = b satisfyingsia + tib = ri for 0 ≤ i ≤ n + 1.(a) For m = 99, u = 28 execute the extended Euclidean algorithm with r0 = m and r1 = u byhand. Use the tabular method presented in class that shows the values for ri, si, ti, qi. Hencedetermine the inverse of u modulo m.(b) Repeat part (a) but this time use the symmetric remainder, that is, when dividing a by bchoose the quotient q and remainder r are integers satisfying a = bq+r and ?|b/2| ≤ r instead of 0 ≤ r Question 5 (10 marks): MATH 701 and MATH 801 students onlySuppose we call the extended Euclidean algorithm with integers a ≥ b > 0. Thus r0 = a, r1 = band rn = g where g = gcd(a, b). Prove the following properties about the integers t0, t1, ..., tn, tn+1that appear in the extended Euclidean algorithm (assuming the positive remainder is used).(i) |ti1| | for i = 3, ..., n + 1.(ii) ri ti1 ri1 ti = (?1)i a for i = 1, ..., n + 1.(iii) tn+1 = (1)na/g. Hint: put i = n + 1 into (ii).Since the ti are increasing in magnitude from (i), then (iii) implies |tn| extended Euclidean algorithm with input a = m and b = u to compute the inverse of u modulo m.If g = 1, then we have ?m if tn 转自:http://ass.3daixie.com/2019012368012056.html

maple java,讲解:MACM 401、Maple worksheet、Java,Python、Java,c++SQL|相关推荐

  1. python比java简单好学-21、PHP和python/JAVA比,哪个更好学?

    PHP是公认比较容易学习的编程语言. 一般学习半个月左右就可以开发简单网站,一般学习四五天就可以用PHP进行网站的二次开发. 想要学习一种技能,先要知道这个技能是什么,有什么用, 尤其对于零基础又想学 ...

  2. java http url 401 unauthorized_java - 为什么我在Maven中收到“401 Unauthorized”错误?

    为什么我在Maven中收到"401 Unauthorized"错误? 这是我在调用mvn deploy -e(底部的完整日志)时遇到的错误: mvn deploy -e mvn d ...

  3. Java入门1.2.3—一个老鸟的Java学习心得

    Java入门1.2.3-一个老鸟的Java学习心得 基本信息 作者: 臧萌    出版社:清华大学出版社 ISBN:9787302217831 上架时间:2010-3-30 出版日期:2010 年3月 ...

  4. Java改知能机_Java 面试突击之 Java 并发知识基础 进阶考点全解析

    版权说明:本文内容根据 github 开源项目整理所得 项目地址:https://github.com/Snailclimb/JavaGuide​github.com 一.基础 什么是线程和进程? 何 ...

  5. 深入java虚拟机 第四版_深入理解Java虚拟机-常用vm参数分析

    Java虚拟机深入理解系列全部文章更新中... https://blog.ouyangsihai.cn/shen-ru-li-jie-java-xu-ni-ji-java-nei-cun-qu-yu- ...

  6. java -version cmd_java如何运行步骤cmd?Java执行cmd命令方法有哪些?

    写好一个java程序之后,我们的最终目的就是可以正确的运行程序,如果程序运行正确了,那么代码也就没有什么问题了,可是java如何运行步骤cmd?接下来,我们就来给大家讲解一下这方面的内容. 1.首先用 ...

  7. Java架构师笔记-你必须掌握学习Java需要掌握哪些技能

    闲来无事,师长一向不(没)喜(有)欢(钱)凑热闹,倒不如趁着这时候复盘复盘.而写这篇文章的目的是想总结一下自己这么多年来使用java的一些心得体会,希望可以给大家一些经验,能让大家更好学习和使用Jav ...

  8. 梯度下降原理及线性回归代码实现(python/java/c++)

    "梯度下降"顾名思义通过一步一步迭代逼近理想结果,当达到一定的精度或者超过迭代次数才退出,所以所获得的结果是一个近似值.在其他博客上面基本都有一个通俗的比喻:从山顶一步步下山.下面 ...

  9. java语言中声明布尔型_【Java初探02】——Java语言基础

    本篇博文就Java语言的一些基本元素进行一些记录和阐述,主要讲解一下Java语言的一些基本构成元素和Java的主类结构. Java语言基础的大致组成 java主类结构 基本的数据类型 变量与常量 运算 ...

最新文章

  1. 20165334 四则运算阶段性总结(第二周)
  2. python函数注释 参数 省略号_python – make函数在help()函数中有参数的省略号
  3. 【UIKit】UIAlertController使用
  4. c语言主程序子程序流程图,c语言超经典矩阵式键盘的接法,流程图和扫描程序
  5. 虚拟机ubuntu使用笔记之samba安装
  6. static在内存层面的作用_虚拟地址空间--用户进程看到的自己所占用的内存
  7. Python语言学习之pandas:DataFrame二维表的简介、常用函数、常用案例之详细攻略
  8. html除左侧浮动,html清除浮动的6种方法示例
  9. java继承层次结构,在状态模式中实现继承层次结构 - java
  10. 基于linux的电子邮件服务(sendmail)
  11. php程序控制结构,PHP 控制结构
  12. 全国计算机二级等级考试项目有什么,全国计算机等级考试二级内容
  13. Ubuntu14.04安装VMwareTools
  14. 应用程序热补丁(一):如何用几行代码打造应用程序热补丁
  15. ae导出html,AE导出json格式的Web动画工具 Bodymovin v5.6.1 + 使用教程
  16. 程序员转正述职报告_程序员个人述职报告范文4篇(整理版)
  17. dmg文件 linux,Linux通过命令行建立dmg文件的方法
  18. 极致cms精仿小黑猿资源网源码
  19. 《东周列国志》第六十一回 晋悼公驾楚会萧鱼 孙林父因歌逐献公
  20. Linux部署禅道在访问web页面进入www时报错:mysql无法连接(重新解压安装包或者输入命令:setenforce 0即可)

热门文章

  1. 计算机系统——信息的表示与处理
  2. 明源(2.5.6)二次开发 - 添加菜单
  3. OSChina 周二乱弹 —— 对!公交车绝缘体
  4. data mining (foreign blogs)
  5. python制作qq登录界面_用Python实现一个最新QQ办公版(TIM)的登录界面
  6. Ubuntu通过wine安装QQ无法输入账号怎么办?
  7. uniapp安卓端禁止截屏允许截屏
  8. 3D建模中的BIP骨骼镜像对称画是什么东西?
  9. 学会php想转学java好学吗_Java和PHP哪个好学
  10. 解决Java ,class java.lang.String cannot be cast to class java.lang.Integer