Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
%matplotlib inline
import math
import numpy as np
from matplotlib import pyplot as plt
import math
def demo(x):
return math.exp(-x**2/2.0)
x = np.linspace(-3,3)
y = [demo(xx) for xx in x]
plt.plot(x,y)
plt.axhline(0.5, color='red')
plt.axvline(2.355/2,color='red',linestyle='dashed')
plt.axvline(-2.355/2,color='red',linestyle='dashed')
plt.grid()
plt.annotate(
'', xy=(-2.355/2, 0.4), xycoords='data',
xytext=(2.355/2, 0.4), textcoords='data',
arrowprops={'arrowstyle': '<->'})
plt.text(0,0.3,'FWHM',horizontalalignment ='center')
5.1
import math
def f(x, gamma=3.1):
mu = 2.345
return gamma/((x-mu)**2+gamma**2)
x = np.linspace(-10,10,200)
y = [f(xx) for xx in x]
plt.plot(x,y)
5.2
print(f(1.0, gamma=0.2)) # you may find this useful
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps
Knowledge Booster
Similar questions
- Add each element in origList with the corresponding value in offsetAmount. Print each sum followed by a semicolon (no spaces). Ex: If the input is: 4 5 10 12 2 4 7 3 then output is: 6;9;17;15; import java.util.Scanner; public class ComputeOffset { public static void main(String[] args) {final int NUM_VALS = 4;int[] origList = new int[NUM_VALS];int[] offsetAmount = new int[NUM_VALS];int i;Scanner input = new Scanner(System.in); origList[0] = input.nextInt();origList[1] = input.nextInt();origList[2] = input.nextInt();origList[3] = input.nextInt(); offsetAmount[0] = input.nextInt();offsetAmount[1] = input.nextInt();offsetAmount[2] = input.nextInt();offsetAmount[3] = input.nextInt(); /* Your code goes here */ System.out.println();}}arrow_forward%matplotlib inlineimport mathimport numpy as npfrom matplotlib import pyplot as pltdef bad_poisson(lmd, k): return pow(lmd,k)*math.exp(-lmd)/math.factorial(k)# bad_poisson(1000,1000) # uncomment to see it breaksarrow_forwardRevorse the vewels def reverse_vowels(text): Given a text string, create and return a new string constructed by finding all its vowels (for simplicity, in this problem vowels are the letters found in the string 'aeiouAEIOU') and reversing their order, while keeping all other characters exactly as they were in their original positions. However, to make the result look prettier, the capitalization of each moved vowel must be the same as that of the vowel that was originally in the target position. For example, reversing the vowels of 'Ilkka' should produce 'Alkki' instead of 'alkkI'. Applying this operation to random English sentences seems to occasionally give them a curious pseudo-Mediterranean vibe.Along with many possible other ways to perform this square dance, one straightforward way to reverse the vowels starts with collecting all vowels of text into a separate list, and initializing the result to an empty string. After that, iterate through all positions of the original text.…arrow_forward
- def findOccurrences(s, ch): lst = [] for i in range(0, len(s)): if a==s[i]: lst.append(i) return lst Use the code above instead of enumerate in the code posted below. n=int(input("Number of rounds of Hangman to be played:")) for i in range(0,n): word = input("welcome!") guesses = '' turns = int(input("Enter the number of failed attempts allowed:")) def hangman(word): secrete_word = "-" * len(word) print(" the secrete word " + secrete_word) user_input = input("Guess a letter: ") if user_input in word: occurences = findOccurrences(word, user_input) for index in occurences: secrete_word = secrete_word[:index] + user_input + secrete_word[index + 1:] print(secrete_word) else: user_input = input("Sorry that letter was not found, please try again: ") def findOccurrences(s, ch): return [i for i, letter in enumerate(s) if letter == ch] *** enumerate not discussed in…arrow_forward2. Problem 2: In this problem you will test our "in class" version of Gaussian elimination against the version in numpy. Use both codes to solve some randomly chosen linear systems of size N 10, 20, 40, 80, 160, 320, 640, 1280, 2560, and 5120. Depending on your computer, the last two may or may not work. If they don't, just say so in your report. If you computer can do N- 10240 then try this as well. Note that in cach case N 10 * 2k for k = 1,..., 10. That is, each time we are doubling the size of the matrix. abone Plot the results as two curves. Our code in red and numPy in bluc. (Or whatever colors you prefer). Can you guess the function which governs the runtime? Based on this guess, how long would it take to do N 40960 using numPy? N=81920?arrow_forwardint sum, k, i, j; int x[4] [4]={1,2,3,4}, {5,6,7,8},{9,8,7,3},{2, 1,7,1}; sum=x[0] [0]; for (k=1; k<=3;k++) sum+=x[k] [k]; Give the value in sum after the statements are executed:arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education