Properties
Category
English
Similar Topics
Statistics
Comments
10
Participants
5
Subscribers
0
Votes
1
Views
1395
Share
Answered
I have a problem with a aplet.
I create four fractions, which are defined by a denominator and a numerator: The denominator is a random element in a list, the numerator is a random number between 1 and denominator.
My problem is that I want to avoid any of the fractions to be equal.
Someone who can help? Is it maybe posible to test for identical numbers using the global javascript and recalculate? or is there a other way?
- 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
Tricky, but possible without scripting I think.
* Sort the fractions into size, keeping them in a list like {2,3} for 2/3 using
Sort[ <Values>, <Keys> ]
* check 1st and 2nd. If equal, replace a/b with (a+1)/b
* sort fractions again (now 1st in list is definitely unique)
* check 2nd and 3rd
* etc
See attached file for a start :)
https://ggbm.at/565475
Hi
Murkle was faster.
here an alternative to it using floor(TiedRank[...]).
The explanations are in the file
Raymond
https://ggbm.at/565481
Thanks
when I want two random numbers that are not equal I use the command Shuffle
e.g. list1=Shuffle[{-3,-2,-1,1,2,3,4}]
a=Element[list1,1]
b=Element[list1,2]
You can make the list as long as you want, include or exclude whatever number you want and the two numbers won't be equal.
chris
hello
only if the first element appears twice
i have been working in another algorythm. it is similar to Raymond method and longer, but i think can be useful for another problems.
in the algorythm i say "i wish a command for equivalence classes in a list; i haven't it"}. is it possible a command as
equivalenceClass[<list>,<condition>] ?
saludos
Juan Vicente
https://ggbm.at/565489
You mean something like:
EquivalenceClass[{{1, 2}, {2, 4}, {1, 3}, {2, 3}}, Element[A, 1] * Element[B, 2] == Element[A, 2] * Element[B, 1] ]
What would the output be?
not exactly, because {0,0} could be relationed with all elements.
i meaned EquivalenceClass[{{1, 2}, {2, 4}, {1, 3}, {2, 3},{3,6},{4,8},{4,6}}, Element[A, 1] /Element[A, 2] ]
the output would be {{{1,2},{2,4},{3,6},{4,8}},{{1,3}},{{2,3},{4,6}}}
or EquivalenceClass[{0.6,8.3,0.5,0,8.4,8,5.1,3.2,3.1,5.5},floor(a)]->{{0.6,0.5,0},{8.3,8.4,8},{5.1,5.5},{3.2,3.1}}
saludos
Good idea, thanks:
http://jira.geogebra.org/br...
now i think that the right sintax must be equivalenceClasses[<list>,<variable>,<condition>]
example:
B=(1,1)
list={(2,3),(4,5),(0,3),(3,0),(-3,4)}
equivalenceClasses[list,A,distance[A,B]]->{{(2,3),(0,3),(3,0)},{(4,5),(-3,4)}}
saludos
Juan Vicente
hello again
an idea:Sort[<list>,<keys>,<mode grouping>]
list1 = {x², x² + 1, x³ - 2, x² - 4, x³}
list2 = Zip[Degree[A], A, list1]
list3 = Sort[list1, list2,false]------------->{x², x² + 1, x² - 4, x³ - 2, x³}
list3 = Sort[list1, list2,true]------------->{{x², x² + 1, x² - 4},{ x³ - 2, x³}}
default mode<---> false
saludos
Juan Vicente
Comments have been locked on this page!