datos de libro


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace libros
{
public partial class frmLibros : Form
{
public frmLibros()
{
InitializeComponent();
}

private void btnTitulo_Click(object sender, EventArgs e)
{
lbltitulo.Text = "base de datos";
string texto = lbltitulo.Text;
}

private void btnAutor_Click(object sender, EventArgs e)
{
lblAutor.Text = "joyanes";
string texto = lblAutor.Text;
}

private void btnEditorial_Click(object sender, EventArgs e)
{
lblEditorial.Text = "navarrete";
string texto = lblEditorial.Text;
}

private void btnEdicion_Click(object sender, EventArgs e)
{
lblEdicion.Text = "2006";
string texto = lblEdicion.Text;
}

private void btnNrodepaginas_Click(object sender, EventArgs e)
{
lblNrodepaginas.Text = "456";
string texto = lblNrodepaginas.Text;
}
}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

suma


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace suma
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnsuma_Click(object sender, EventArgs e)
{
int resultado;
resultado = Convert.ToInt32(this.txtnro1.Text) + Convert.ToInt32(this.txtnro2.Text);
this.txtrespuesta.Text = Convert.ToString(resultado);
txtnro1.SelectAll();
txtnro1.Focus();
}

private void txtnro1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
txtnro2.SelectAll();
txtnro2.Focus();
txtnro2.Text = "";
txtrespuesta.Text = "";
}
}

private void txtnro2_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 13)
this.btnsuma.Focus();
}


}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

mostrar texto


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ejemplo_2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnAceptar_Click(object sender, EventArgs e)
{
MessageBox.Show("bienvenidos a visual c# sharp", "bienvenida");
lblMensaje.Text=("hola a todos ");

}
}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

mensaje de bienvenida


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ejemplo_1
{
public partial class frmVisualC : Form
{
public frmVisualC()
{
InitializeComponent();
}

private void btnAceptar_Click(object sender, EventArgs e)
{
lblMensaje.Text = "bienvenidos visual c# .net";
}

private void btlLimpiar_Click(object sender, EventArgs e)
{
lblMensaje.Text = "";
}


}
}
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

metodo del punto fijo para matlab con ejemplo

%metodo del punto fijo
xf(1)=input('Ingrese el primer valor : ');
tol=input('Ingrese el porcentaje de error: ');
syms x;
f=input('Ingrese la función f(x), despejada g(f(x)): ');

i=1;
ea(1)=100;
while abs(ea(i))>=tol,
xf(i+1) = subs(f,x,xf(i));
ea(i+1) = abs((xf(i+1)-xf(i))/xf(i+1))*100;
i=i+1;
end
fprintf('i xf(i) Error aprox (i) \n');
for j=1:i;
fprintf('%2d \t %11.7f \t %7.3f \n',j-1,xf(j),ea(j));
end
>> puntofijo
Ingrese el primer valor : 0.52
Ingrese el porcentaje de error: 1
Ingrese la función f(x), despejada g(f(x)): sin(x)+x+1
i xf(i) Error aprox (i)
0 0.5200000 100.000
1 2.0168801 74.218
2 3.9190237 48.536
3 4.2175729 7.079
4 4.3375168 2.765
5 4.4069624 1.576
6 4.4532436 1.039
7 4.4866343 0.744
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Metodo de la Secante para matlab con ejemplo

%Metodo de la Secante
function y=Secante(FuncionS,Xi,Xj,errorp)
c=1;
fXi=feval(FuncionS,Xi);
fXj=feval(FuncionS,Xj);
fprintf(' i Xi f(Xi) |ep| \n')
fprintf('---------------------------------------------------\n')
%imprimir primera iteracion ep=0
ep=0;
fprintf('%5d %10.8f %10.8f %10.8f \n',c,Xi,fXi,ep);
%imprimir segunda iteracion ep=100
c=c+1;
ep=100;
fprintf('%5d %10.8f %10.8f %10.8f \n',c,Xj,fXj,ep);
while(ep>errorp)
c=c+1;
%guardamos en segundo valor
aux=Xj;
%Calculamos el sgte valor
Xj=Xj-((fXj*(Xi-Xj))/(fXi-fXj));
Xi=aux;
%calcular el error porcentual
ep=abs((Xj-Xi)/Xj)*100;
%calcular f(Xj) y f(Xi)
fXi=fXj;
fXj=feval(FuncionS,Xj);
fprintf('%5d %10.8f %10.8f %10.8f \n',c,Xj,fXj,ep);
end
% Función: f(x) = X 4 - 2 X 3 - 12 X 2 + 16 X - 40
function y = FuncionS(x)
y= asin(x)-exp(-2*x);
>> secante('fdex4', 0 , 0.5 , 0.01);
i Xi f(Xi) |ep|
---------------------------------------------------
1 0.00000000 -1.00000000 0.00000000
2 0.50000000 0.15571933 100.00000000
3 0.43263099 0.02646771 15.57193344
4 0.41883539 -0.00055482 3.29379926
5 0.41911864 0.00000219 0.06758182
6 0.41911753 0.00000000 0.00026584
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Metodo de Newton-Raphson para matlab con ejemplo

-----------------------------------------------------------------------------------------------------------------------------------
%Metodo de Newton-Raphson
function Raiz=NeRap(newtonraphson,dnewtonraphson,Xi,errorp)
c=1;
fXi=feval(newtonraphson,Xi);
dfXi=feval(dnewtonraphson,Xi);
ep=0;
fprintf(' i Xi f(Xi) df(Xi) |ep| \n')
fprintf('------------------------------------------------------------\n')
fprintf('%5d %10.8f %10.8f %10.8f %10.8f \n',c,Xi,fXi,dfXi,ep );

while (c==1 | ep>errorp)
c=c+1;
aux=Xi;
Xi=Xi-(fXi/dfXi);
ep=abs((Xi-aux)/Xi)*100;
fXi=feval(newtonraphson,Xi);
dfXi=feval(dnewtonraphson,Xi);
fprintf('%5d %10.8f %10.8f %10.8f %10.8f \n',c,Xi,fXi,dfXi,ep );
end

-----------------------------------------------------------------------------------------------------------------------------------
%metodo newton raphson
function y=newtonraphson(x)
y= cos(x)-x ;

-----------------------------------------------------------------------------------------------------------------------------------
%Ingresar la Primera derivada de la funcionnewton raphson
function y=dnewtonraphson(x)
y=-sin(x) - 1;

-----------------------------------------------------------------------------------------------------------------------------------
>> newtonraphson('fdex3','fdexd3',1 , 0.01);
i Xi f(Xi) df(Xi) |ep|
------------------------------------------------------------
1 1.00000000 -0.45969769 -1.84147098 0.00000000
2 0.75036387 -0.01892307 -1.68190495 33.26867709
3 0.73911289 -0.00004646 -1.67363254 1.52222713
4 0.73908513 -0.00000000 -1.67361203 0.00375566
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Buscar en este blog