Properties
Similar Topics
Statistics
Comments
45
Participants
8
Subscribers
2
Votes
1
Views
3620
Share
Answered
hello
let me share three more lines of java code
the created sequence is very large so the timeout is very large
saludos
- 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
Olé :D
MM brain don't stop
thanks
a manual version to create and export graphics easily
inec
select and down A slowly (with arrow)
saludos
Hi MM
This is beautiful and very useful
Thank you very much
(saludos y hasta pronto)
Cool - thanks again mathmagic! Absolutely don't want to see any more appologies for your english - your math solutions are soooo great!
I am trying to make an grapher for 2 linear inequalities like they do in teacher friend in gymnasium (highschool).
I want the "shading lines" to go perpendicular to the line so that they can see the intersection.
But I am terrible with algorithms. So they are perpendicular, but obviously not in the right place.
http://mathcasts.org/gg/bet...
If anybody can fix this so the shading lines are good, I would really appreciate it!
Hi,
With the Linear Inequality "x+y>2" try :
Sequence[If[x (1 - 1 / s1) + k > 2, k - x / s1], k, y(Mmin + (0, 0)), y(Mmax + (0, 0)), (y(Mmax + (0, 0)) - y(Mmin + (0, 0))) / 20]
In the perpendiculary family lines "y = -x/s1 + k"
the condition becomes after the y substitution : x + (-x/s1 + k) > 2
Thankyou Pascal50. That was enough to get me thinking properly.
Still only works with > or < (not >= or <=) but I am happy with its working so far.
http://mathcasts.org/gg/stu...
Any suggestions are more than welcome.
Also, thanks again MathMagic for all your creations!
Hi Linda
In the inequality.ggb , define l0:x+y=2 , dotted, hiden
<applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="./" archive="http://www.geogebra.org/webstart/dev/unpacked/3.1.109.0/geogebra.jar" width="822" height="600">
<param name="filename" value="inequality.ggb">
<param name="framePossible" value="true">
<param name="showResetIcon" value="true">
<param name="enableRightClick" value="true">
<param name="showMenuBar" value="true">
<param name="showToolBar" value="true">
<param name="showToolBarHelp" value="true">
<param name="showAlgebraInput" value="true">
<param name="language" value="en">
Sorry, the GeoGebra Applet could not be started. Please make sure that
Java 1.4.2 (or later) is installed and active in your browser (<a href="http://java.sun.com/getjava... here to install Java now</a>)
</applet>
<script type="text/javascript">
function graph(E1){
Test=E1.replace("=","SantaClaus");
if(Test == E1) { NotEqual =1 } else { NotEqual=0 };
L1=E1.replace(/>/gi,"="); L1=L1.replace(/</gi,"=");
L1=L1.replace("==","=");
document.ggbApplet.evalCommand("l1:"+L1);
if(NotEqual==0) {
document.ggbApplet.evalCommand("l0=l1");
document.ggbApplet.setVisible("l1", false);
document.ggbApplet.setVisible("l0", true);
}
document.ggbApplet.evalCommand("s1=Slope[l1]");
document.ggbApplet.setVisible("s1", false);
document.ggbApplet.evalCommand("b1=y(Intersect[l1,yAxis])");
document.ggbApplet.evalCommand("s2=s1*s1");
document.ggbApplet.evalCommand("k1=b1/s2");
document.ggbApplet.evalCommand("k2=1+1/s2");
T1=E1.replace(/y/gi,"z");
document.ggbApplet.evalCommand("a=segment[corner[1],corner[3]]");
document.ggbApplet.setVisible("a", false);
document.ggbApplet.evalCommand("list1=Sequence[If["+T1+",-x/s1-k1+k2*z ], z, -a, a, a/ 100]");
document.ggbApplet.setColor("list1",0,0,255);
}
</script>
PS: but there (and had already ...) problems when you rewrite the inequality
Thanks piman - I understand now how to add the possibility of "=" and get the dotted or full line.
I appreciate your help - as always!
I have several ideas for fixing this - I just ran out of time to test them. :)
Hi
This seems work very well:
<form name="form1" method=post style="margin-left: 25px; margin-top: 18px; margin-bottom: 0px; font-size: 12px; font-weight: bold;" onSubmit="{graph(ineq1.value); return false;}">
<span style="color: rgb(255, 0, 0);"><b><i>Linear Inequality: </i></b></span>
<input style="color: rgb(255, 0, 0); background: rgb(240,240,240);" size="40" name="ineq1" id="ineq" value="x+y>2" type="text" align="middle">
</form>
<br>
<applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="./" archive="http://www.geogebra.org/web...; width="884" height="527">
<param name="filename" value="inequality2.ggb">
<param name="framePossible" value="true">
<param name="showResetIcon" value="false">
<param name="enableRightClick" value="true">
<param name="showMenuBar" value="true">
<param name="showToolBar" value="true">
<param name="showToolBarHelp" value="true">
<param name="showAlgebraInput" value="true">
<param name="language" value="en">
Sorry, the GeoGebra Applet could not be started. Please make sure that
Java 1.4.2 (or later) is installed and active in your browser (<a href="http://java.sun.com/getjava... here to install Java now</a>)
</applet>
<script type="text/javascript">
function graph(E1){
Test1=E1.replace("=","SantaClaus");
if(Test1 == E1) { equal =0 } else { equal=1 };
Test2=E1.replace("<","SantaClaus");
if(Test2 == E1) { minor =0 } else { minor=1 };
Test3=E1.replace(">","SantaClaus");
if(Test3 == E1) { major =0 } else { major=1 };
if(minor==0 && major==0) {
alert('write an inequality');
return(false);}
L1=E1.replace(/>/gi,"="); L1=L1.replace(/</gi,"=");
L1=L1.replace("==","=");
document.ggbApplet.evalCommand("l1:"+L1);
document.ggbApplet.evalCommand("l0=l1");
document.ggbApplet.setColor("l1",153,0,153);
if(equal==0) {
document.ggbApplet.setVisible("l1", false);
document.ggbApplet.setVisible("l0", true);
}
else{document.ggbApplet.setVisible("l1", true);
document.ggbApplet.setVisible("l0", false);
}
if(major==1){
document.ggbApplet.setVisible("R", true);
}
else{document.ggbApplet.setVisible("R", false);
}
if(minor==1){
document.ggbApplet.setVisible("R'", true);
}
else{document.ggbApplet.setVisible("R"", false);
}
}
</script>
Thanks piman! I won't be able to check it until Wednesday - must earn my paycheck these 3 days :), but I wanted you to know I REALLY appreciate your work and will get back to you late Wednesday.
Hi
Perhaps this version is more interesting:
https://ggbm.at/533765
Linear Inequality:
<form name="form1" method="post" style="margin-left: 25px; margin-top: 18px; margin-bottom: 0px; font-size: 12px; font-weight: bold;" onsubmit="{graph(ineq1.value); return false;}">
<span style="color: rgb(255, 0, 0);"><b><i>Linear Inequality: </i></b></span>
<input style="color: rgb(255, 0, 0); background: rgb(240,240,240);" size="40" name="ineq1" id="ineq" value="x+y>2" type="text" align="middle">
</form>
<br>
<applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="./" archive="http://www.geogebra.org/web...; width="800" height="600" title="undefined">
<param name="filename" value="inequa.ggb">
<param name="framePossible" value="true">
<param name="showResetIcon" value="false">
<param name="enableRightClick" value="true">
<param name="showMenuBar" value="true">
<param name="showToolBar" value="true">
<param name="showToolBarHelp" value="true">
<param name="showAlgebraInput" value="false">
<param name="language" value="en">
Sorry, the GeoGebra Applet could not be started. Please make sure that
Java 1.4.2 (or later) is installed and active in your browser (<a href="http://java.sun.com/getjava... here to install Java now</a>)
</applet>
<script type="text/javascript">
function graph(E1){
Test1=E1.replace("=","SantaClaus");
if(Test1 == E1) { equal =0 } else { equal=1 };
Test2=E1.replace("<","SantaClaus");
if(Test2 == E1) { minor =0 } else { minor=1 };
Test3=E1.replace(">","SantaClaus");
if(Test3 == E1) { major =0 } else { major=1 };
if(minor==0 && major==0) {
alert('write an inequality');return(false);
}
L1=E1.replace(/>/gi,"="); L1=L1.replace(/</gi,"=");
L1=L1.replace("==","=");
document.ggbApplet.evalCommand("l1:"+L1);
document.ggbApplet.evalCommand("l0=l1");
document.ggbApplet.setColor("l1",153,0,153);
if(equal==0) {
document.ggbApplet.setVisible("l1", false);
document.ggbApplet.setVisible("l0", true);
}
else{document.ggbApplet.setVisible("l1", true);
document.ggbApplet.setVisible("l0", false);
}
if(major==1){
document.ggbApplet.setVisible("r2", true);
}
else{document.ggbApplet.setVisible("r2", false);
}
if(minor==1){
document.ggbApplet.setVisible("r1", true);
}
else{document.ggbApplet.setVisible("r1", false);
}
}
hello
hey Piman
very good use for corners and the integral tecnich for filling a zone
saludos
hi
Thanks MM
But the integrals are not defined if l0 is a vertical line ...
Then, in this new version of the applet inequa.ggb I use polygons instead integrals.
The javascript is exactly what I wrote in my last post (edited)
https://ggbm.at/533767
PS:
Yes, it is true that for the case where the line l0 is vertical we can define the intersecting point A = [l0, xAxis], the functions f (x) = y (Corner [1]), g (x) = and (corner [3]) and the integrals
i1 = Integral [f, g, x (Corner [1]), x (A) -0.0001]
i2 = Integral [f, g, x (A) +0.0001, x (Corner) [3]]
But in this case the javascript would be a little longer
Have only gotten through piman's no vertical lines but these are MARVELOUS. Fast and tinted and takes =. I love the way you can manipulate the graphics view. Not only do we have a inequation grapher now (I will get it up this week, but am slow at understanding), but I have learned so much! Thank-you, thankyou!
Hi Piman
I adapted your "integral" technique to 2 lines (and the ability to enter a blank field and erase the inequality).
I realize that you cannot do vertical lines with it, but the polygon algorithm was much longer and I got lost.
So I ask you 2 questions
1. You wrote two ggb lines for integrals for vertical lines, but said javascript would be longer. Is it complex or just longer?
2. Is the polygon algorithm more efficient? If it is, I can work through it.
(I could "understand" the integral algorithm - at least enough to adapt it.)
Here is what I have: http://mathcasts.org/gg/stu...
Thanks again for all your work!
Bonsoir,
But, "10000 x - y>20000" or "10000 x + y>20000" are displayed as "x > 2" should.
Hi Pascal
Its true ... or not
Then we could do a replace y with "Easter Bunny" and if nothing happens multiply the equation times 10000 and add y?
Hi
d: 10000 x + y = 20000
Intersect[d,yAxis] = (0, 2000)
d seems a vertical line but is not
Hi Linda
1. He will be necessarily more longer and more complex, because
if[..., integral1,integral2]
do a number but not the printed area
2. Yes, I think it is more efficient but I still did the test
Hi Birgite
I agree :)
Hi Linda
I'm working with the integrals ... wait
Yes Birgit - I too agree and a polar function too. Thanks for the graphic. Laughed out loud.
Thank-you Piman. For sure I will wait. You are so kind.
Linda
Hi Linda
I made changes in GGB file so that it would be not necessary to change the script
Use the last script (only change filename.ggb)
Don't change Archive "http://www.geogebra.org/web...3.1.111.0/geogebra.jar"
If you change 3.1.111.0 to 3.1.120.0, there are problems loading ggbCAS
https://ggbm.at/533825
Fixed in 3.1.121.0 - please let me know if you find any similar problems. Thanks!
Hi Mike
The loadCAS problem is resolved. Thanks.
But there is a problem with the command Corner[n]
For example, if I define f1(x) = y (Corner[1]) and the coordinates of Corner[1] are changed, the value of f1(x) is not updated
Thanks - keep those bug reports coming!
Hi
I'm relatively new to Geogebra, but after investigation have recommended it to my college to use through out the Maths department as it appears to be both the simplest and the most versatile program I've seen. I've read many of the forum posts, including those regarding inequalities. Not knowing much about Javascript, much of this thread has left me behind. :?
To teach Linear Programming I don't need to input inequalities so I'm not worried iGeogebra doesn't support it yet. What I would like my students to do is input various equalities, select a tool, select a line or curve and then click one side of the line to shade that side. I think I understand that shading is done by creating a polygon bigger than the graphics view but I'm still not sure how to do it. Any help would be much appreciated.
Hi slik ...
I'm sure that it is noch so difficult to create a tool, that creates a shaded Polygon below or above a linear equation.
lets say you have line like ...
f(x)=0.2*x-2
important ... f(x)!
Then enter the following:
E1=(-1000|f(-1000))
E2=(1000|f(1000))
E3=(-1000|+-1000)
E4=(+1000|+-1000)
poly[E1,E2,E3,E4]
You need to change the y-coordinate of E3 and E4 according to where you want the plane ... I think you understand me.
Change the property of the polygon to change the color and make the line around the polygon invisible.
Regards ... Birgit.
It's also the cheapest :) and there's a lot of work going on behind the scenes which will appear over the next couple of years.
That won't work. You'll need to create tools for "shade above", "shade below", "shade right", "shade left" I think. Someone's probably already done that...
Thanks for the quick reply.
@ Birgit - Yes I understand. I've got used to using f(x) for certain things despite already having created the function I want to use with a drawing tool. :laughing:
This sounds good and easy enough for my students to follow, I will search the forum for more on this.
Simon
Of course, I am not exactly certain what piman did, but I think I can give you the general idea.
Please forgive me Piman if I do not explain it properly and certainly correct me.
Piman had 2 ideas - one involved polygons and the other integrals.
I could somewhat understand the integral algorithm so I worked that one into the javascript and then piman (with mathmagic and mike) graciously continued to work until it graphed all linear inequalities.
From what I could gather from the construction protocol, the basic algorithm for a non-vertical line was:
(a) He used the new Corner[] function to find the lower left corner (Cor1) and upper right corner (Cor3) of the active graphics window.
Cor1 and Cor3 are dynamic so that if the user moves the graphics window the points are automatically updated.
(b) He then drew a line segment from Cor1 to Cor3, found the midpoint M and drew a circle c with center M and diameter Cor1Cor3. This circle is automatically bigger than and hence covers the active graphics window.
Then he began to use the line m (the line you want your students to draw).
He drew the line p perpendicular to m and through M.
(c) Then, I think he found the x-values of the intersection points between the circle and the lines m and p and somehow cleverly ordered them to find which two points he would need to cover the graphics window.
(d) Then, using the fact that the GeoGebra Integral[] function will shade the area between two curves, he defined the integral between m and c on the correct side for the given inequality, thus shading the "inequality".
This was "somewhat simpler" algorithm because in order to make a polygon you have to know which sides are being cut by the line and since the graphics window can be changed, the cut sides may also change. So there is alot of checking to do with the polygon algorithm.
@LFS
Thanks a lot.
I'm experimenting at the moment. :D
hello
i have tried (and got it) a similar tool with circle[center of screen , corner of screen]
intersection[line, circle]
sectors inside circle from intersction1 to intersection2
the problem is that the tool must be updated pressing F9 because corner in a tool is not update automaticaly
i asked for the feature in the forum
saludos
BTW: if you think that the tool is important i can debug it with a trick until the feature works
hiya mathmagic - can you upload a ggb with the tool, if it is not too much trouble? Thanks, Linda
Hi
I don't know the trick mentioned by mathmagic but the idea of circular sectors seems to me the simplest and therefore the best
hello
now in spain the teachers have a lot of works
i have not completed the tool but you can help me or wait my holydays
feliz Navidad
saludos
https://ggbm.at/533899
Hi
I'm not sure if I should start a new topic with this, please let me know if you think I should.
After LFS's explanation I tried a bit of work integrating between perpendicular translations of the function to give a shaded band, and I'm able to swap the shading either side of the line. But now I don't know how to go further.
I want to be able to do this with up to six fixed functions, select the function and swap the shading of each to show the feasible region.
Any suggestions?
https://ggbm.at/533901
Hi slik,
I am not too good at tools so I won't be able to look at mathmagic's work until we go to break either.
I did think about piman's idea of circular sectors since you are not doing javascript.
1. ggb1 has only the one line so that you can see the principle
a. find the corners 1 and 3 and draw a slightly bigger circle cir (this part is fixed and doesn't depend on the number of lines)
b1. draw line a.
b2. find the intersection points Aint1 and Aint2 of line a and cir
b3. find midpoint aM of the line segment aSeg joining Aint1 and Aint2
b4. make 2 circular sectors with center aM and points Aint1 and Aint2. (The y-coord of Aint1> ycord of Aint2.)
b5. make boolean(s) to turn the sectors on and off.
2. ggb2 shows how this principle can easily be extended to two lines (you can open the construction protocol to see how everything beginning with a goes with line a, and everything beginning with line b goes with line b.
3. and ggb3 is just ggb2 but with either/or shading.
Hope this helps, Linda
p.s. to change the equation of line a, either double-click on a in the algebra window or input (e.g.): a:2x+3y=1 and hit Enter
https://ggbm.at/533903
https://ggbm.at/533905
https://ggbm.at/533907
Hi
Another solution:
https://ggbm.at/541101
Comments have been locked on this page!