id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2020_10_15_HL_maclauren
prev  |  next  |  chance

Write a method that returns the 'degree'th Maclauren approximation for e^x evaluated at 'x'. The Maclauren series for e^x is: 1+x+(1/2!)x^2+(1/3!)x^3+...+(1/n!)x . where n is the degree of the Maclauren series. For example, if degree=2 and x=1.2 you would calculate: 1+(1.2)+(1/2!)(1.2)^2 and return that result as a double. If degree=3 and x=2.5 you would calculate: 1+(2.5)+(1/2!)(2.5)^2+(1/3!)(2.5)^3 and return that result as a double.


test2020_10_15_HL_maclauren(0, 3.2) → 1.0
test2020_10_15_HL_maclauren(1, 2.0) → 3.0
test2020_10_15_HL_maclauren(5, 1.0) → 2.7166666666666663

...Save, Compile, Run (ctrl-enter)

public double test2020_10_15_HL_maclauren(int degree, double x) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 295

Copyright Nick Parlante 2017 - privacy