Professional Documents
Culture Documents
}
Button 1(solution method 1)
private void button1_Click(object sender, EventArgs e)
{
double T = double.Parse(textBox1.Text);
double z = 4;
float ans;
Point mid = new Point(250, 250);
Point mid1 = new Point(450, 250);
Graphics gg = CreateGraphics();
SolidBrush b1 = new SolidBrush(Color.Purple);
DrawAxes(mid, "s", "s");
DrawAxes(mid1, "s", "tanh(JZ<s>/(KBT))");
Btton 3 ( s vs t)
private void button3_Click(object sender, EventArgs e)
{
double z = 4;
float ans;
Point mid = new Point(250, 250);
Graphics gg = CreateGraphics();
SolidBrush b1 = new SolidBrush(Color.Black);
DrawAxes(mid, "T", "s");
for (double T = 0.1; T < 10; T=T+(float)0.05)
{
for (float s = 1; s >= -1; s = s - (float)0.01)
{
ans = s - (float)(Math.Tanh(z * s / T));
if (Math.Abs(ans) < 0.001)
{
gg.FillEllipse(b1, (float)(mid.X + T * 50), (float)(mid.Y - s *
100), (float)6.0, (float)6.0);
Thread.Sleep(10);
}
}
}
}
}
}
Button 4
private void button4_Click(object sender, EventArgs e)
{
Graphics gg = CreateGraphics();
SolidBrush b1 = new SolidBrush(Color.RoyalBlue);
float ans2, ans3;
for (double T = 0.1; T < 4; T = T + (float)0.005)
{
ans2=(float)Math.Pow((4-(float)T),0.5);
ans3 = -(float)Math.Pow((4 - (float)T), 0.5);
gg.FillEllipse(b1, (float)(200 + T * 100), (float)(250 - ans2 * 100),
(float)6.0, (float)6.0);
gg.FillEllipse(b1, (float)(200 + T * 100), (float)(250 - ans3 * 100),
(float)6.0, (float)6.0);
}
Button 5
private void button5_Click(object sender, EventArgs e)
{
Graphics gg = CreateGraphics();
SolidBrush b1 = new SolidBrush(Color.Peru);
double z = 4;
float ans;
double s1 = 1;
double T = double.Parse(textBox1.Text);
for (float s = -2; s <= 2; s = s + (float)0.005)
{
if (s < 0)
{
s1 = -1;
}
else
{
s1 = 1;
}
if (s <= 0)
{
ans = -(float)s - (float)(Math.Tanh(z * s / T) * s1);
}
else
{
ans = (float)s - (float)(Math.Tanh(z * s / T) * s1);
}
gg.FillEllipse(b1, (float)(300 + s * 100), (float)(250 - ans * 100),
(float)3.0, (float)3.0);
}
}
}
}
}