Define vector t-[0:0.5:4): where t is the number of years. A radioactive element decays in a first-order process, given by: N(t)= No exp(-t/v). consider No-5 and v-0.9. The data is stored in variables t and N. What command will you use to plot the data as solid black line with red diamond as markers. (see the figure below) 2 3 O plot(t,N,-rd) plot(t.N-kd') O plot(tN;-krd) plot(t,N;-k,tN,rd) 3. 2.
Q: You are given an array called source, with length n, and a set of m arrays called target, each also…
A: #include <stdio.h>int check(int *source, int *t,int n){// sort the two arraysfor (i = 0; i…
Q: This is supposed to test your understanding of Java streams and lambda expressions. Specifically how…
A: JAVA Programming When I first read about the Stream API, I was confused about the name since it…
Q: Create a two-string activity, $ a and $ b. Repeat times when two strings contain the same two…
A: Algorithm: Start Implement a function named strMatchBy2char() that takes two strings $a and $b If…
Q: I need help to generate the waveform s v is a vector contains 100000 random bits of 1 or -1.…
A: Given code is import numpy as np import matplotlib.pyplot as plt import sys import random…
Q: We initialize the parameters to all zero values and run the linear perceptron algorithm through…
A: Hello dears Here you can ask about 2 questions. And i'll providing both questions-answers First…
Q: Write a program (script file) that prompts the user to input an arbitrary vector X, for example [5 9…
A: Given that, Write a program (script file) that prompts the user to input an arbitrary vector X, for…
Q: Write a code that will do a) Reads the elements of two matrices M1 and M2 with the size of two rows…
A: // adding matrix for (int i = 0; i < 2; i++) { for (int j = 0; j<3; j++) {…
Q: In my CS class, I was asked to write a java program to replace each element of the array with every…
A: Write a Java program to replace each element of the array with product of every other element in a…
Q: Write a function that retrieves the top 3 longest words of a newspaper headline and transforms them…
A: function getHashTags(str) { let finalArr = []; let strArr = str .split(' ') .sort((a, b)…
Q: Please use your own code don't copy it from a website Given an string representing a 2D array of…
A: According to the information given:- We have to create the matrix program in which we find out the…
Q: This course Consider the code below, int myArr] = {33,33,49,21,20,27,16,27,20,30,-1); for (int i 1;…
A: We will run this question in a proper java program. We have slightly modified the program to get the…
Q: Here is a Python function. def do_something(lst1, lst2): for element1 in lst1: for…
A: Please go through the below answer.
Q: Write a program that asks the users to enter n values and stores them in a vector. The value of n…
A: Required:
Q: Write a function that divides an array into chunks of size n, where n is the length of each chunk.…
A: 1. create the method with 2 array 2. create a new array 3. Iterate on the arr argument 4. new res…
Q: Write a program (script file) that prompts the user to input an arbitrary vector X, for example [5 9…
A: The below program prompts the user to input an arbitary vector. The sample output also implemented…
Q: To create vector k which contains the even number within the interval [2,50] ordered :descending, we…
A: The answer is
Q: You are given an array called source, with length n, and a set of m arrays called target, each also…
A: 1. Find Minimum elements for every possible (x) in Target[x] and store those elements in an array…
Q: Write a program that does the following: 1) Set * to the row vector consisting of the elements from…
A: Required:
Q: x is a vector with 10000 uniformly distributed random values in the domain of (0, 1). Which of the…
A: Given code: x = rand(1,10000); %10000 uniformly distributed random values in the domain [0 1]…
Q: Write a program that reads in lines from a file "data.dat" and adds them to an unordered map where…
A: Initialize a varaible count=1 that will denote the line number. Now, using getline take input of…
Q: We would like to write a script that prints a vector Vi one element per line (i.e. a new line is…
A: The "I = " just gets prints as-is. It's nothing special and any characters like that, that aren't…
Q: can you please write it in java.util.scanner form and can you make it so i can copy and past it…
A: Required: Write a program to perform this calculation. Provide two example input arrays and…
Q: and values stored in the document.cookie object using JavaScript, what should you do first? a.…
A: The question has been answered in step2
Q: You are given an array called source, with length n, and a set of m arrays called target, each also…
A: Step-1: Take the input for the source and the set of targets. Step-2: Find the minimum value in the…
Q: For some 1-D array called X, write the commands you need to: • Take every third value of X, •…
A: result=X(3:3:end) First 3 indicates starting value. Second 3 indicate increment value. end…
Q: Please fix this JavaScript function so that the when calling the function with the parameters…
A: Algorithm: Start Implement a method chunk() which takes an array and size of sub array as argument…
Q: Write a program with a loop and use indirect addressing that switches the 1t and 2nd elements of the…
A: Question based on assembly language program
Q: The task is to determine the number of elements in the vector x = [1, 4, 9, 16, 25, 67] and store it…
A: n=size(x) gives the dimension of the vector i.e number of rows and number of columns. So option c is…
Q: You need to develop a system that reads character values from the user and store them in a 2D array…
A: ALGORITHM:- 1. Declare a String array of size 2*3. 2. Take input from the user and store it in the…
Q: Write a program that generates a 6x6 two-dimensional matrix filled with 0s and 1s, displays the…
A: PROGRAM:public class Deminsional{/* Main method /public static void main(String[] args) {// Generate…
Q: Consider a CSV file contains information about COVID-19 status of Bangladesh. The header of this…
A: Code: import java.io.*; public class Demo{ public static void main(String[] args) {…
Q: Write a code segment to add two matrices A and B, and store the results in matrix C. C = A+B, that…
A: Dear Student, As only code segment is asked in question instead of whole program, I am just…
Q: Question: Given two arrays, we can append one array to the end of the other. For example: х1 x2…
A:
Q: need hello writing a JAVA code segment to add two matrices A and B, and store the results in matrix…
A: Code import java.util.Scanner;public class sample { public static void main(String args[]) {…
Q: a) A random matrix of 4x4 is given as below [12.3 39.5 65.3 31.41 62.2 65.6 35.3 66.1 R= 44.5 65.1…
A: Command to create matrix R R=[12.3 39.5 65.3 31.4;62.2 65.6 35.3 66.1;44.5 65.1 55.0 30.0;11.5 14.9…
Q: I am trying to read a CSV file and then store it into an ArrayList. For each row, I'm trying to…
A: As we know that all the classes in java inherit the Object class, and also there are some methods of…
Q: Suppose you have two arrays: Arr1 and Arr2. Arr1 will be sorted values. For each element v in Arr2,…
A: the code is below:
Q: Initialize a vector v1 with the following values: O 23 -7 8 -22 3 14 Write a MATLAB program from the…
A: v1 = [0, 23, -7, 8, -22, 3, 14]; for i = 1:7 if(v1(i) < 0) %negative lement v2(i) =…
Q: Suppose V = (0, 1). Using singleton set notations and the operators U, ., and * if appropriate,…
A: Part 1 V={0,1} Expression which represents all elements of V such that whenever 1 appears it is…
Q: Consider inserting n elements (where n is very large) into an array that has an initial capacity of…
A: Answer. Option D ==> O(nlogn)
Q: You are given an array called source, with length n, and a set of m arrays called target, each also…
A: Solution : (a) Algorithm : 1. Find Minimum elements for every possible (x) in Target[x] and store…
Q: Please help me code in java: Write a program that reads two files “Data1.txt”, “Data2.txt”; adding…
A: Let's say you have a file, data.txt, which contains the following ASCII text: apples oranges pears…
Q: Here is a block of code: set.seed(42) x <- rnorm(1000) x1 <- morm(1000, sd = 0.3)…
A: This is the code in R:…
Q: ng For this exercise, we will be working with a text file that holds students' course averages. Each…
A: Dear Student, the code walkthrough has been marked as comments Dim jagNumber As String Dim //…
Q: Write a java program, MatrixAverage, that reads the elements of a two-dimensional matrix of floating…
A: (1)First read the number of rows and cols (2)Create a 2D array of required Size (3)Read the array…
Q: Write a Python program to check whether a nxn matrix is a magic square.The magic square is a set of…
A: Out of 27 statements given in the options two were unused in the program. These were magic = False…
Step by step
Solved in 4 steps with 1 images
- The Virtual Weight (VW) of an integer number (which consists of more than 1 digit) is the sumof the individual digits that are composing the number. For example, consider the followingtwo numbers; 5638 and 1145, then the VW of each is calculated as following:VW(5638) = 5+6+3+8 = 22VW(1145) = 1+1+4+5 = 11Then, the VW can be classified as L (mean Low) or H (means High) using a specific cut-offvalue. For example, if the cut-off value is 15, then the VW of the number 5638 is H (High),and the VW of the number 1145 is L because 22 > 15 and 11 ≤ 15 respectivelyWrite a C++ program that: reads a positive integer n (where 5≤n≤20) from the user. If the user enters invalidnumber, then the program should continue prompting until he/she enters a valid numberwithin the specified range. Then, the program should generate n random numbers using the built-in rand()function. Every time a random number is generated, the program will classify that number as Lor H using the above method. Use a…The vector x ∈ R N has L different entries. For example, L = 4 for x = [3,4,4,5,3,1,5,3]T . One can express x as x = S u, where u ∈ R L satisfies (u)i < (u)j if i < j and S is a matrix that contains only zeros and ones. Write the function repeated_entries, which takes x as input and returns S and u.In Python, generate a random matrix A with 100 entries each of which is an independent numberpseudo-randomly drawn (uniformly) from the interval (0, 1). Let B = A + AT . Use Python to calculatethe diagonal matrix D with the same eigenvalues as B. Then use the QR method to block-diagonalize Bover R. Do at least 100 steps of the QR switching. You should end up with a matrix E which is differentthan D. Answer the question of why.
- Write a program in C: - Ask the user for the amount of diesel loaded in the submarine.- Asks the user for the magnitude (distance), in meters, and the heading, in degrees of thenavigation to way-point one.- Decompose the vector into x and y components and output the magnitude anddirection (North, West, South, or East are the only reliable headings on the sub’scompass) of the x component and then the y component. The x component is themagnitude multiplied by the cosine of the angle. The y component is the magnitudemultiplied by the sine of the angle. Determine compass direction depending on weatherthe vector component is positive or negative.- Calculate the amount of diesel spent to waypoint 1 and output it. Also output theamount of diesel remaining. (The submarine has a fuel capacity of 175 metric tons ofdiesel but was loaded with 1 ton in the example. The submarine spends 1 ton of dieselper 51 miles traveled.)- This step has to be repeated for another waypoint.- Ask the user for the…Write a program in C: - Ask the user for the amount of diesel loaded in the submarine.- Asks the user for the magnitude (distance), in meters, and the heading, in degrees of thenavigation to way-point one.- Decompose the vector into x and y components and output the magnitude anddirection (North, West, South, or East are the only reliable headings on the sub’scompass) of the x component and then the y component. The x component is themagnitude multiplied by the cosine of the angle. The y component is the magnitudemultiplied by the sine of the angle. Determine compass direction depending on weatherthe vector component is positive or negative.- Calculate the amount of diesel spent to waypoint 1 and output it. Also output theamount of diesel remaining. (The submarine has a fuel capacity of 175 metric tons ofdiesel but was loaded with 1 ton in the example. The submarine spends 1 ton of dieselper 51 miles traveled.)- This step has to be repeated for another waypoint.- Ask the user for the…Write a program that reads two matrices of integers. It then generates the sum, difference and productof the two matrices.The sum of the two matrices of the same size is a matrix with elements that are the sums of thecorresponding elements of the two given matrices. Addition is not defined for matrices of different sizes.If A and B are matrices of the same size, then we define subtraction as follows: A – B = A + (-B). Thus, tosubtract matrix B from matrix A, we simply subtract corresponding elements.To multiply a matrix by another matrix we need to do the "dot product" of rows and columns. The "DotProduct" is where we multiply matching members, then sum up:(1, 2, 3) • (7, 9, 11) = 1×7 + 2×9 + 3×11 = 58We match the 1st members (1 and 7), multiply them, likewise for the 2nd members (2 and 9) and the3rd members (3 and 11), and finally sum them up.
- 3. Write a program to evaluate a polynomial \[ p(x)=c_{n} x^{n}+c_{n-1} x^{n-1}+\cdots+c_{2} x^{2}+c_{1} x+c_{0} \] and its derivative at a given pointt. The input is the row vectorcof coefficients of the polynomial arranged from highest to lowest power, and the numbert, and the two outputs arep(t)andp′(t). Computep(t)by first computing the row véctor \[ \left[t^{n}, t^{n-1}, \ldots, t^{2}, t, 1\right] \] and combine that with the vectorcto get the result. Computep′(t)by computing the coefficients of the derivative polynomial from the vectorc, and then evaluating that polynomial in the same way. Include some tests that provide evidence that your code produces the correct results. Please give proper explanation and typed answer only.Let l be a line in the x-yplane. If l is a vertical line, its equation is x = a for some real number a. Suppose l is not a vertical line and its slope is m. Then the equation of l is y = mx + b, where b is the y-intercept. If l passes through the point (x₀, y₀), the equation of l can be written as y - y₀ = m(x - x₀). If (x₁, y₁) and (x₂, y₂) are two points in the x-y plane and x₁ ≠ x₂, the slope of line passing through these points is m = (y₂ - y₁)/(x₂ - x₁). Instructions Write a program that prompts the user for two points in the x-y plane. Input should be entered in the following order: Input x₁ Input y₁ Input x₂Implement the following function, without using any data structure. /* Given two vectors of chars, check if the two vectors are permutations of each other, i.e., they contains same values, in same or different order.e.g., V1=[‘a’,’b’,’a’] and V2=[‘b’,’a’,’a’] stores same multi-set of data points: i.e., both contains two ‘a’, and one ‘b’. e.g., V3=[‘a’,’c’,’t’,’a’] and V4=[‘a’,’c’,’t’] are not same multi-set. V3 contains two ‘a’s, while V4 has only one ‘a’. Note: when considering multiset, the number of occurrences matters. @param list1, list2: two vectors of chars @pre: list1, list2 have been initialized @post: return true if list1 and list2 stores same values (in same or different order); return false, if not. */ bool SameMultiSet (vector<char> list1, vector<char> list2)
- Implement the following function, without using any data structure or #include <bits/stdc++.h> /* Given two vectors of chars, check if the two vectors are permutations of each other, i.e., they contains same values, in same or different order.e.g., V1=[‘a’,’b’,’a’] and V2=[‘b’,’a’,’a’] stores same multi-set of data points: i.e., both contains two ‘a’, and one ‘b’. e.g., V3=[‘a’,’c’,’t’,’a’] and V4=[‘a’,’c’,’t’] are not same multi-set. V3 contains two ‘a’s, while V4 has only one ‘a’. Note: when considering multiset, the number of occurrences matters. @param list1, list2: two vectors of chars @pre: list1, list2 have been initialized @post: return true if list1 and list2 stores same values (in same or different order); return false, if not. */ bool SameMultiSet (vector<char> list1, vector<char> list2) THIS IS NOT THE CORRECT SOLUTION / include headers #include <bits/stdc++.h> // deinfe the namespace using namespace std; // function fo rchecking same bool…A university uses student numbers consisting of 6 digits plus a check digit in the 7th position. The check digit is found by taking the number formed by the first 6 digits modulo 7. A transposition in this setup is a switch of two adjacent digits - check digit excluded. Which transpositions of a student number (a6,a5,a4,a3,a2,a1,a0) (here written as a vector, with check digit a0) will not be detected by the check digit? Explain your answer in full and show any calculations you do. Hint: Note that the value of any ai in the number is ai×10i and consider the difference between the values of the correct and incorrect numbers modulo 7.Consider the vector: x = c(1,2,3,4). What is the value of (x+2)[(!is.na(x)) & x > 0]? What do you find?