Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In python please! In this homework we will use various methods to approximate th

ID: 3601975 • Letter: I

Question

In python please!

In this homework we will use various methods to approximate the line of duck's back from your textbook. Data for the marked sample points are in the file 'duck.dat'. It is a text file with two columns; first contains the xn-x-coordinates; second, fn- y coordinates. A summary of various interpolation ideas that we discussed in class is outlined in the end of this file. You do not need to program your own solver for linear systems for this assignment and should use the built-in facilities in your programming environment f (x) 4 1 2 3 4 10 11 12 13x Least Squares. In order to find the best-fitting tn-th degree polynomial, pm (x) = a0 +a1x + first construct the matrix +anKm X2X2 Then solve the least squares problem, where the unknown vector a contains the coefficients ak, k = 0, , m; and vector f contains the y- coordinates of the data. Plot your approximations for m = 5, 10, 15, 20 (use the same plot and display the original data points as well) Interpolating Polynomials. The least squares approximation with m = 20 is, in fact, the exact interpo- lating polynomial which passes through all the data points. Verify that you get the same approxima- tion using Lagrange interpolation (as in the previous assignment). In your opinion, does it provide a good approximation? Cubic Splines. Construct cubic splines for the same data and plot the resulting approximation. Use the natural splines with free boundary conditions, i.e., the second derivatives of the constructed func- tion must vanish at the end points. The outline below contains some of the theory behind the cubic spline approximation, however it does not have the two equations coming from the vanishing second derivative condition at the end points, x1 and xx. Part of your task is to carry your own. out this derivation on

Explanation / Answer

Encrypted text (hex):

0x3344c899

0xf29993ad

0xe0ca4e24

0x6c01097a

0x6048c2ed

0xf28e8ee8

0xa5d95034

0x006d4e69

0x00000000

0x00000000

Decrypted text:

This string will be encrypted.

Here is my code so far, do NOT change anything in this code please, thank you.

.data

Key:

.word 0x1234ABCD

Messagetext:

.asciiz "This string will be encrypted."

Output1:

.asciiz "Original message text: "

Output2:

.asciiz " Encrypted text (hex): "

Output3:

.asciiz " Decrypted text: "

CR:

.asciiz " "

.align 2

Ciphertext:

.space 40

.align 2

Plaintext:

.space 40

.text             #most of this code is string printing

la    $a0, Output1

addi $v0, $0, 4

syscall

la    $a0, Messagetext

addi $v0, $0, 4

syscall

la    $a0, CR

addi $v0, $0, 4

syscall

la $a0, Messagetext

la $a1, Ciphertext

jal Encrypt       #encrypt the message text to the ciphertext buffer

la    $a0, Output2

addi $v0, $0, 4

syscall

la    $a0, Ciphertext

jal   PrintBufferHex    #print out the hex of the ciphertext

la    $a0, CR

addi $v0, $0, 4

syscall

addi $a0, $a1, 0

la    $a1, Plaintext

jal   Decrypt           #decrypt the cipher text to plaintext

la    $a0, Output3

addi $v0, $0, 4

syscall

addi $a0, $a1, 0

addi $v0, $0, 4

syscall

la    $a0, CR

addi $v0, $0, 4

syscall

addi $v0, $0, 10 #end of program

syscall

PrintBufferHex:         #subroutine which prints buffer in hex

addi $sp, $sp, -4

sw    $a0, ($sp)

addi $t0, $a0, 0

addi $t1, $0, 10

PrintLoop:

addi $v0, $0, 34

lw    $a0, ($t0)

syscall

la    $a0, CR

addi $v0, $0, 4

syscall

addi $t0, $t0, 4

addi $t1, $t1, -1

bne   $t1, $0, PrintLoop

lw    $a0, ($sp)

addi $sp, $sp, 4

jr    $ra

Encrypt:

#your code goes here

-- program is finished running --

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote