answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Whats the formula to d P1 P2?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you print twin primenumbers in c program?

void PrintTwinPrimes (int p1, int p2) { printf ("%d and %d are twin-primes\n", p1, p2); }


What is chain of pointers?

A pointer can point to address of another pointer. consider the exampleint x=456, *p1, **p2;p1 = &x;p2 = &p1;Copyright Einstein College of EngineeringDepartment of Civil EngineeringTOPprintf("%d", *p1); will display value of x 456.printf("%d", *p2); will also display value of x 456. This is because p2 point p1, and p1 points x.Therefore p2 reads the value of x through pointer p1. Since one pointer is points towards anotherpointer it is called chain pointer. Chain pointer must be declared with ** as in **p2


How do you Add 2 numbers using pointer and array in C?

#include<stdio.h> #include<conio.h> void main() { clrscr(); int i; int a[4]={1,2,3,4}; int *p1,*p2,*p3; for(i=0;i<4;i++) { p1=&a[0]; p2=&a[2]; p3=*p2-*p1; printf("\n value of p3%d",p3); } getch(); }


What is the momentum law?

The Momentum Law is Newton's 3 rd Law Action-Reaction,The sum of the forces is zero. 0 = F1 + F2 = d(p1 +p2)/dt gives teh Momentum Law: p1 + p2 = constant.


Basic mass air flow calculation in pipe?

Mass flow in air can be calculated if you know the pressure drop across the pipe. Then it can be calculated using Darcy's Equation for Pressure,which is: P2-P1 = (4fLv*v)/d*2*g where, P2 & P1 are pressures at two points in pipe, f = friction factor, L= length of pipe, v = velocity of fluid, d = diameter of pipe, g = gravity. from this formula we can calculate the velocity and hence the flow rate.


Polynomial multiplication program using data structures in c?

#include <stdio.h> #include <conio.h> #define MAX 10 struct term { int coeff ; int exp ; } ; struct poly { struct term t [10] ; int noofterms ; } ; void initpoly ( struct poly *) ; void polyappend ( struct poly *, int, int ) ; struct poly polyadd ( struct poly, struct poly ) ; struct poly polymul ( struct poly, struct poly ) ; void display ( struct poly ) ; void main( ) { struct poly p1, p2, p3 ; clrscr( ) ; initpoly ( &p1 ) ; initpoly ( &p2 ) ; initpoly ( &p3 ) ; polyappend ( &p1, 1, 4 ) ; polyappend ( &p1, 2, 3 ) ; polyappend ( &p1, 2, 2 ) ; polyappend ( &p1, 2, 1 ) ; polyappend ( &p2, 2, 3 ) ; polyappend ( &p2, 3, 2 ) ; polyappend ( &p2, 4, 1 ) ; p3 = polymul ( p1, p2 ) ; printf ( "\nFirst polynomial:\n" ) ; display ( p1 ) ; printf ( "\n\nSecond polynomial:\n" ) ; display ( p2 ) ; printf ( "\n\nResultant polynomial:\n" ) ; display ( p3 ) ; getch( ) ; } /* initializes elements of struct poly */ void initpoly ( struct poly *p ) { int i ; p -> noofterms = 0 ; for ( i = 0 ; i < MAX ; i++ ) { p -> t[i].coeff = 0 ; p -> t[i].exp = 0 ; } } /* adds the term of polynomial to the array t */ void polyappend ( struct poly *p, int c, int e ) { p -> t[p -> noofterms].coeff = c ; p -> t[p -> noofterms].exp = e ; ( p -> noofterms ) ++ ; } /* displays the polynomial equation */ void display ( struct poly p ) { int flag = 0, i ; for ( i = 0 ; i < p.noofterms ; i++ ) { if ( p.t[i].exp != 0 ) printf ( "%d x^%d + ", p.t[i].coeff, p.t[i].exp ) ; else { printf ( "%d", p.t[i].coeff ) ; flag = 1 ; } } if ( !flag ) printf ( "\b\b " ) ; } /* adds two polynomials p1 and p2 */ struct poly polyadd ( struct poly p1, struct poly p2 ) { int i, j, c ; struct poly p3 ; initpoly ( &p3 ) ; if ( p1.noofterms > p2.noofterms ) c = p1.noofterms ; else c = p2.noofterms ; for ( i = 0, j = 0 ; i <= c ; p3.noofterms++ ) { if ( p1.t[i].coeff p2.t[j].exp ) { p3.t[p3.noofterms].coeff = p1.t[i].coeff + p2.t[j].coeff ; p3.t[p3.noofterms].exp = p1.t[i].exp ; i++ ; j++ ; } else { p3.t[p3.noofterms].coeff = p1.t[i].coeff ; p3.t[p3.noofterms].exp = p1.t[i].exp ; i++ ; } } else { p3.t[p3.noofterms].coeff = p2.t[j].coeff ; p3.t[p3.noofterms].exp = p2.t[j].exp ; j++ ; } } return p3 ; } /* multiplies two polynomials p1 and p2 */ struct poly polymul ( struct poly p1, struct poly p2 ) { int coeff, exp ; struct poly temp, p3 ; initpoly ( &temp ) ; initpoly ( &p3 ) ; if ( p1.noofterms != 0 && p2.noofterms != 0 ) { int i ; for ( i = 0 ; i < p1.noofterms ; i++ ) { int j ; struct poly p ; initpoly ( &p ) ; for ( j = 0 ; j < p2.noofterms ; j++ ) { coeff = p1.t[i].coeff * p2.t[j].coeff ; exp = p1.t[i].exp + p2.t[j].exp ; polyappend ( &p, coeff, exp ) ; } if ( i != 0 ) { p3 = polyadd ( temp, p ) ; temp = p3 ; } else temp = p ; } } return p3 ; }


