# Revision history [back]

Modelling the problem into a system of equation does not necessarily involve Sage.

Solving the equation can then be done with or without Sage, symbolically or numerically.

Here is an approach to the modelisation part.

Set up a coordinate frame so that

• the pentagon lies horizontally with its centre at the origin O,
• the x-axis bisects one of its edges at its midpoint.

Call A that midpoint, and call

• B be the midpoint of the next edge of the pentagon, so that OA and OB make an angle of 2*pi/5
• C the centre of the hexagon in the vertical plane containing OA,
• D the centre of the hexagon in the vertical plane containing OB,
• U and V the vertices of those two hexagons that are distinct when they lie horizontally, but that coincide once they have been rotated by the mystery angle alpha which we are looking for,
• r the radius of the pentagon, R that of the hexagon.

Use complex coordinates in the xy plane. Let zeta = exp(i*2*pi/5). Let

• ux, uy, uz be the coordinates of U, and let u = ux + i * uy.
• vx, vy, vz be the coordinates of V, and let v = vx + i * vy.

In terms of distances,

• OA = OB = r * cos(pi/5)
• AC = BD = R * cos(pi/6)
• CU = DV = R

If the corresponding hexagons have been rotated by the same angle around their common edge with the pentagon, the z coordinates of U and V are the same: uz = vz = R * cos(pi/6) * sin(alpha).

Their horizontal coordinates are found by decomposing

• the vector OU as OA + AC + CU
• the vector OV as OB + BD + DV

and their expressions as complex numbers are:

• u = r * cos(pi/5) + R * cos(pi/6) * cos(alpha) + R * i
• v = zeta * (r * cos(pi/5) + R * cos(pi/6) * cos(alpha) - R * i)

We have two equations from the geometry:

• the polygons share the same edge length, so r * sin(pi/5) = R * sin(pi/6),

• the angle alpha is such that U and V coincide, so we equate u = v to find alpha.

The first equation lets us express r in terms of R as r = R * sin(pi/6) / sin(pi/5).

From the equation u = v, substituting the values of u and v, and the value of r in terms of R, we get a linear equation in terms of cos(alpha) which easily gives cos(alpha), from where we get alpha with the arccosine function.

In terms of using Sage, some possible exercises here are:

• draw pictures to illustrate the question
• input the various equations above
• perform the substitutions
• solve for cos(alpha)
• solve for alpha

One could try to obtain a numerical solution or an exact solution.

Modelling the problem into a system of equation does not necessarily involve Sage.

Solving the equation

## Dihedral angles in a "soccer ball" polyhedron

The soccer ball polyhedron is the polyhedron made of 12 regular pentagons and 20 regular hexagons, all with the same side length, glued edge to edge, each pentagon adjacent to 5 hexagons, each hexagon adjacent to 3 pentagons and 3 hexagons.

To determine the angle the hexagons make with the plane of a neighbouring pentagon, we restrict our attention to one pentagon and one adjacent hexagon.

### Modelisation and solution

We set up some notation. Call

• P the pentagon, E its centre
• H the hexagon, C its centre
• U, V, W three consecutive vertices of H, such that [UV] is the common edge with P
• A the midpoint of [UV]
• Q the plane that contains P
• q the orthogonal projection to Q
• B = q(C)
• L the line through E perpendicular to Q
• r the rotation by a fifth of a turn around L sending U to V

Observe:

• the rotates r^k(W) form a regular pentagon R parallel to P
• C is a midpoint of an edge of R
• since the hexagon can then be done with or without Sage, symbolically or numerically.

Here tiled by six equilateral triangles, the side length of R is twice that of P

• therefore, both as vectors and as lengths, FC = 2 * EA
• E, A, B are aligned, so, as lengths, EB = EA + AB
• from the plane containing R, q is an approach to the modelisation part.

Set up a coordinate frame so that isometry to Q

• in particular, the lengths EB and FC are equal

