Error in Stright line equation

muraleemn shared this question 8 years ago
Answered

Sir,

I am trying to find the equation of a straight line of the form y=m*x+c. The attached applet is correct for all values of m except m= -1. But it not correct when m = -1. I can not identify the error occurred. Please help me.

https://ggbm.at/552407

Comments (12)

photo
1

Hi

Try

text2 ""+f (it is easier to compare)

but take care with the syntax space between - and x then space beteween - or + and the last number

photo
1

Sir,

Thanks for your reply.

I know it. But I am trying to avoid the spaces.

photo
1

Sir,

See the attached file. There is no space between the coefficient of x and x when the coefficient is +ve. But there is a space while it is -ve

https://ggbm.at/552411

photo
1

There is no space between the coefficient of x and x when the coefficient is +ve. But there is a space while it is -ve


That's a small bug: fixed for next release thanks!

photo
1

Thanks Sir.

What may be the error in the first attached file.

photo
1

What may be the error in the first attached file.


It will work much better if you use lines (y=) instead of functions (f(x)=). Link your textfield to a (hidden?) line b and then use a==b to check if the answer is correct

photo
1

Sir,

As per your suggestion I tried to link the line AB with the input box. But automatically the line changes to a function g(x) while entering the text in the input box and entering. More over while checking the equality with "If[f ≟ g, 1, 0]" of the lines, the value is always 0.

See the attached file

https://ggbm.at/552421

photo
1

Hi

I have change your parameters with m and p and see the synthax in the texte2

Now It seems to work fine


https://ggbm.at/552423


Daniel

photo
1

automatically the line changes to a function g(x) while entering the text


I don't get this behaviour - see this file

https://ggbm.at/552425

photo
1

Daniel Sir,

Thanks for replay.

Please check when m=1 or m=-1

Normally while writing we never write as "1x+3" or -1x+3"

I am trying to input the equation as we write in a paper.

photo
1

murkle sir,

Thanks for your reply.

I tried to write the RHS of the equation only.

More over I got " Line[B,C]" in the inputbox.

While trying to enter text like "2x+3" the line changed.

If possible please check the error in the first post.

I am eager to know the error.

photo
1

While trying to enter text like "2x+3"


In the next version, you will be able to enter this (without the y=) into Input Boxes linked to lines

© 2020 International GeoGebra Institute