Adding polynomials using array in C programming Language?

#include<stdio.h> #include<stdlib.h> void display(float **,int); float** add(float **,float **,int,int,int); int main() { float **p1,**p2,**p3,**p4; int i,j,n1,n2,k=0,x; printf("Enter no of terms of a pollynomial:\n"); scanf("%d",&n1); printf("Enter no of terms of another pollynomial:\n"); scanf("%d",&n2); p1=(float **) malloc(n1*sizeof(float *)); p2=(float **) malloc(n2*sizeof(float *)); for(i=0;i<n1;i++) p1[i]=(float *) malloc(2*sizeof(float)); for(i=0;i<n2;i++) p2[i]=(float *) malloc(2*sizeof(float)); printf("Enter the first pollynomial:\n"); for(i=0;i<n1;i++) { printf("\nEnter value and exponent:"); scanf("%f %f",&p1[i][0],&p1[i][1]); } printf("Enter the second pollynomial:\n"); for(i=0;i<n2;i++) { printf("\nEnter value and exponent:"); scanf("%f %f",&p2[i][0],&p2[i][1]); } printf("\nFirst pollynomial:\n"); display(p1,n1); printf("\nSecond pollynomial:\n"); display(p2,n2); for(i=0;i<n1;i++) for(j=0;j<n2;j++) if(p1[i][1]==p2[j][1]) k++; x=n1+n2-k; p3=add(p1,p2,n1,n2,x); printf("\nAdded polynomial:\n"); display(p3,x); return 0; } void display(float **p,int n) { int i; printf("%fx^%d",p[0][0],(int)p[0][1]); for(i=1;i<n;i++) printf("+%fx^%d",p[i][0],(int)p[i][1]); } float** add(float **p1,float **p2,int n1,int n2,int n) { int i,j,k; float **p3; p3=(float **)malloc(n*sizeof(float*)); for(i=0;i<n;i++) p3[i]=(float *)malloc(2*sizeof(float)); i=0; j=0; k=0; while(i<n1 && j<n2) { if(p1[i][1]==p2[j][1]) { p3[k][0]=p1[i][0]+p2[j][0]; p3[k][1]=p1[i][1]; k++; i++; j++; } else if(p1[i][1]<p2[j][1]) { p3[k][0]=p1[i][0]; p3[k][1]=p1[i][1]; k++; i++; } else { p3[k][0]=p2[j][0]; p3[k][1]=p2[j][1]; k++; j++; } } while(i<n1) { p3[k][0]=p1[i][0]; p3[k][1]=p1[i][1]; k++; i++; } while(j<n2) { p3[k][0]=p2[j][0]; p3[k][1]=p2[j][1]; k++; j++; } return p3; }


Write a program to multiply two polynomials using an array?