### Right-angled triangles

We notice some right-angled triangles:

• the pentagon lies horizontally with its centre

(A, B, C) has a right angle at the origin O,

• the x-axis bisects one of its edges at its midpoint.

Call A that midpoint, and call

• B be the midpoint of the next edge of the pentagon, so that OA and OB make and an angle of 2*pi/5
• alpha at A, so

cos(alpha) = AB / AC

• (E, A, V) has a right angle at A and an angle pi/5 at E, so

tan(pi/5) = AV / EA

• (C, A, V) has a right angle at A and an angle pi/6 at C the centre of the hexagon , so

tan(pi/6) = AV / CA


### Combining our equations

Combining the equations

FC = 2 * EA
FC = EB
EB = EA + AB


we get

EA = AB


Combining with the equations from our right-angled triangles, we get:

cos(alpha) = AB / AC
= EA / AC
= (EA / AV) / (CA / AV)
= (AV / CA) / (AV / EA)
= tan(pi/6) / tan(pi/5)


so in the vertical plane containing OA,

• D the centre of the hexagon in the vertical plane containing OB,
• U and V the vertices of those two hexagons that are distinct when they lie horizontally, but that coincide once they have been rotated by the mystery angle alpha which end,

cos(alpha) = tan(pi/6) / tan(pi/5)


and since we are looking for,

• r the radius of the pentagon, R for a positive angle less than a flat angle, this means:

alpha = arccos(tan(pi/6)/tan(pi/5))


### How can Sage be useful here?

Even though we solved our problem with pen and paper, let's see if Sage can bring something here.

We can define this number in Sage:

sage: a = arccos(tan(pi/6)/tan(pi/5))


and see that of the hexagon.

• Use complex coordinates in the xy plane. Let zeta = exp(i*2*pi/5). Let

