EJERCICIOS:
1°- Ecuaciones de 2do grado:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//MI ECUACION DE 2DO GRADO
//DECLARACION
cout<<"MI ECUACION DE 2DO GRADO";
cout<<endl;
cout<<"****************************************\n";
cout<<endl;
int L,M,N;
double X1,X2,discri_minante;
//ASIGNACION
cout<<" Ingrese el valor de L:";cin>>L;
cout<<endl;
cout<<" Ingrese el valor de M:";cin>>M;
cout<<endl;
cout<<" Ingrese el valor de N";cin>>N;
cout<<endl;
//PROCESO
discri_minante = pow(M,4)-8 *L* N;
if (M !=0)
{
if(discri_minante>0)
{
X1=(-L+ sqrt (discri_minante)) /(7 * L);
X2=(-L- sqrt (discri_minante)) /(7 * L);
cout<<" EL VALOR DE X1 ES:"<<X1<<endl;
cout<<endl;
cout<<" EL VALOR DE X2 ES:"<<X2<<endl;
cout<<endl;
}
else
{
cout<<"IMAGINARIO";
cout<<endl;
cout<<endl;
cout<<"ECUACION ";
}
}
else
{
cout<<"INDETERMINADO";
cout<<endl;
cout<<endl;
cout<<"ECUACION ";
}
return 0;
//FIN DEL PROGRAMA
}
2°- Convertir R a p
# include <iostream>
# include <math.h>
using namespace std;
int main ()
{
//DECLARACION
int X1, Y1, X2, Y2;
double R1, R2, PHI_1, PHI_2, X, Y;
//DATOS RECTANGULARES
cout<<"INGRESE EL VALOR DE X1:"; cin>>X1;
cout<<endl;
cout<<"INGRESE EL VALOR DE X2:"; cin>>X2;
cout<<endl;
cout<<"INGRESE EL VALOR DE X2:"; cin>>X2;
cout<<endl;
cout<<"INGRESE EL VALOR DE Y2:"; cin>>Y2;
cout<<endl;
// CONVERSIOON A POLAR
R1 = sqrt(X1 * X1 + Y1 * Y1);
cout<<"EL VALOR DE R1 ES:"<<R1<<endl;
cout<<endl;
R2 = sqrt(pow ((X2),2) + pow ((Y2),2));
cout<<"EL VALOR DE R2 ES:"<<R2<<endl;
cout<<endl;
PHI_1 = atan(Y1/Y2);
cout<<"EL VALOR DE PHI_1 ES:"<<PHI_1<<endl;
cout<<endl;
PHI_2 = atan(Y2/X2);
cout<<"EL VALOR DE PHI_2 ES:"<<PHI_2<<endl;
cout<<endl;
return 0;
}
3°- convertir P a.. r
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//DECLARACION
int R1, R2;
double PHI1, PHI2, RAD_1, RAD_2, PI, X1, X2, Y1, Y2, R, PHI;
//ASIGNACION
cout<<"Ingrese el Valor de R1: "; cin>>R1;
cout<<endl;
cout<<"Ingrese el Valor de R2: "; cin>>R2;
cout<<endl;
cout<<"Ingrese el Valor de Phi1: "; cin>>PHI1;
cout<<endl;
cout<<"Ingrese el Valor de Phi2: "; cin>>PHI2;
cout<<endl;
PI = 3.141592;
//CONVERTIR
RAD_1 = (2 * PI * PHI1) / 360;
RAD_2 = (2 * PI * PHI2) / 360;
//PROCESO
X1 = R1 * cos(RAD_1);
cout<<"El Valor de X1 es: "<< X1<<endl;
cout<<endl;
Y1 = R1 * sin(RAD_1);
cout<<"El Valor de Y1 es: "<< Y1<<endl;
cout<<endl;
X2 = R2 * cos(RAD_2);
cout<<"El Valor de X2 es: "<< X2<<endl;
cout<<endl;
Y2 = R2 * sin(RAD_2);
cout<<"El Valor de Y2 es: "<< Y2<<endl;
cout<<endl;
return 0;
}
4° SUMA/RESTA a--RECTANGULAR
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//DECLARACION
int R1, R2;
double PHI1, PHI2, RAD1, RAD2, PI, X1, X2, Y1, Y2, R, PHI;
//ASIGNACION
cout<<"Ingrese el Valor de R1: "; cin>>R1;
cout<<endl;
cout<<"Ingrese el Valor de R2: "; cin>>R2;
cout<<endl;
cout<<"Ingrese el Valor de Phi1: "; cin>>PHI1;
cout<<endl;
cout<<"Ingrese el Valor de Phi2: "; cin>>PHI2;
cout<<endl;
PI = 3.141592;
//CONVERTIR
RAD1 = (2 * PI * PHI1) / 360;
RAD2 = (2 * PI * PHI2) / 360;
//PROCESO
X1 = R1 * cos(RAD1);
cout<<"El Valor de X1 es: "<< X1<<endl;
cout<<endl;
Y1 = R1 * sin(RAD1);
cout<<"El Valor de Y1 es: "<< Y1<<endl;
cout<<endl;
X2 = R2 * cos(RAD2);
cout<<"El Valor de X2 es: "<< X2<<endl;
cout<<endl;
Y2 = R2 * sin(RAD2);
cout<<"El Valor de Y2 es: "<< Y2<<endl;
cout<<endl;
//RECTANGULAR
{
//SUMA
cout<<"SUMA";
cout<<endl;
cout<<endl;
cout<<"Z1 = "<<(X1 + X2)<<" + j "<<(Y1 + Y2)<<endl;
cout<<endl;
}
{
// RESTA
cout<<"RESTA";
cout<<endl;
cout<<endl;
cout<<"z = "<<(X1-X2)<<"j "<<(Y1+ Y2)<<endl;
cout<<endl;
cout<<"TERMINADO";
}
return 0;
}
5° multiplicación/división a--polar
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//DECLARACION
int X1, Y1, X2, Y2;
double R1, R2, PHI1, PHI2, X, Y;
//DATOS RECTANGULARES
cout<<"Ingrese el Valor de X1: "; cin>>X1;
cout<<endl;
cout<<"Ingrese el Valor de X2: "; cin>>X2;
cout<<endl;
cout<<"Ingrese el Valor de X2: "; cin>>X2;
cout<<endl;
cout<<"Ingrese el Valor de Y2: "; cin>>Y2;
cout<<endl;
//CONVERSION A POLAR
R1 = sqrt(X1 * X1 + Y1 * Y1);
cout<<"El Valor de R1 es: "<< R1<<endl;
cout<<endl;
R2 = sqrt(pow ((X2), 2) + pow ((Y2), 2));
cout<<"El Valor de R2 es: "<< R2<<endl;
cout<<endl;
PHI1 = atan(Y1 / Y2);
cout<<"El Valor de PHI1 es: "<< PHI1<<endl;
cout<<endl;
PHI2 = atan(Y2 / X2);
cout<<"El Valor de PHI2 es: "<< PHI2<<endl;
cout<<endl;
{
//DIVISION
cout<<"DIVIDIR";
cout<<endl;
cout<<endl;
cout<<"Radio = "<<(R1 / R2)<<" Angulo = "<<(PHI1 - PHI2)<< endl;
cout<<endl;
}
{
// MULTIPLICACION
cout<<"MULTIPLICACION";
cout<<endl;
cout<<endl;
cout<<"RADIO="<<(R1*R2)<<"ANGULO="<<(PHI1+PHI2)<<endl;
cout<<endl;
cout<<"TERMINADO";
}
return 0;
}
6°SUMA A-- POLAR
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//DECLARACION
int R1, R2;
double PHI1, PHI2, RAD1, RAD2, PI, X1, X2, Y1, Y2, R, PHI;
//ASIGNACION
cout<<"Ingrese el Valor de R1: "; cin>>R1;
cout<<endl;
cout<<"Ingrese el Valor de R2: "; cin>>R2;
cout<<endl;
cout<<"Ingrese el Valor de Phi1: "; cin>>PHI1;
cout<<endl;
cout<<"Ingrese el Valor de Phi2: "; cin>>PHI2;
cout<<endl;
PI = 3.141592;
//CONVERTIR
RAD1 = (2 * PI * PHI1) / 360;
RAD2 = (2 * PI * PHI2) / 360;
//PROCESO
X1 = R1 * cos(RAD1);
cout<<"El Valor de X1 es: "<< X1<<endl;
cout<<endl;
Y1 = R1 * sin(RAD1);
cout<<"El Valor de Y1 es: "<< Y1<<endl;
cout<<endl;
X2 = R2 * cos(RAD2);
cout<<"El Valor de X2 es: "<< X2<<endl;
cout<<endl;
Y2 = R2 * sin(RAD2);
cout<<"El Valor de Y2 es: "<< Y2<<endl;
cout<<endl;
//RECTANGULAR
cout<<"Z1 = "<<(X1 + X2)<<" + j "<<(Y1 + Y2)<<endl;
cout<<endl;
//POLAR
R = sqrt(pow ((X1 + X2), 2) + pow ((Y1 + Y2), 2));
PHI = atan((Y1 + Y2) / (X1+ X2));
cout<<"El Valor el Radio es: "<< R<<endl;
cout<<endl;
cout<<"El Valor del Angulo es: "<< PHI<<endl;
return 0;
7°- divide a-- RECTANGULAR
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//DECLARACION
int X1, Y1, X2, Y2;
double R1, R2, PHI1, PHI2, X, Y;
//DATOS RECTANGULARES
cout<<"Ingrese el Valor de X1: "; cin>>X1;
cout<<endl;
cout<<"Ingrese el Valor de X2: "; cin>>X2;
cout<<endl;
cout<<"Ingrese el Valor de X2: "; cin>>X2;
cout<<endl;
cout<<"Ingrese el Valor de Y2: "; cin>>Y2;
cout<<endl;
//CONVERSION A POLAR
R1 = sqrt(X1 * X1 + Y1 * Y1);
cout<<"El Valor de R1 es: "<< R1<<endl;
cout<<endl;
R2 = sqrt(pow ((X2), 2) + pow ((Y2), 2));
cout<<"El Valor de R2 es: "<< R2<<endl;
cout<<endl;
PHI1 = atan(Y1 / Y2);
cout<<"El Valor de PHI1 es: "<< PHI1<<endl;
cout<<endl;
PHI2 = atan(Y2 / X2);
cout<<"El Valor de PHI2 es: "<< PHI2<<endl;
cout<<endl;
//DIVIDIR
cout<<"Radio = "<<(R1 / R2)<<" Angulo = "<<(PHI1 - PHI2)<< endl;
cout<<endl;
//CONVERSION A RECTANGULAR
X = (R1 / R2) * cos(PHI1 - PHI2);
cout<<"El Valor de X es: "<< X<<endl;
cout<<endl;
Y = (R1 / R2) * sin(PHI1 - PHI2);
cout<<"El Valor de Y es: "<< Y<<endl;
cout<<endl;
//RECTANGULAR
cout<<"Z = "<<X<<" + j "<<Y<<endl;
}