Properties
Similar Topics
Statistics
Comments
7
Participants
2
Subscribers
2
Votes
1
Views
699
Share
Answered
Hello,
I noticed that when I rename an object to a pre-defined function name I get a weird output. Why is that?
Example: Name a point "Point", then type "D = Point(xAxis)" and you'll get an error.
Example: Name a point "Line", then type in the input "Line(P, Q)" you'll get a weird number.
- GeoGebra
- Help
- Partners
-
Contact us
- Feedback & Questions
- This email address is being protected from spambots. You need JavaScript enabled to view it.
- +43 677 6137 2693
© 2023 International GeoGebra Institute
It has got little sense, but if you explicitly want to know it, just give it a try, it's a simple deduction by entering clear values. You'll quickly notice some work others don't, but in general you can say that the name is used as a value. So let's start with objects given names as the thype of the object itself.
Point(Point) = x² + y².
Point (Segment) is a dilatiation with the lenght of the Segment as dilatation factor. Here the coordinates are multiplicated with a factor that equals the lenght of the segment.
Line(Line) doesn't work since the length of a Line is not defined. You can't multiply it by an equation of a line.
Polygon(Polygon) gives the square of the Area, because in it the two values are multiplicated.
So you can work with them as the name is used as the value of it (coordinates of a point, lenght of a segment area of polygon etc). But you can't use it in a command Point(xAxis) since in this expression a value has no sence.
In brief: if possible using names works as using the value of it in an expression and it depends on the exprssion if using a value has got sense or not. 4*(xAxis) doesn't have any sense, but 4 * 4 (being e.g. the length of a Segment) does and gives 16 as result. Distance((4, 2), 5) has no sense so Distance(Point, Segment) with used names will produce an error etc.
That's all...
Isn't it normal that you can't use the same, let's say 'word' for two different kind of things, a command and an already used name for an object? But if you explicitly want to use those kind of terms, used in commands as Point( ) or Line() you could use the same word without capital letters. There's no problem with a name and a definition as e.g. point = Point(xAxis) etcetera.
chris
I'd like to know what is the output of using the name of an object as a function...
It has got little sense, but if you explicitly want to know it, just give it a try, it's a simple deduction by entering clear values. You'll quickly notice some work others don't, but in general you can say that the name is used as a value. So let's start with objects given names as the thype of the object itself.
Point(Point) = x² + y².
Point (Segment) is a dilatiation with the lenght of the Segment as dilatation factor. Here the coordinates are multiplicated with a factor that equals the lenght of the segment.
Line(Line) doesn't work since the length of a Line is not defined. You can't multiply it by an equation of a line.
Polygon(Polygon) gives the square of the Area, because in it the two values are multiplicated.
So you can work with them as the name is used as the value of it (coordinates of a point, lenght of a segment area of polygon etc). But you can't use it in a command Point(xAxis) since in this expression a value has no sence.
In brief: if possible using names works as using the value of it in an expression and it depends on the exprssion if using a value has got sense or not. 4*(xAxis) doesn't have any sense, but 4 * 4 (being e.g. the length of a Segment) does and gives 16 as result. Distance((4, 2), 5) has no sense so Distance(Point, Segment) with used names will produce an error etc.
That's all...
Comments have been locked on this page!