• uxSage turns tan(pi/6)/tan(pi/5) into an expression involving square roots: sage: a arccos(1/3*sqrt(3)/sqrt(-2*sqrt(5) + 5)) We can ask Sage for a numerical approximation: sage: a.numerical_approx() 0.652358139784368 We can check what fraction of pi that is: sage: f = (a / pi) sage: f arccos(1/3*sqrt(3)/sqrt(-2*sqrt(5) + 5))/pi and get a numerical approximation: sage: f.numerical_approx() 0.207652045225832 We can check this does not look like a rational number: sage: continued_fraction(f) [0; 4, 1, 4, 2, 2, 1, 16, 7, 10, 2, 3, 4, 1, 8, 3, 1, 1, 1, 6, ...] In the end, the nicest way to express the result is arccos(tan(pi/6)/tan(pi/5)), uy, uz "the angle whose cosine is the ratio of tangents of pi/6 and pi/5", and this is quite satisfactory since the quantities bear a strong relation to the setting of hexagons around a pentagon. Going further It would be the coordinates of U, and let u = ux + i * uy.
•  vx, vy, vz be the coordinates of V, and let v = vx + i * vy.
 In terms of distances, OA = OB = r * cos(pi/5) AC = BD = R * cos(pi/6) CU = DV = R If the corresponding hexagons have been rotated by the same angle around their common edge with the pentagon, the z coordinates of U and V are the same: uz = vz = R * cos(pi/6) * sin(alpha). Their horizontal coordinates are found by decomposing the vector OU as OA + AC + CU the vector OV as OB + BD + DV and their expressions as complex numbers are: u = r * cos(pi/5) + R * cos(pi/6) * cos(alpha) + R * i v = zeta * (r * cos(pi/5) + R * cos(pi/6) * cos(alpha) - R * i) We have two equations from the geometry: the polygons share the same edge length, so r * sin(pi/5) = R * sin(pi/6), the angle alpha is such that U and V coincide, so we equate u = v to find alpha. The first equation lets us express r in terms of R as r = R * sin(pi/6) / sin(pi/5). From the equation u = v, substituting the values of u and v, and the value of r in terms of R, we get a linear equation in terms of cos(alpha) which easily gives cos(alpha), from where we get alpha with the arccosine function. In terms of using Sage, some possible exercises here are: a fun project to draw pictures and animations to illustrate the question input the various equations above perform the substitutions solve for cos(alpha) solve for alphaproblem using Sage. For example, one could produce a 3d animated scene to illustrate folding the hexagons from an initial position spread out in the plane of the pentagon to a final folded up position a 3d animated scene drawing each of the steps of the reasoning above, highlighting the relevant right angled triangles one after the other. One could try to obtain a numerical solution or an exact solution. 

 3 No.3 Revision updated 2021-05-04 11:58:13 +0100 Dihedral angles in a "soccer ball" Baskets of polygons Example: the soccer ball polyhedron The soccer ball polyhedron is the polyhedron made of 12 regular pentagons and 20 regular hexagons, all with the same side length, glued edge to edge, each pentagon adjacent to 5 hexagons, each hexagon adjacent to 3 pentagons and 3 hexagons. To determine the angle the hexagons make with the plane of a neighbouring pentagon, we restrict our attention to one pentagon and one adjacent hexagon. Modelisation and solution We set up some notation. Call P the pentagon, E its centre H the hexagon, C its centre U, V, W three consecutive vertices of H, such that [UV] is the common edge with P A the midpoint of [UV] Q the plane that contains P q the orthogonal projection to Q B = q(C) L the line through E perpendicular to Q r the rotation by a fifth of a turn around L sending U to V Observe: the rotates r^k(W) form a regular pentagon R parallel to P C is a midpoint of an edge of R since the hexagon can be tiled by six equilateral triangles, the side length of R is twice that of P therefore, both as vectors and as lengths, FC = 2 * EA E, A, B are aligned, so, as lengths, EB = EA + AB from the plane containing R, q is an isometry to Q in particular, the lengths EB and FC are equal Right-angled triangles We notice some right-angled triangles: (A, B, C) has a right angle at B and an angle alpha at A, so cos(alpha) = AB / AC (E, A, V) has a right angle at A and an angle pi/5 at E, so tan(pi/5) = AV / EA (C, A, V) has a right angle at A and an angle pi/6 at C, so tan(pi/6) = AV / CA Combining our equations Combining the equations FC = 2 * EA FC = EB EB = EA + AB we get EA = AB Combining with the equations from our right-angled triangles, we get: cos(alpha) = AB / AC = EA / AC = (EA / AV) / (CA / AV) = (AV / CA) / (AV / EA) = tan(pi/6) / tan(pi/5) so in the end, cos(alpha) = tan(pi/6) / tan(pi/5) and since we are looking for a positive angle less than a flat angle, this means: alpha = arccos(tan(pi/6)/tan(pi/5)) How can Sage be useful here? Even though we solved our problem with pen and paper, let's see if Sage can bring something here. We can define this number in Sage: sage: a = arccos(tan(pi/6)/tan(pi/5)) and see that Sage turns tan(pi/6)/tan(pi/5) into an expression involving square roots: sage: a arccos(1/3*sqrt(3)/sqrt(-2*sqrt(5) + 5)) We can ask Sage for a numerical approximation: sage: a.numerical_approx() 0.652358139784368 We can check what fraction of pi that is: sage: f = (a / pi) sage: f arccos(1/3*sqrt(3)/sqrt(-2*sqrt(5) + 5))/pi and get a numerical approximation: sage: f.numerical_approx() 0.207652045225832 We can check this does not look like a rational number: sage: continued_fraction(f) [0; 4, 1, 4, 2, 2, 1, 16, 7, 10, 2, 3, 4, 1, 8, 3, 1, 1, 1, 6, ...] In the end, the nicest way to express the result is arccos(tan(pi/6)/tan(pi/5)), "the angle whose cosine is the ratio of tangents of pi/6 and pi/5", and this is quite satisfactory since the quantities bear a strong relation to the setting of hexagons around a pentagon. Going further It would be a fun project to draw pictures and animations to illustrate the problem using Sage. For example, one could produce a 3d animated scene to illustrate folding the hexagons from an initial position spread out in the plane of the pentagon to a final folded up position a 3d animated scene drawing each of the steps of the reasoning above, highlighting the relevant right angled triangles one after the other. Other examples Let us look at the more general case of a central m-gon surrounded by m lateral n-gons. The hexagon case was a bit special, in that the midpoints of the larger pentagon were are the centre of the hexagon. In general, it is not the centre we need to use, but really the midpoint of the segment joining the pair of vertices one vertex away from the adjacency side. Calling C that midpoint, the formulas we need are: CW = tan(pi/m) * FC CW = tan(pi/m) * FC FC = EA + AB EA = cot(pi/m) AB = 2 * sin(tau/n) * cos(alpha) CW = 1 + 2 * cos(alpha) So altogether we get: cos(alpha) = cot(tau/n) * cot(pi/m) In Sage, define a function: def basket_angle(m, n): return arccos(cot(2*pi/n)*cot(pi/m)) and try it out: sage: a = basket_angle(5, 6) sage: a arccos(1/15*sqrt(3)*sqrt(10*sqrt(5) + 25)) sage: a.n() 0.652358139784368 sage: (a/pi).n() 0.207652045225832 sage: (a * 180 / pi).n() 37.3773681406497 Octagons around a triangle: sage: a = basket_angle(3, 8) sage: a.n() 0.955316618124509 In degrees: sage: (a * 180 / pi).n() 54.7356103172453 
 4 No.4 Revision updated 2021-05-04 21:00:27 +0100 
 Baskets of polygons Example: Baskets Fix two integers m ≥ 3 and n ≥ 4 and consider, in the horizontal plane in three-space, a regular m-gon surrounded by m regular n-gons with the same side length, glued to it edge to edge. Depending on m and n, the outer n-gons can overlap with their neighbours (think of m and n both large) tile perfectly, that is, intersect with each of their neighbours along an edge leave out some space, so that two neighbouring n-gons only share a vertex The second case happens only for finitely many pairs (m, n) and is well studied. The third case happens for every (m, 4) and for finitely many other pairs. In that third case, if we rotate each n-gon by a same angle around its common edge with the central m-gon, as the rotation angle increases, the gap between neighbouring n-gons decreases, until for some special value alpha (depending on m and n), it vanishes and each n-gon shares a full edge with each of its neighbours. We obtain a "basket" ; let's call that an (m, n)-basket. Link with the soccer ball polyhedron The soccer ball polyhedron is the polyhedron made of 12 regular pentagons and 20 regular hexagons, all with the same side length, glued edge to edge, each pentagon adjacent to 5 hexagons, each hexagon adjacent to 3 pentagons and 3 hexagons. One of the pentagons together with its five adjacent hexagons form a (5, 6)-basket. Basket angle The question is: for each m and n, what is the angle alpha to use? Modelisation and solution To determine the angle the hexagons make with the plane of a neighbouring pentagon, alpha, we restrict our attention our attention to one pentagon m-gon and one adjacent hexagon. Modelisation and solutionn-gon. For convenience we take half the side length as our length unit. We set up some notation. Call 

