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

 

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

Write a method that returns the superposition value of all the sine functions, where each sine function is defined by three parameters as such: y=a*sin(b*x+c). The parameters a, b, and c are each taken from arrays of parameters. Parameter a comes from the array paramA, parameter b comes from the array paramB, and (amazingly) parameter c comes from paramC. As a precondition you may assume that all three arrays have exactly the same length. Return the value of the superposition of all of these sine functions at the specific angle 'angle' which is in radian. So return: paramA[0]*sin(paramB[0]*angle+paramC[0])+paramA[1]*sin(paramB[1]*angle+paramC[1])+paramA[2]*sin(paramB[2]*angle+paramC[2])+...(up to the length of the arrays)


test2020_10_29_HL_waveSuperposition([11], [6], [1], 5.2) → 7.767864028983679
test2020_10_29_HL_waveSuperposition([24, 12, 6, 3], [440, 220, 110, 55], [0, 0, 0, 0], 1.2) → 6.571217889654887
test2020_10_29_HL_waveSuperposition([1, 2, 4, 8, 16], [8, 4, 2, 1, 0.5], [0, 1, 2, 3, 4], 3.8) → -4.52123997174309

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

public double test2020_10_29_HL_waveSuperposition(double[] paramA, double[] paramB, double[] paramC, double angle) { }

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: 290

Copyright Nick Parlante 2017 - privacy