3. The following Matlab function function y mytanh (x) y (exp(x)-exp(-x))/(exp(x)+exp(-x)) for computing tanh(x) = (e*...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. The following Matlab function function y mytanh (x) y (exp(x)-exp(-x))/(exp(x)+exp(-x)) for computing tanh(x) = (e* -e*)/(e*+e) was found to return NaN for large values of |x| (say x = 1000). Rewrite the code so that it computes accurate values for both large and small values of x whether x is positive or negative. Test your code for the values: x = 10%, k = -2, -1, 0, 1, 2, 3. Submit your code and your test results. You can compare with the built-in function tanh. 3. The following Matlab function function y mytanh (x) y (exp(x)-exp(-x))/(exp(x)+exp(-x)) for computing tanh(x) = (e* -e*)/(e*+e) was found to return NaN for large values of |x| (say x = 1000). Rewrite the code so that it computes accurate values for both large and small values of x whether x is positive or negative. Test your code for the values: x = 10%, k = -2, -1, 0, 1, 2, 3. Submit your code and your test results. You can compare with the built-in function tanh.
Expert Answer:
Answer rating: 100% (QA)
Certainly Here is a more detailed explanation with code snippets for the given problem 1 The issue w... View the full answer
Related Book For
Precalculus Concepts Through Functions A Unit Circle Approach To Trigonometry
ISBN: 9780137945139
5th Edition
Authors: Michael Sullivan
Posted Date:
Students also viewed these programming questions
-
Solve Prob. 3.43 for the position corresponding to x = 4 in. PROBLEM 3.43 the 20-in. tube AB can slide along a horizontal rod. The ends A and B of the tube are connected by elastic cords to the fixed...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Super Slushie charges $6.50 for a medium slushie and $9 for a large slushie. Their total net marketing contribution is $28,000 per week. They want to raise the price of each slushie 12.5% next month...
-
In April 2014, Brangre Saunier, editor of The Sporting News (SN), decides to reduce the price per newspaper from 0.70 in April 2014 to 0.50 starting 1 May 2014. Actual paid circulation in April is...
-
Suppose that y(x) is a solution of the autonomous equation dy/dx = f (y) and is bounded above and below by two consecutive critical points c 1 < c 2 , as in subregion R 2 of the following figure. If...
-
Washington Tennis & Education Foundation, Inc. (WTEF) is a nonprofit organization operating in the District of Columbia that provides athletic and academic programs for children from low-income...
-
Nguyen Company has the following stock outstanding: Common Stock Preferred Stock 60,000 shares ......5,000 shares $1 par value .......$60 par, $3 dividend The amount available for dividends this year...
-
As an example of how simulation can be used for operations research, consider the following college enrollment model. A certain college wants to analyze the effect of admissions and freshman...
-
Make a presentation in which youll: Evaluate the advantages and disadvantages of synchronous and asynchronous communication,
-
4. A torque is applied to a long thin rod making it rotate with an angular acceleration of 5.25 rad/s about an axis through its center and perpendicular to its length (see figure (a) below). If the...
-
A dolphin in an aquatic show jumps straight up out of the water at a velocity of 12.21m/s. How long is the dolphin in the air? Vai Annunn
-
A projectile is launched in the horizontal direction. It travels 2.021 m horizontally while it falls 0.452 m vertically, and then strikes the floor. What was the original velocity of the projectile?...
-
One way that issues of gender, culture, and diversity may impact my leadership strategy is through differences in communication styles. For example, some cultures may value direct and assertive...
-
A projectile is launched in the horizontal direction. It travels 2.064 m horizontally while it falls 0.448 m vertically, and then strikes the floor. How long is the projectile in the air? (g = 9.80...
-
A 4.65 L sample of helium gas contains 0.900 g of helium. How many additional grams of helium gas must be added to the sample to obtain a volume of 6.48 L? Assume constant temperature and pressure.
-
(a) Find the equation of the tangent line to f(x) = x 3 at the point where x = 2. (b) Graph the tangent line and the function on the same axes. If the tangent line is used to estimate values of the...
-
Answers are given at the end of these exercises. (a) cos(a + 3) (b) sin(a - 3) = cosa cos sin a cos sin a sin 3 cos a sin 3
-
True or False Two solutions of the equation sin= 1/2 are /6 and 5/6.
-
Solve the given equation log a a r =_______
-
A running mountain lion can make a leap 10.0 m long, reaching a maximum height of 3.0 m. a. What is the speed of the mountain lion just as it leaves the ground? b. At what angle does it leave the...
-
The moon completes one (circular) orbit of the earth in 27.3 days. The distance from the earth to the moon is 3.84 10 8 m. What is the moons centripetal acceleration?
-
A soccer player takes a free kick from a spot that is 20 m from the goal. The ball leaves his foot at an angle of 32, and it eventually hits the crossbar of the goal, which is 2.4 m from the ground....
Study smarter with the SolutionInn App