1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
solmaris [256]
3 years ago
13

In numerical methods, one source of error occurs when we use an approximation for a mathematical expression that would otherwise

be too costly to compute in terms of run-time or memory resources. One routine example is the approximation of infinite series by a finite series that mostly captures the important behavior of the infinite series.
In this problem you will implement an approximation to the exp(x) as represented by the following infinite series,
exp(x) = Infinity n= 0 xn/xn!
Your approximation will be a truncated finite series with N + 1 terms,
exp(x, N) = Infinityn n = 0 xn/xn!
For the first part of this problem, you are given a random real number x and will investigate how well a finite series expansion for exp(x) approximates the infinite series.
Compute exp(x) using a finite series approximation with N E [0, 9] N (i.e. is an integer).
Save the 10 floating point values from your approximation in a numpy array named exp_approx. exp_approx should be of shape (10,) and should be ordered with increasing N (i.e. the first entry of exp_approx should correspond to exp(x, N) when N = 0 and the last entry when N = 9).
Computers and Technology
1 answer:
Shtirlitz [24]3 years ago
3 0

Answer:

The function in Python is as follows:

import math

import numpy as np    

def exp(x):

   mylist = []

   for n in range(10):

       num = (x**n)/(math.factorial(n))

       mylist.append([num])

   exp_approx = np.asarray(mylist)

   sum = 0

   for num in exp_approx:

       sum+=num

   return sum

Explanation:

The imports the python math module

import math

The imports the python numpy module

import numpy as np    

The function begins here

def exp(x):

This creates an empty list

   mylist = []

This iterates from 0 to 9

   for n in range(10):

This calculates each term of the series

       num = (x**n)/(math.factorial(n))

This appends the term to list, mylist

       mylist.append([num])

This appends all elements of mylist to numpy array, exp_approx

   exp_approx = np.asarray(mylist)

This initializes the sum of the series to 0

   sum = 0

This iterates through exp_approx

   for num in exp_approx:

This adds all terms of the series

       sum+=num

This returns the calculated sum

   return sum

You might be interested in
You are between flights at the airport and you want to check your email. Your wireless settings show two options:
Likurg_2 [28]
The correct answers Is B
8 0
3 years ago
A specific, individual computer or other network device in a domain is known as what?
KIM [24]
Hi I hope this helps. The answer is host.
5 0
3 years ago
__________ is the backbone of a computer, connecting all of its components including the central processing unit (CPU) and prima
Tems11 [23]
It’s D. The microprocessor
5 0
3 years ago
What is the name of a statement written to retrieve specific data from a table?
Shkiper50 [21]
The answer is b.record
4 0
3 years ago
26. The
lakkis [162]

Answer:

AND

The  <u>AND </u>operator will cause a record to  be selected only if two or more

conditions are satisfied.

7 0
3 years ago
Other questions:
  • Fill in the missing step in the following deadlock situation. Two users from the local board of education are each running a pro
    15·1 answer
  • "Career Clusters" describe a group of ________ within the same industry
    14·1 answer
  • "Find the sum of the squares of the integers from 1 to MySquare, where MySquare is input by the user. Be sure to check that the
    9·1 answer
  • When light does not pass through or bounce off an object, it is said to be
    13·2 answers
  • What is the output of the below Java program?
    11·1 answer
  • A-1 grdening supply is preparing a reprt to hand out to the customerez in pointes form only.why should the reprts writers avoid
    9·2 answers
  • Please answer<br><br>NO LINKS​
    7·1 answer
  • Please help I don’t know
    5·1 answer
  • Tip of advice on brainliest.You can copy and paste the question then search it in the search bar because i can guaranty that som
    14·1 answer
  • I can login to it says to me u cant login at that time
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!