dr-geo
[Top][All Lists]

## Re: [Dr. Geo] How do I indicate function values? (DrGeo DSL)

 From: Hilaire Fernandes Subject: Re: [Dr. Geo] How do I indicate function values? (DrGeo DSL) Date: Thu, 28 Dec 2023 15:08:09 +0100 User-agent: Mozilla Thunderbird

Hi Hannes,

The y-value does not exist. It is not needed to plot the curve. Indeed, the plot is based on the geometric locus, it depends on a mobile point on a line and dependent point, here a point whose coordinates are computed by the block of code.

See its implementation in the ckass DrGeoSketch. It is a kind of user side implementation, not part of the core Dr. Geo model:

 ```1 2 3 4 5 6 7 8``` ```plot: f from: x0 to: x1 | mobile s pen| s := self segment: x0@0 to: x1@0. mobile := self pointOnLine: s at: 0. pen := self point: [:item | item point x @ (f value: item point x)] parent: mobile. ^ (self locusOf: pen when: mobile) color: Color blue ```

To compute by yourself the y-value, you will need the method above to return the pen point as-well.
You can edit it so it returns a 2-array with both the locus and the pen.

Hilaire

Le 28/12/2023 à 13:09, H. Hirzel a écrit :
Hi Hilaire

I have the following code

| sketch f     |
sketch := DrGeoSketch new axesOn gridOn.
f := [ :x | 0.2 * x * x - 1].
sketch plot: f from: -6 to: 6.

If I execute it I get two points without names.
One on the x-axis and one on the graph.

The point on the x-axis may be dragged to the right and the point on the graph follows.
How make the y-value of the point on the diagram appear?
```--
GNU Dr. Geo
http://gnu.org/s/dr-geo/
http://gnu-drgeo.blogspot.com/```