• P the pentagon, M the m-gon, E its centre
• H the hexagon, C its centre
• centre,
• N the n-gon,
• T, U, V, W three four consecutive vertices of HN, such that [UV] is the common edge with M
• A the midpoint of [UV]
• C the midpoint of [TW]
• P
• A the midpoint of [UV]
• Q the plane that contains M
• L the line through E perpendicular to P
• qp the orthogonal projection to Qmap from the whole space to P (parallel to L)
• B = q(C)
• p(C) the orthogonal projection of C to P
• tau the angle of a full turn, that is, tau = 2*pi
• r the rotation map by tau/m (an m-th of a turn) around L the line through E perpendicular to Q
• r sending U to V and T to W;
•  for each integer k, r^k the rotation by a fifth of a turn (k/m)*tau around L sending U to V, (the k-th composition power of r), 
 Observe:

• Notice the rotates r^k(W) r^k(T) for k from 0 to m - 1 (including T and W) form a regular pentagon m-gon parallel to M.

Call R parallel to P

• C is a midpoint of that m-gon, and F its centre. Notice that p(F) = E.

Since the planes containing M and R are parallel, p induces an edge of R

• since the hexagon can be tiled by six equilateral triangles, the side length of R is twice that of P
• therefore, both isometry between them, so FC = EB (both as vectors and as lengths, FC = 2 * EA
• lengths).