#include<stdio.h> #include<malloc.h> int* getpoly(int); void showpoly(int *,int); int* addpoly(int *,int,int *,int); int* mulpoly(int *,int,int *,int); int main(void) { int *p1,*p2,*p3,d1,d2,d3; /*get poly*/ printf("\nEnter the degree of the 1st polynomial:"); scanf("%d",&d1); p1=getpoly(d1); printf("\nEnter the degree of the 2nd polynomial:"); scanf("%d",&d2); p2=getpoly(d2); printf("Polynomials entered are\n\n"); showpoly(p1,d1); printf("and\n\n"); showpoly(p2,d2); /*compute the sum*/ d3=(d1>=d2?d1:d2); p3=addpoly(p1,d1,p2,d2); printf("Sum of the polynomials is:\n"); showpoly(p3,d3); /*compute product*/ p3=mulpoly(p1,d1,p2,d2); printf("Product of the polynomials is:\n"); showpoly(p3,d1+d2); } int* getpoly(int degree) { int i,*p; p=malloc((1+degree)*sizeof(int)); for(i=0;i<=degree;i++) { printf("\nEnter coefficient of x^%d:",i); scanf("%d",(p+i)); } return(p); } void showpoly(int *p,int degree) { int i; for(i=0;i<=degree;i++) printf("%dx^%d + ",*(p+i),i); printf("\b\b\b "); printf("\n"); } int* addpoly(int *p1,int d1,int *p2,int d2) { int i,degree,*p; degree=(d1>=d2?d1:d2); p=malloc((1+degree)*sizeof(int)); for (i=0;i<=degree;i++) if((i>d1) && (i<=d2)) *(p+i)=*(p2+i); else if((i>d2) && (i<=d1)) *(p+i)=*(p1+i); else *(p+i)=*(p1+i)+*(p2+i); return(p); } int* mulpoly(int *p1,int d1,int*p2,int d2)/* this is the function of concern*/ { int i,j,*p; p=malloc((1+d1+d2)*sizeof(int)); for(i=0;i<=d1;i++) for(j=0;j<=d2;j++) p[i+j]+=p1[i]*p2[j]; return(p); }


Fluid mechanics how 2calculate the non circ.duct diameterdoes not have the value of velocity.Flow rate 3msDensity 1.2kgm3 viscosity 1.7x10-5Nsm2pressure drop5KNm2Fric length 120m.frictionFact0.007?

it is impossible to calculate the dia without velocity. But for the details you have given we can apply the haigen poisuells law p1-p2=32Mul/d^2 where p1-p2=pressure drop M=viscosity l=length d=dia u=avg velocity umax/2=uavg


C program for polynomial addition?

POLYNOMIAL ADDITION#include#includetypedef struct poly{int coeff;int expo;}p;p p1[10],p2[10],p3[10];void main(){int t1,t2,t3,k;int read(p p1[10]);int add(p p1[10],p p2[10],int t1,int t2,p p3[10]);void print(p p2[10],int t2);void printo(p pp[10],int t2);clrscr();t1=read(p1);print(p1,t1);t2=read(p2);print(p2,t2);t3=add(p1,p2,t1,t2,p3);printo(p3,t3);getch();}int read(p p[10]){int t1,i;printf("\n Enter the total no of terms");scanf("%d",&t1);printf("\n Enter the coeff and expo in descending order");for(i=0;i


How can you make a set of linear parametric equations in two parameters to produce a plane given three points?

I'm assuming the plane is in 3-space, but this easily generalizes... P1 = (x1,y1,z1) P2 = (x2,y2,z2) P3 = (x3,y3,z3) Let v1 = P2-P1 = (x2-x1,y2-y1,z2-z1), a vector from the origin and similarly let v2 = P3-P2 = (x3-x2,y3-y2,z3-z2) Then, for real constants s,t , the plane is spanned by D + s v1 + t v2 = 0, for some constant D


Difference between distance and Euclidean distance?

There are many ways to measure distance in math. Euclidean distance is one of them. Given two points P1 and P2 the Euclidean distance ( in two dimensions, although the formula very easily generalizes to any number of dimensions) is as follows: Let P1 have the coordiantes (x1, y1) and P2 be (x2, y2) Then the Euclidean distance between them is the square root of (x2-x1)2+(y2-y1)2 . To understand some other ways of measuring "distance" I introduce the term METRIC. A metric is a distance function. You put the points into the function (so they are its domain) and you get the distance as the output (so that is the range). Another metric is the Taxicab Metric, formally known as the Minkowski distance. We often use the small letter d to mean the distance between points. So d(P1, P2) is the distance between points. Using the Taxicab Metric, d(x, y) = |x1 - x2| + |y2 - y2|