Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Equation
Message
From
26/09/2010 07:13:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01482715
Message ID:
01482765
Views:
73
>it works
>
>But how I will solve more complex equations as
>
> v + 1 =533.61*2**3
>? v
>
>Do I have to pass the 1 to other side ?
>
>It seems hard as the size of equation increases:
>
>v + 1 = (533.61*2**3) + v/2

As others have said, Visual FoxPro can't really solve equations. For most programming languages, a statement like a = b + c isn't even an equation; it is an assignment: the programming language will calculate anything on the right, then copy it to the variable on the left. That's why you get "variable not found".

In very complicated cases, a computer program can help you in the sense that you write some sort of loop, to try different number, or use other numerical approximation methods. There are several advanced methods for this, but for the simple equations you posted so far, it is much easier to solve it with paper and pencil.

The general idea in solving equations is to get the variable on one side, and everything else on the other side. You can add, subtract, multiply or divide both sides of the equation by the same expression. (You should not multiply or divide by zero.)

Here are a few examples.

Example 1:

x + 5 = 3
Solution: If you subtract 5 from both sides of the equation, the "x" will stay alone on the left.
x + 5 - 5 = 3 - 5
x + 0 = 3 - 5
x = -2

Example 2:

5x = 3x + 7
Solution: If you subtract 3x from both sides, you will only have "x" on the left side.
5x - 3x = 3x - 3x + 7
2x = 0 + 7
2x = 7
Next, you divide both sides by 2, to get rid of the 2 on the left:
x = 3.5 (or x = 7/2).

Note: Once you are more familiar with solving equations, some intermediate steps are usually done in the head, without writing them down - I included them for clarity.

I tried both of these at www.wolframalpha.com, and it solved them immediately; unfortunately, it doesn't show how the equation was solved. Perhaps you can find some other site that shows you the steps in solving equations. However, it would still be convenient to learn some very basic algebra. The algebra course taught in high school is more than enough for most purposes.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform