-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass1.cs
More file actions
79 lines (68 loc) · 2.61 KB
/
Class1.cs
File metadata and controls
79 lines (68 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Channels;
using System.Threading.Tasks;
using System.Windows;
namespace conjeturadecolltz
{
public class secuencia
{
public double sec { get; set; }
public double deri { get; set; }
//definimos la variable de recepcion
public void collatz_sec(double numeros)
{
this.sec = numeros;
//especificamos que es la parte numeros
double iterador = 2;
for (int i = 0; i < numeros; i++)
{
double wi = numeros;
//usamos un for para que encaso de usar una lista el contador recorra cada posicion
while (wi != 1 && wi != 2 && wi != 4)
{
if (wi % 2 == 0)
{
//hay que definir dentro del if orque si no existe un margen de error por que la variable wi no guarda su valor
wi = wi / iterador;
StreamWriter sw = new StreamWriter("C:\\Users\\Usuario\\Downloads\\archivoos.txt");
sw.Write(wi);
string sd = Convert.ToString(wi);
MessageBox.Show(sd);
sw.Close();
}
if (wi % 2 == 1)
{
wi = (wi * 3) + 1;
StreamWriter sw = new StreamWriter("C:\\Users\\Usuario\\Downloads\\archivoss.txt");
sw.Write(wi);
string sd = Convert.ToString(wi);
MessageBox.Show(sd);
sw.Close ();
}
if (wi == 1 || wi == 4 || wi == 2)
{
MessageBox.Show("bucle collatz");
//finalizamos el bucle de collatz es optable usar un close();
}
}
break;
}
}
public virtual double derivadas(double d)
{
this.deri = d;
double r = (d * d) + (2 * d) + 1* sec;
string s = r.ToString();
MessageBox.Show(s+" de rivada parcial punto predecible mas alto");
double j = (d / d) - (d - 2) * 3/sec;
string s2 = j.ToString();
MessageBox.Show("punto mas bajo predecile" + s2);
return d;
}
//hecho por kernelboy34
}
}