Notice E, A, B are aligned, so, as lengths, EB = EA + AB

• from the plane containing R, q is an isometry to Q
• in particular, the lengths EB and FC are equal

### Right-angled trianglestriangles, and a trapezoid

We notice some right-angled triangles:

• (A, B, C) has a right angle at B and an angle alpha at A, so

cos(alpha) = AB / AC


(if n = 4 that triangle is degenerate but the formula still holds)

• (E, A, V) has a right angle at A and an angle pi/5pi/m at E, so

tan(pi/5) tan(pi/m) = AV / EA
cot(pi/m) = EA / AV

• (C, A, V)

and notice that by our choice of length unit, AV = 1

•  (F, C, W) has a right angle at AC and an angle pi/6pi/m at CF, so tan(pi/6) = AV tan(pi/m) = CW / CA FC cot(pi/m) = FC / CW 
 Furthermore, calling H the orthogonal projection of U to the line (TW), (T, H, U) has a right angle at H and an angle tau/n at T, so TH = 2 * cos(tau/n) UH = 2 * sin(tau/n) In the trapezoid (T, U, V, W), C is the midpoint of [WT], the points C, H, T are aligned, and UACH is a rectangle, so CW = CT CT = CH + HT AC = UH = 2 * sin(tau/n) CH = AU = 1 Combining our equations Combining the equationsStarting from the equation FC = 2 * EA cot(pi/m) * CW and substituting FC = EB EB = EA + AB AB = cot(pi/m) + 2 * sin(tau/n) * cos(alpha) and CW = CT = CH + HT = AU + TH = 1 + 2 * cos(tau/n) we get EA = AB cot(pi/m) + 2 * sin(tau/n) * cos(alpha) = cot(pi/m) * (1 + 2 * cos(tau/n)) Combining with the equations from our right-angled triangles, we get:which simplifies to 2 * sin(tau/n) * cos(alpha) = AB / AC = EA / AC = (EA / AV) / (CA / AV) = (AV / CA) / (AV / EA) = tan(pi/6) / tan(pi/5) cot(pi/m) * 2 * cos(tau/n) so in the end,and gives cos(alpha) = tan(pi/6) / tan(pi/5) and since we are looking for a positive angle less than a flat angle, this means: alpha = arccos(tan(pi/6)/tan(pi/5)) cot(pi/m) * cot(tau/n) How can Sage be useful here? Even though we solved our problem with pen and paper, let's see if Sage can bring something here. We can define this number in Sage:Define a function and try it out: def basket_angle(m, n): return arccos(cot(pi/m) * cot(2*pi/n)) Pentagon surrounded by hexagons: sage: a = arccos(tan(pi/6)/tan(pi/5)) and see that Sage turns tan(pi/6)/tan(pi/5) into an expression involving square roots: basket_angle(5, 6) sage: a arccos(1/3*sqrt(3)/sqrt(-2*sqrt(5) arccos(1/15*sqrt(3)*sqrt(10*sqrt(5) + 5)) 25)) sage: a.n() 0.652358139784368 sage: (a/pi).n() 0.207652045225832 sage: (a * 180 / pi).n() 37.3773681406497 We can ask Sage for a numerical approximation:Triangle surrounded by octagons: sage: a.numerical_approx() 0.652358139784368 a = basket_angle(3, 8) sage: a.n() 0.955316618124509 We can check what fraction of pi that is:In degrees: sage: f = (a * 180 / pi) sage: f arccos(1/3*sqrt(3)/sqrt(-2*sqrt(5) + 5))/pi pi).n() 54.7356103172453 and get a numerical approximation: sage: f.numerical_approx() 0.207652045225832 We can check this does not look like a rational number: sage: continued_fraction(f) [0; 4, 1, 4, 2, 2, 1, 16, 7, 10, 2, 3, 4, 1, 8, 3, 1, 1, 1, 6, ...] In the end, the nicest way to express the result is arccos(tan(pi/6)/tan(pi/5)), "the angle whose cosine is the ratio of tangents of pi/6 and pi/5", and this is quite satisfactory since the quantities bear a strong relation to the setting of hexagons around a pentagon. Going further It would be a fun project to draw pictures and animations to illustrate the problem using Sage. For example, one could produce a 3d animated scene to illustrate folding the hexagons from an initial position spread out in the plane of the pentagon to a final folded up position a 3d animated scene drawing each of the steps of the reasoning above, highlighting the relevant right angled triangles one after the other. Other examples Let us look at the more general case of a central m-gon surrounded by m lateral n-gons. The hexagon case was a bit special, in that the midpoints of the larger pentagon were are the centre of the hexagon. In general, it is not the centre we need to use, but really the midpoint of the segment joining the pair of vertices one vertex away from the adjacency side. Calling C that midpoint, the formulas we need are: CW = tan(pi/m) * FC CW = tan(pi/m) * FC FC = EA + AB EA = cot(pi/m) AB = 2 * sin(tau/n) * cos(alpha) CW = 1 + 2 * cos(alpha) So altogether we get: cos(alpha) = cot(tau/n) * cot(pi/m) In Sage, define a function: def basket_angle(m, n): return arccos(cot(2*pi/n)*cot(pi/m)) and try it out: sage: a = basket_angle(5, 6) sage: a arccos(1/15*sqrt(3)*sqrt(10*sqrt(5) + 25)) sage: a.n() 0.652358139784368 sage: (a/pi).n() 0.207652045225832 sage: (a * 180 / pi).n() 37.3773681406497 Octagons around a triangle: sage: a = basket_angle(3, 8) sage: a.n() 0.955316618124509 In degrees: sage: (a * 180 / pi).n() 54.7356103172453 




 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license. about | faq | help | privacy policy | terms of service Powered by Askbot version 0.7.59 Please note: Askbot requires javascript to work properly, please enable javascript in your browser, here is how //IE fix to hide the red margin var noscript = document.getElementsByTagName('noscript')[0]; noscript.style.padding = '0px'; noscript.style.backgroundColor = 'transparent'; askbot['urls']['mark_read_message'] = '/s/messages/markread/'; askbot['urls']['get_tags_by_wildcard'] = '/s/get-tags-by-wildcard/'; askbot['urls']['get_tag_list'] = '/s/get-tag-list/'; askbot['urls']['follow_user'] = '/followit/follow/user/{{userId}}/'; askbot['urls']['unfollow_user'] = '/followit/unfollow/user/{{userId}}/'; askbot['urls']['user_signin'] = '/account/signin/'; askbot['urls']['getEditor'] = '/s/get-editor/'; askbot['urls']['apiGetQuestions'] = '/s/api/get_questions/'; askbot['urls']['ask'] = '/questions/ask/'; askbot['urls']['questions'] = '/questions/'; askbot['settings']['groupsEnabled'] = false; askbot['settings']['static_url'] = '/m/'; askbot['settings']['minSearchWordLength'] = 4; askbot['settings']['mathjaxEnabled'] = true; askbot['settings']['sharingSuffixText'] = ''; askbot['settings']['errorPlacement'] = 'after-label'; askbot['data']['maxCommentLength'] = 800; askbot['settings']['editorType'] = 'markdown'; askbot['settings']['commentsEditorType'] = 'rich\u002Dtext'; askbot['messages']['askYourQuestion'] = 'Ask Your Question'; askbot['messages']['acceptOwnAnswer'] = 'accept or unaccept your own answer'; askbot['messages']['followQuestions'] = 'follow questions'; askbot['settings']['allowedUploadFileTypes'] = [ "jpg", "jpeg", "gif", "bmp", "png", "tiff" ]; askbot['data']['haveFlashNotifications'] = true; askbot['data']['activeTab'] = 'questions'; askbot['settings']['csrfCookieName'] = 'asksage_csrf'; askbot['data']['searchUrl'] = ''; /*<![CDATA[*/ $('.mceStatusbar').remove();//a hack to remove the tinyMCE status bar$(document).ready(function(){ // focus input on the search bar endcomment var activeTab = askbot['data']['activeTab']; if (inArray(activeTab, ['users', 'questions', 'tags', 'badges'])) { var searchInput = $('#keywords'); } else if (activeTab === 'ask') { var searchInput =$('#id_title'); } else { var searchInput = undefined; animateHashes(); } var wasScrolled = $('#scroll-mem').val(); if (searchInput && !wasScrolled) { searchInput.focus(); putCursorAtEnd(searchInput); } var haveFullTextSearchTab = inArray(activeTab, ['questions', 'badges', 'ask']); var haveUserProfilePage =$('body').hasClass('user-profile-page'); if ((haveUserProfilePage || haveFullTextSearchTab) && searchInput && searchInput.length) { var search = new FullTextSearch(); askbot['controllers'] = askbot['controllers'] || {}; askbot['controllers']['fullTextSearch'] = search; search.setSearchUrl(askbot['data']['searchUrl']); if (activeTab === 'ask') { search.setAskButtonEnabled(false); } search.decorate(searchInput); } else if (activeTab === 'tags') { var search = new TagSearch(); search.decorate(searchInput); } if (askbot['data']['userIsAdminOrMod']) { $('body').addClass('admin'); } if (askbot['settings']['groupsEnabled']) { askbot['urls']['add_group'] = "/s/add-group/"; var group_dropdown = new GroupDropdown();$('.groups-dropdown').append(group_dropdown.getElement()); } var userRep = $('#userToolsNav .reputation'); if (userRep.length) { var showPermsTrigger = new ShowPermsTrigger(); showPermsTrigger.decorate(userRep); } }); if (askbot['data']['haveFlashNotifications']) {$('#validate_email_alert').click(function(){notify.close(true)}) notify.show(); } var langNav = $('.lang-nav'); if (langNav.length) { var nav = new LangNav(); nav.decorate(langNav); } /*]]>*/ if (typeof MathJax != 'undefined') { MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], tex2jax: {inlineMath: [["$","$"],["\$","\$"]]} }); } else { console.log('Could not load MathJax'); } //todo - take this out into .js file$(document).ready(function(){ $('div.revision div[id^=rev-header-]').bind('click', function(){ var revId = this.id.substr(11); toggleRev(revId); }); lanai.highlightSyntax(); }); function toggleRev(id) { var arrow =$("#rev-arrow-" + id); var visible = arrow.attr("src").indexOf("hide") > -1; if (visible) { var image_path = '/m/default/media/images/expander-arrow-show.gif?v=19'; } else { var image_path = '/m/default/media/images/expander-arrow-hide.gif?v=19'; } image_path = image_path + "?v=19"; arrow.attr("src", image_path); \$("#rev-body-" + id).slideToggle("fast"); } for (url_name in askbot['urls']){ askbot['urls'][url_name] = cleanUrl(askbot['urls'][url_name]); }