5 \startsubject[title={Equacions de segon grau senzilles}]
7 \startsubsubject[title={Preguntes}]
17 exercicis[1] = Array.new
21 parametres['a'] = rand(-10..10)
22 parametres['b'] = rand(-10..10)
23 parametres['c'] = rand(-10..20)
24 if parametres['a'] == 0
27 if parametres['b'] == 0
30 if parametres['c'] == 0
34 exercicis[1].push(parametres)
38 \startexercici[reference=exercici-1] Resoleu les equacions:
40 <% exercicis[1].each do |par| %>
42 <% if par['b'] > 0 and par['c'] > 0 %>
43 $<%=par['a']%>x^2 + <%=par['b']%>x + <%=par['c']%> = 0$
45 <% if par['b'] > 0 and par['c'] < 0 %>
46 $<%=par['a']%>x^2 + <%=par['b']%>x <%=par['c']%> = 0$
48 <% if par['b'] < 0 and par['c'] > 0 %>
49 $<%=par['a']%>x^2 <%=par['b']%>x + <%=par['c']%> = 0$
51 <% if par['b'] < 0 and par['c'] < 0 %>
52 $<%=par['a']%>x^2 <%=par['b']%>x <%=par['c']%> = 0$
62 exercicis[2] = Array.new
67 parametres['a'] = rand(-20..20)
68 parametres['b'] = rand(1..30)
69 parametres['c'] = rand(1..30)
70 parametres['d'] = rand(-20..20)
72 if parametres['a'] + parametres['b'] == 0
73 parametres['a'] = parametres['b'] + 1
76 exercicis[2].push(parametres)
81 \startexercici[reference=exercici-2] Resoleu les equacions següents:
83 <% exercicis[2].each do |par| %>
84 \item $<%=par['a']%>x^2 + <%=par['b']%> - <%=par['c']%>x = <%=par['d']%> -<%=par['b']%>x^2 $
93 exercicis[3] = Array.new
98 parametres['a'] = rand(-10..10)
99 if parametres['a'] == 0
102 parametres['b'] = rand(1..10)
104 exercicis[3].push(parametres)
109 \startexercici[reference=exercici-3] Resoleu les equacions següents:
111 <% exercicis[3].each do |par| %>
112 \item <% if par['a'] < 0 %>
113 $(x+<%=par['a'].abs %>)^2 = <%=par['b']%>$
115 $(x-<%=par['a']%>)^2 = <%=par['b']%>$
123 exercicis[4] = Array.new
126 parametres = Hash.new
128 parametres['a'] = rand(-10..10)
129 if parametres['a'] == 0
132 parametres['b'] = rand(1..10)
133 parametres['c'] = rand(-10..10)
134 if parametres['c'] == 0
138 exercicis[4].push(parametres)
143 \startexercici[reference=exercici-4] Resoleu les equacions següents:
145 <% exercicis[4].each do |par| %>
146 \item <% if par['a'] < 0 %>
147 $<%=par['c']%>(x+<%=par['a'].abs %>)^2 = <%=par['b']%>$
149 $<%=par['c']%>(x-<%=par['a']%>)^2 = <%=par['b']%>$
157 exercicis[5] = Array.new
160 parametres = Hash.new
162 parametres['a'] = rand(-10..10)
163 if parametres['a'] == 0
166 parametres['b'] = rand(1..10)
167 parametres['c'] = rand(-10..10)
168 parametres['d'] = rand(-10..10)
170 exercicis[5].push(parametres)
175 \startexercici[reference=exercici-5] Resoleu les equacions següents:
177 <% exercicis[5].each do |par| %>
178 \item $<%=par['a']%>(x+<%=par['b']%>)^2 <%= par['c'] > 0 ? '+' : '-' %><%=par['c'].abs %>x = <%=par['d']%>$
185 <%# ----------------------- Solucions ------------------------ %>
187 \startsubsubject[title={Solucions}]
190 \sym{\in[exercici-1]}
191 \startitemize[a, text]
192 <% exercicis[1].each do |par| %>
194 disc = par['b'].pow(2) - 4*par['a']*par['c']
200 solucio_1 = Rational(Math.sqrt(disc) - par['b'],2*par['a'])
201 solucio_2 = Rational(-Math.sqrt(disc) - par['b'],2*par['a'])
203 \item $x \simeq <%=solucio_1.to_f.round(2)%>, x \simeq <%=solucio_2.to_f.round(2)%>$
208 \sym{\in[exercici-2]}
209 \startitemize[a, text]
210 <% exercicis[2].each do |par| %>
212 disc = par['c']*par['c'] - 4*(par['a']+par['b'])*(par['b'] - par['d'])
218 solucio_1 = Rational(Math.sqrt(disc) + par['c'],2*(par['a']+par['b']))
219 solucio_2 = Rational(-Math.sqrt(disc) + par['c'],2*(par['a']+par['b']))
221 \item $x \simeq <%=solucio_1.to_f.round(2)%>, x \simeq <%=solucio_2.to_f.round(2)%>$
226 \sym{\in[exercici-3]}
227 \startitemize[a, text]
228 <% exercicis[3].each do |par| %>
236 solucio_1 = Rational(Math.sqrt(disc) + par['a'],1)
237 solucio_2 = Rational(-Math.sqrt(disc) + par['a'],1)
239 \item $x \simeq <%=solucio_1.to_f.round(2)%>, x \simeq <%=solucio_2.to_f.round(2)%>$
245 \sym{\in[exercici-4]}
246 \startitemize[a, text]
247 <% exercicis[4].each do |par| %>
249 disc = Rational(par['b'], par['c'])
255 solucio_1 = Rational(Math.sqrt(disc) + par['a'],1)
256 solucio_2 = Rational(-Math.sqrt(disc) + par['a'],1)
258 \item $x \simeq <%=solucio_1.to_f.round(2)%>, x \simeq <%=solucio_2.to_f.round(2)%>$
264 \sym{\in[exercici-5]}
265 \startitemize[a, text]
266 <% exercicis[5].each do |par| %>
268 disc = (2 * par['a']* par['b'] + par['c']).pow(2) - 4*par['a']*(par['a']*par['b'].pow(2) - par['d'])
274 solucio_1 = Rational(Math.sqrt(disc) - (2*par['a']*par['b'] + par['c']),2*par['a'])
275 solucio_2 = Rational(-Math.sqrt(disc) - (2*par['a']*par['b'] + par['c']),2*par['a'])
277 \item $x \simeq <%=solucio_1.to_f.round(2)%>, x \simeq <%=solucio_2.to_f.round(2)%>$
285 Les solucions d'aquests exercicis s'han calculat automàticament usant programari lliure: encara que totes les expressions són correctes, potser algunes es poden simplificar més.
289 <%# ----------------------- Resolució ------------------------ %>
291 \startsubsubject[title={Resolució}]
294 \sym{\in[exercici-1]}
296 <% exercicis[1].each do |par| %>
300 disc = b.pow(2) - 4*a*c
303 \item $<%=a%>x^2 <%= b < 0 ? '-' : '+' %><%= b.abs %>x <%= c < 0 ? '-' : '+' %><%= c.abs %> = 0$ $\Rightarrow$ $(<%=2*a%>x <%= b < 0 ? '-' : '+' %><%= b.abs %>)^2 = <%= b < 0 ? '(' : '' %><%= b %><%= b < 0 ? ')' : '' %>^2 -4\cdot <%= a < 0 ? '(' : '' %><%= a %><%= a < 0 ? ')' : '' %>\cdot <%= c < 0 ? '(' : '' %><%= c %><%= c < 0 ? ')' : '' %>$ $\Rightarrow$ $(<%=2*a%>x <%= b < 0 ? '-' : '+' %><%= b.abs %>)^2 = <%=disc%>$ $\Rightarrow$ <% if disc <0 %> No té solució <% else %> $<%=2*a%>x <%= b < 0 ? '-' : '+' %><%= b.abs %> = \pm \sqrt{<%=disc%>}$ $\Rightarrow$ $x \simeq <%=Rational(Math.sqrt(disc)-b,2*a).to_f.round(2) %>$, $x \simeq <%=Rational(-Math.sqrt(disc)-b,2*a).to_f.round(2) %>$<% end %>
307 \sym{\in[exercici-2]} \startitemize[a]
308 <% exercicis[2].each do |par| %>
313 disc = c.pow(2) - 4*(a+b)*(b-d)
316 \item $<%=a%>x^2 + <%=b%> - <%=c%>x = <%=d%> -<%=b%>x^2$ $\Rightarrow$ $<%=a%>x^2 + <%=b%> -<%=c%>x <%=d < 0 ? '+' : '-'%><%=d.abs%> + <%=b%>x^2 = 0$ $\Rightarrow$ $ <%=a+b%>x^2 - <%=c%>x <%=b-d < 0 ? '-' : '+'%><%=(b-d).abs%> = 0$ $\Rightarrow$ $(<%=2*(a+b)%>x - <%=c%>)^2 = <%=disc%>$ $\Rightarrow$ <% if disc <0 %> No té solució <% else %> $<%=2*(a+b)%>x - <%=c%> = \pm\sqrt{<%=disc%>}$ $\Rightarrow$ $x \simeq <%= Rational(c+Math.sqrt(disc).round(3),2*(a+b)).to_f.round(3) %>$, $x \simeq <%= Rational(c-Math.sqrt(disc).round(3),2*(a+b)).to_f.round(3) %>$ <% end %>
320 \sym{\in[exercici-3]} \startitemize[a]
321 <% exercicis[3].each do |par| %>
326 \item $(x<%= a < 0 ? '+' : '-' %><%=par['a'].abs %>)^2 = <%=par['b']%>$ $\Rightarrow$ $x<%= a < 0 ? '+' : '-' %><%=par['a'].abs %> = \pm \sqrt{<%=par['b']%>}$ $\Rightarrow$ <% if b < 0 %>No té solució <% else %> $x = \pm\sqrt{<%=b%>} <%= a < 0 ? '-' : '+' %><%=par['a'].abs %>$ $\Rightarrow$ $x \simeq <%=Rational(Math.sqrt(b)+a,1).to_f.round(3) %>$, $x \simeq <%=Rational(-Math.sqrt(b)+a,1).to_f.round(3) %>$ <% end %>
330 \sym{\in[exercici-4]} \startitemize[a]
331 <% exercicis[4].each do |par| %>
337 \item $<%=c%>(x<%= a > 0 ? '-' : '+' %><%=a.abs %>)^2 = <%=b%>$ $\Rightarrow$ $(x <%= a > 0 ? '-' : '+' %> <%=a.abs %>)^2 = \frac{<%=b %>}{<%=c %>}$ $\Rightarrow$ <% if c < 0 %> No té solució <% else %> $x = \pm \sqrt{\frac{<%=b %>}{<%=c %>}} <%= a > 0 ? '+' : '-' %><%=a.abs %> $ $\Rightarrow$ $x \simeq <%= (Math.sqrt(Rational(b,c)) + a).round(3)%>$, $x \simeq <%= (-Math.sqrt(Rational(b,c)) + a).round(3)%>$ <% end %>
342 \sym{\in[exercici-5]} \startitemize[a]
343 <% exercicis[5].each do |par| %>
348 disc = (2 * a* b + c).pow(2) - 4*a*(a*b.pow(2) - d)
351 \item $<%=a%>(x+<%=b%>)^2 <%= c > 0 ? '+' : '-' %> <%=c.abs%>x = <%=d%>$ $\Rightarrow$ $<%=a%>(x^2 + <%=2 * b %> x + <%=b.pow(2)%>) <%= c > 0 ? '+' : '-' %> <%=c.abs%>x = <%=d%>$ $\Rightarrow$ $<%=a%>x^2 <%= a > 0 ? '+' : '-' %><%=(2 * a* b).abs %> x <%= a > 0 ? '+' : '-' %> <%=(a*b.pow(2)).abs%> <%= c > 0 ? '+' : '-' %> <%=c.abs%>x = <%=d%>$ $\Rightarrow$ $<%=a%>x^2 <%= 2*a*b +c > 0 ? '+' : '-' %> <%=(2 * a* b + c).abs %> x <%= a*b.pow(2) -d > 0 ? '+' : '-' %> <%= (a*b.pow(2) - d).abs%> = 0$ $\Rightarrow$ $(<%=2*a%>x <%= 2*a*b +c > 0 ? '+' : '-' %> <%=(2 * a* b + c).abs %>)^2 = <%= (2 * a* b + c).pow(2) - 4*a*(a*b.pow(2) - d) %>$ $\Rightarrow$ <% if disc < 0 %> No té solució <% else %> $x \simeq <%= Rational(Math.sqrt(disc) - (2 * a* b + c), 2*a).to_f.round(3) %>$, $x \simeq <%= Rational(-Math.sqrt(disc) - (2 * a* b + c), 2*a).to_f.round(3) %>$ <% end %>
360 La resolució d'aquests exercicis s'ha calculat automàticament usant programari lliure: encara que totes les expressions són correctes, potser algunes es poden simplificar més.