dr-geo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: H. Hirzel
Subject: Re: [Dr. Geo] How do I indicate function values? (DrGeo DSL)
Date: Thu, 28 Dec 2023 19:15:42 +0000

Done, see attached file.
What do you mean by ' dependent point, .. a point whose coordinates are computed by the block of code'?
How do I _continuously_ while the point on the x-axis is dragged display the y-coordinate of the pen?
Hannes

On Thu, Dec 28, 2023 at 2:08 PM Hilaire Fernandes <hfern@free.fr> wrote:

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/

Attachment: quadratic_function B.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]