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
What format can be applied to text in Excel?
vladimir2022 [97]

Answer:

You can apply accounting format,date,numbers, currency, percentage or even fraction

Explanation:

3 0
3 years ago
In a swap you need a variable so that one of the values is not lost ? Need help
emmasim [6.3K]

Answer:

In a swap, the variable is cuttly.x

Explanation:

7 0
3 years ago
Read 2 more answers
Anna is making a presentation on the top five most visited cities in her state. she wants to make sure that she does not put in
andrey2020 [161]
Outline View. This view shows only the text of all the slides in the presentation on the left pane, enabling Anna to see whether she has put too much information or not.  She can also directly edit the the text  and simultaneously see its effect on the slide.  
8 0
3 years ago
Read 2 more answers
A legend in Excel is __________.
KIM [24]

Answer:

an information key that explains how information in a chart is represented by colors or patterns

Explanation:

This is the information that is used to explain the data in the graph.

4 0
4 years ago
Read 2 more answers
What are the factors affecting the purchasing decision for dbms software?
djverab [1.8K]
T<span>he factors affecting the purchasing decision for dbms software are : 
</span><span>a) Cost
b) DBMS features and tools
c) Underlying model
d) Portability
e) DBMS hardware requirements</span>
3 0
3 years ago
Read 2 more answers
Other questions:
  • What is the mass of the light bulb? a. 425.6 g b. 204.6 g c. 240.56 g d. 245.6 g
    6·2 answers
  • Who invented autonomous cars? When I look it up it comes up as William Bertelsen but he invented the idea of hovering cars. Help
    8·1 answer
  • Given input of a number, display that number of spaces followed by an asterisk. (1 point) Write your solution within the existin
    15·1 answer
  • Your boss wants you to set up an authentication scheme in which employees will use smart cards to log in to the company network.
    15·1 answer
  • Which of the following is a difference between a centralized communication network and a decentralized communication network? a.
    15·1 answer
  • CLS
    12·1 answer
  • What number is represented as a binary code of 101110
    5·2 answers
  • Why are women more exposed to mass media?
    9·2 answers
  • What does a virtual machine emulate?
    14·1 answer
  • TASK 1. JUMBLE ME! Direction: Arrange the jumbled letters to form a word. 1. PEREAM 2. RRENT CU 3. METREMO H 4. TORSISER 5. TANC
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!