Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -

Login

Username

Password

Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno
Options

Go back

Topic review (newest first)

gAr
2013-10-11 17:11:00

Hi,

It's a programming language, the programs can be very small compared to other languages.
It has a pretty steep learning curve to make good use of its capabilities.
You may get it here: http://jsoftware.com/

Agnishom
2013-10-11 16:21:54

What is J?

gAr
2013-10-11 15:12:41

Reposting the J code here:

Code:

samp=:1000000
k1=:%:(11%3)
k2=:%:(11%4)
'x1 y1'=: (k1&*@:cos;k2&*@:sin) 2p1*?samp$0
'x2 y2'=: (k1&*@:cos;k2&*@:sin) 2p1*?samp$0
'x3 y3'=: (k1&*@:cos;k2&*@:sin) 2p1*?samp$0
d1=:(((x1-x2)^2)+(y1-y2)^2)^%2    
d2=:(((x1-x3)^2)+(y1-y3)^2)^%2
d3=:(((x3-x2)^2)+(y3-y2)^2)^%2
s=:(d1+d2+d3)%2
area=: %:(s*(s-d1)*(s-d2)*(s-d3))
(+/%#) area
bobbym
2013-10-10 19:42:32

Hi;

This problem came up in another thread.

3 random points are placed on the ellipse 3x^2 + 4y^2 - 12x -16y = -17. What is the expected value of the area of the triangle these three points create?

Let's use geogebra to run a simulation.

The first thing I did was translate this from having a center at (2,2) to having a center at the origin. The new equation is

3 x^2 + 4 y^2 - 11=0

1) Enter d: 3x^2+4y^2 = 11 into the input bar.

Adjust your screen until it is the size you like.

2) Create a slider that increments from1 to 1000  with increment of 1. Call it n. Hide the xy axes.

3) Create 3 points by entering in the input bar:

p1=n / n RandomUniform[0, 360]
p2=n / n RandomUniform[0, 360]
p3=n / n RandomUniform[0, 360]

If you have been following this series of tuts you will understand the strange expression.

4) Enter A=(sqrt(11 / 3) cos(p1 ), sqrt(11) / 2 sin(p1 )) in the input bar.

5) Enter B=(sqrt(11 / 3) cos(p2 ), sqrt(11) / 2 sin(p2 )) in the input bar.

6) Enter A=(sqrt(11 / 3) cos(p3 ), sqrt(11) / 2 sin(p3 )) in the input bar.

These are the vertices of the many triangles we intend to draw. Hide the ellipse we will not need it.

7) Hide the labels of A,B and C.

8) Right click on A, B and C and set trace on. Hit F9 repeatedly and you should see the outline of the ellipse being formed on the screen.

Now use the move graphics view button and gently move the sceen and the traced point will disappear.

9) Set the color of points A, B and C to bright red. Oen in View a spreadsheet.

10) Right click poly1 and check record to spreadsheet. Unclick in the box that comes about the label.

11) Now gently move the slider all the way to left you should see the spreadsheet begin to record values and on the screen a red ellipse forming. Go back and forth with the slider until you have about 1000 entries.

12) Highlight the column with the numbers and hit one variable analysis a small box will appear. Click analyze and on the left you will see the mean among other things. I got 1.63 which is not bad as an estimate for the expected area of a random triangle drawn on that ellipse ( using only 1000 points ).

Your drawing on the graphics screen should look like mine.



More to come...

Board footer

Powered by FluxBB