JaveHW14

docx

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

MISC

Subject

Mathematics

Date

Feb 20, 2024

Type

docx

Pages

2

Uploaded by GrandMoonTrout26

Report
1. Write a Java expression for the roots of a quadratic equation (ax 2 +bx + c) double a; double b; double c; double sol1 = ((-b)+ Math.pow((Math.pow(b, 2)-4*a*c), 0.5))/(2*a); double sol2 = ((-b)- Math.pow((Math.pow(b, 2)-4*a*c), 0.5))/(2*a); 2. Write a Java expression for the radar equation as shown in en.wikipedia.org/wiki/Radar . Be sure to define your variables in a way that is as self-documenting as possible. You may assume the transmitter and receiver are co-located. double Pt; double Gt; double Ar; double F; double Rt; double Rr; double sigma; double Pr = Pt*Gt*Ar*sigma*Math.pow(F, 4)/(Math.pow(4*Math.PI, 2)*Math.pow(Rt,2)*Math.pow(Rr, 2)); 3. Write a Java expression for the probability density function (pdf) of a Normal distribution with mean μ and variance σ 2 . The formula is
double sigma; double mu; double x; double fOfX = Math.pow(sigma*Math.pow(2*Math.PI, 0.5), -1) * Math.exp(- 0.5*Math.pow((x-mu)/sigma, 2)); 4. Write a Java expression for the pdf of a Weibull distribution with scale parameter k and shape parameter λ; the formula is: In your expression, you may assume that x ≥ 0. double x; double lambda; double k; double fOfXLK = k/lambda*Math.pow(x/lambda, k-1) * Math.exp(- Math.pow(x/lambda, k)); 5. Write a Java formula for the n th Fibonacci number, which is given by: double n; double Fn = Math.pow(5,-0.5)*Math.pow((1+Math.pow(5, 0.5))/2, n) - Math.pow(5,- 0.5) * Math.pow((1-Math.pow(5, 0.5))/2, n);
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help