Question

Problem #1 Write a user-defined function called mysecant. (Not an an please!) The purpose of the function is: Given two points, compute the line between them and so where the corresponding y3-0. If there is no solution, Hint: The governing equations are: (y3-y1)-(y2-y1) / (x2-x1) * (x3-x1) if y3-0, then solve for x3, and so, x3-x1-y1 * (x2-x1) / (y2-y Inputs: x1, y1, x2, y2 Output: x3
0 0
Add a comment Improve this question Transcribed image text
Answer #1

// code screenshot

main.c 1 *HomeworkLib Quetion* 2 #include <stdio.h> 3 float mysecant(float x1,float y1, float x2, float y2) float x3; x3-x1-y1 (x2-x1)/(y2-y1); return x3; //if y3-0 than 7 10 int main() float x1,yl,x2,y2,x3,y3-0 12 13 14 15 16 17 18 19 20 21 CEnter Point 10x1,y1):); //input of point 1 (%f %f,&x1,yl); CInEnter Point 2(x2,y2):); //input for point 2 //call function mysecant x3-mysecant(x1,yl,x2,y2); C InCx3,y3)-%.2f,0) ,x3); //print result return; 23 24

//code to copy

/*HomeworkLib Quetion */
#include <stdio.h>
float mysecant(float x1,float y1, float x2, float y2)
{
float x3;
x3=x1-y1*(x2-x1)/(y2-y1); //if y3=0 than
return x3;
}

int main()
{
float x1,y1,x2,y2,x3,y3=0;
printf("Enter Point 1(x1,y1):"); //input of point 1
scanf("%f %f",&x1,&y1);
printf(" Enter Point 2(x2,y2):"); //input for point 2
scanf("%f %f",&x2,&y2);
  
x3=mysecant(x1,y1,x2,y2); //call function mysecant
  
printf(" (x3,y3)=(%.2f,0)",x3); //print result
  
return 0;
}

//output screenshot

Enter Point 1(xl.yl):-2 5 nter Point 2(x2,y2):3 2 (x3,y3)-(6.33,0) .. .Program finished with exit code 0

Add a comment
Know the answer?
Add Answer to:
Problem #1 Write a user-defined function called mysecant. (Not an an please!) The purpose of the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need the solution of this question asap 3, Cov(X1, X2) = 2, Cov(X2, X3) =...

    I need the solution of this question asap 3, Cov(X1, X2) = 2, Cov(X2, X3) = -2, 5. Let Var(x1) = Var(X3) = 2, Var(X2) Cov(X1, X3) = -1. i) Suppose Y1 = X1 - X2. Find Var(Y1). ii) Suppose Y2 = X1 – 2X2 – X3. Find Var(Y2) and Cov(Y1, Y2). Assuming that (X1, X2, X3) are multivariate normal, with mean 0 and covariances as specified above, find the joint density function fyy, y,(91, y2). iii) Suppose Y3 =...

  • Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3,...

    Write a program that prompts the user to enter three points (x1, y1), (x2, y2), (x3, y3) of a triangle and displays its area. The formula for computing the distance of two points (x1, y1) and (x2, y2) is d = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); or d = Math.pow((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1), 0.5); The formula for computing the...

  • This problem is about "Modeling with Itô Stochastic Differential Equations - E. Allen" Please explain every...

    This problem is about "Modeling with Itô Stochastic Differential Equations - E. Allen" Please explain every thing. Please write in the paper and then take a photo. 1.5. Let X1, X2, X3 be independent and identically distributed with the prob- ability Show that E(Y1Y2) / E(Y1) E(Y2) and thus infer that Yı and Y2 independent measure defined in Exercise 1.4. Let Yi = X1 +X2 and Y2 = X2 - X3 are not 1.5. Let X1, X2, X3 be independent...

  • Please help me answer the following : Find expressions for each output variable in canonical SOP...

    Please help me answer the following : Find expressions for each output variable in canonical SOP and canonical POS form Assuming that an output A already exists (but all other outputs do not), write expressions for {Y1, Y2, Y3, W} in terms of {X1, X2, X3 and A}. Draw a simplified circuit that obtains output signals {Y1, Y2, Y3, W, A} from input signals {X1, X2, X3} based on your results in Q1. DATA: 0 0 1 0 01 0...

  • 1(a)    Write a python program using a function name slope(x1, y1, x2, y2) that returns...

    1(a)    Write a python program using a function name slope(x1, y1, x2, y2) that returns the slope of the line through the points (x1, y1) and (x2, y2). 1(b) For problem 1(a), write a python program using a function name Euclidean_dist(x1, y1, x2, y2) which will calculate and return the Euclidean distance between the points (x1, y1) and (x2, y2).

  • XTAX=1. determine their canon- 1. Write the following quadratic forms as V(x) ical forms, find the modal matrices (i.e....

    XTAX=1. determine their canon- 1. Write the following quadratic forms as V(x) ical forms, find the modal matrices (i.e. the matrices of unit eigenvectors) of the corresponding transformations and write down explicite expressions for canonical cOordinates (y1, 2, y3) in terms of the original coordinates (x1, X2, X3). State what surfaces these quadratic forms correspond to = > (a) x + 4x1r2 + 4a13-8a2x3 = 1; (b) a3a3a^ + 4xj2 +4x131223 1; (c) 4a7 2a2 2axjx2 2x13+ 6x23 = 1....

  • Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds...

    Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The...

  • The matrix given is in reduced echelon form 1 0 0 0 1 0-5 0 0...

    The matrix given is in reduced echelon form 1 0 0 0 1 0-5 0 0 1 7 C 0 0 0 0 6. Write the system of equations represented by the matrix. (Use x as your variable and label each x with its corresponding column. Enter x_1 for x1, x_2 for x2, x_3 for x3, and x_4 for x4.) = 0 row 1 = 0 row 2 row 3 row 4 0 there is no solution, enter NO SOLUTION.)...

  • help me Problem: Write a simple C program that calculates the corresponding y-coordinate for any x-coordinate...

    help me Problem: Write a simple C program that calculates the corresponding y-coordinate for any x-coordinate onaline defined by two points. These points areinputspecifiedas pairsofxandycoordinates in the two-dimensional Cartesian coordinate system. Youneed to determine the slope ofthe line and they-intercept for the line plotted by these two points and store this data in memory. The programmustpromptthe userforthe coordinates of the first point X1 and then Y1, and then prompt the user for the second point, X2 and then Y2. After...

  • Question 1: Creating a user-defined function Write a user-defined MATLAB function named PBTask4pl_f.m for the following...

    Question 1: Creating a user-defined function Write a user-defined MATLAB function named PBTask4pl_f.m for the following math function with x the input argument and y the output y(x)=0.8x4-13x2-5x The function should work for x being a scalar or a vector. Write a script file named PBTask4pl.m to a) Use the function to calculate y(3) and y(5) and display the results in command window b) Use the function to make a plot of the function y(x) for -5:5: x 5:5. Label...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT