1. ## Another help!

Hello again, I faced a new problem with math, I'm not smart in English math because I don't study Math in English, hope you understand this situation!

This time with Simultaneous mixed equations:
ax+by=m

cx2+dy2=n

The codes are:

Dim a, b, c, d, m, n As Integer
Dim x1, y1, x2, y2 As Double

a = Val(Txt_a.Text)
b = Val(Txt_b.Text)
m = Val(Txt_m.Text)
c = Val(Txt_c.Text)
d = Val(Txt_d.Text)
n = Val(Txt_n.Text)
x1 = (m * a * d + Math.Sqrt(m ^ 2 * a ^ 2 * d ^ 2 - (b ^ 2 * c + a ^ 2 * d) * (d * m ^ 2 - b ^ 2 * n))) / (b ^ 2 * c + a ^ 2 * d)

x2 = (m * a * d - Math.Sqrt(m ^ 2 * a ^ 2 * d ^ 2 - (b ^ 2 * c + a ^ 2 * d) * (d * m ^ 2 - b ^ 2 * n))) / (b ^ 2 * c + a ^ 2 * d)

y1 = (m - a * x1)
y2 = (m - a * x2)
Txt_x1.Text = Convert.ToString(x1)
Txt_x2.Text = Convert.ToString(x2)
Txt_y1.Text = Convert.ToString(y1)
Txt_y2.Text = Convert.ToString(y2)

I'm sure that the bug is from equations' solution.

2. ## Re: Another help!

Here is a picture:

3. ## Re: Another help!

x1, x2 seem right. But for y1, y2

y1 = (m - a * x1) / b

y2 = (m - a * x2) / b

4. ## Re: Another help!

It was like this but didn't work correctly.

5. ## Re: Another help!

What are the equations you are trying to solve? What should be the answers? I solved the ones given in post #1 algebraically and got the same values for x1, x2 as used in the code. y1, y2 should be as post #3.

6. ## Re: Another help!

The Equations:
-1x+2y=2
3x^2 +4y^2=28

X= 2 Y= 2

X1= 2 X2= 2
Y1= -3 Y2= -0.5

7. ## Re: Another help!

hm? still waiting you

8. ## Re: Another help!

X1= 2 X2= 2
Y1= -3 Y2= -0.5
Somehow you're mixed up the names. The correct solution is
Code:
```x1 = 2 y1 = 2
x2 = -3 y2 = -0.5```
As a quadratic is involved, there must be two answers (which can be the same or complex).

9. ## Re: Another help!

Thank you again!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Featured