text:
## Archive for October, 2014

### Triangle mesh for image as surface

Sunday, October 26th, 2014

Here’s a little chuck of matlab code I use to make a surface mesh out of an image:

% load image as grayscale
% create triangle mesh grid
[V,F] = create_regular_grid(size(im,2),size(im,1),0,0);
% Scale (X,Y) to fit image
V(:,1) = V(:,1)*size(im,2);
V(:,2) = (1-V(:,2))*size(im,1);
V(:,3) = im(:);

### A very simple method for approximate blue noise sampling on a triangle mesh

Saturday, October 25th, 2014

This morning I was looking over the recent methods for generating blue-noise random samples on an arbitrary surface. Many of them involve dart throwing with complicated rejection schemes to achieve a Poisson-disk sampling (e.g. “Feature-preserving direct blue noise sampling for surface meshes” [Peyrot et al. 2014]), some involve hefty optimization procedures (e.g. “Blue Noise through Optimal Transport” [de Goes et al. 12]). A lot of the effort is spent trying to preserve features. I wasn’t particularly interested in this at the moment, and I just wanted something simple I could quickly code up and play with.

My idea stemmed from the observation that if my surface is a sphere, and I have a enough samples then the distance between samples will approximate their distance in Euclidean space. So an algorithm for Poisson-disk sampling the sphere looks like:

1. Generate n uniformly random samples on the sphere
2. For each sample i find distance dij to closest other sample j, in usual R3 sense
3. Repeat steps 1 and 2 recursively for all samples i such that i < j and dij < re.

where re is the expected radius between samples on the surface. On the unit sphere, this is easy to compute: something like re = sqrt(4/n).

This works quite well:

on the left is the original “white noise” uniform sampling, and on the right I show the iterations of this algorithm converging to a Poisson-disk-like sampling.

Now, for an arbitrary surface my original assumption is no longer true. There may be parts very close to each other in R3 but very far away in terms of the geodesic distance on the surface.

However, there exist a family of methods that lift a surface to an (usually higher dimensional) embedding Rn so that Euclidean distance in Rn approximates geodesic distance (e.g. “Biharmonic Distance” [Lipman et al. 2010]). Using this I can alter my method only slightly to work with arbitrary surfaces:

1. Lift surface to Rn using “Biharmonic embedding”
2. Generate n uniformly random samples on the original surface (the one still in R3)
3. For each sample i find distance dij to closest other sample j, after lifting to Rn
4. Repeat steps 2 and 3 recursively for all samples i such that i < j and dij < re,

but this time re is not so obviously computed. It would be easy to compute the expected geodesic distance radius, but unfortunately the biharmonic embedding I’m using does not preserve units (i.e. dij is only relative to the geodesic distance between samples i and j on the mesh). I could probably compute the expected distortion during the lift to Rn and derive re from that. But I found it much easier to just take the average closest distance between the original n samples after being lifted to Rn. If I recall correctly, this should converge to the correct expected radius as n goes to infinity. So for large n this should be a reasonable thing to do.

It’s working quite well:

again, on the left is the original “white noise” uniform sampling, and on the right I show the iterations of this algorithm converging to a Poisson-disk-like sampling.

I’ve put up matlab code for this in the mesh/random_points_on_mesh.m in my gptoolbox on git. Here’s a use example:

[V,F] = load_mesh('/usr/local/igl/libigl/examples/shared/cheburashka.off');
n = 3000;
Pwhite = random_points_on_mesh(V,F,n);
Pblue = random_points_on_mesh(V,F,n,'Color','blue');
t = tsurf([F;size(V,1)+F],[V;V(:,1)+1.1*(max(V(:,1))-min(V(:,1))) V(:,2:3)],'FaceColor','w','EdgeColor','none','FaceAlpha',0.8);
apply_ambient_occlusion(t);
hold on;
scatter3(Pblue(:,1),Pblue(:,2),Pblue(:,3));
scatter3(Pwhite(:,1)+1.1*(max(V(:,1))-min(V(:,1))),Pwhite(:,2),Pwhite(:,3));
hold off;
axis equal;

Note: The current code is rebuilding a k-nearest neighbor acceleration data structure for all samples every iteration. Surely, this could be optimized.

### The Freedom Tower is a coarse triangle mesh

Sunday, October 19th, 2014

Let’s apply Loop subdivision to make it smoother.

### Extruding a Bezier curve into a triangle mesh in maya

Friday, October 17th, 2014

Today I struggled to convince Maya to let me extrude a Bezier Curve into a solid shape (sweep a closed curve and finish with planar end caps). I could used the Surface > Extrude tool to extrude the curve and then select the boundary edges and use the Surface > Planar tool to close the endcaps, but this just creates a group of 3 surfaces which are not topologically connected.

My end goal today was to create something to send to the 3D printer. So in this case I eventually wanted a triangle mesh. Here’re the steps I took to convert a bezier curve to a polygonal mesh:

1. draw bezier curves
2. find the Polygons > Plane tool
3. draw a plane behind the curves
4. Select one of the curves and the plane
5. Choose Edit Mesh > Project curve onto mesh
6. Select the new projected curve and the plane
7. Choose Edit Mesh > Split Mesh with projected curve
8. Right click and hold and drag to select “Face” selection mode
9. Mouse over the plane until just the filled curve appears (there seem to be many overlapping faces.
10. Choose Edit > Invert Selection
11. Then choose Edit > Delete
12. Select just the original Bezier curve and delete it.
13. Repeat steps 2-12 for the other curves (why can’t we do all curves at once?)
14. Select both filled curves and choose the Polygons > Extrude tool
15. Pull down on the widget’s arrow to extrude.
16. Select both extruded surfaces and choose Mesh > Cleanup...
17. Make sure 4-sided faces is unchecked
18. Make sure Faces with zero geometry area is checked with very small Area tolerance (e.g. 0.00001)
19. Hit Cleanup
20. The choose Mesh > Triangulate
21. The surface is now triangulated. Select everything.
22. File > Export Selection and save as an obj

Wow. So 21 steps. Not particularly easy for a task I thought would be dead simple. I must be missing some faster way to do this.

### Set default axis and figure colors

Wednesday, October 15th, 2014

Here are two commands to permanently change the axes and figure background colors.

set(groot,'DefaultAxesColor',[0.94 0.94 0.94]);
set(groot,'DefaultFigureColor',[0.75 0.75 0.75]);

I find this new combination a bit less abrasive to the eyes.

### Continuous Slider in Matlab

Wednesday, October 15th, 2014

Here’s the typical way to create a slider in matlab:

sld = uicontrol('Style', 'slider','UserData',10,'Callback',@(src,data) disp(src.UserData * src.Value));

The callback here is boring but shows how to use 'UserData' to pass information to the callback: here, it’s just multiplying the slider’s current value by 10 and displaying the result.

However, the callback only triggers on the mouse up event. This is rather unsatisfying. To fix this, add this generic listener to the slider, which bootstraps the current callback:

sld.addlistener('Value','PostSet',@(src,data) data.AffectedObject.Callback(data.AffectedObject,struct('Source',data.AffectedObject,'EventName','Action')));

Now, the callback is firing on the mouse drag events. It’s generic in the since that you shouldn’t need to change this line if you used a different callback. It will even continue to work if you change the callback during interaction.

I’m aping the data parameter in the uicontrol callback with a simple struct. I’m not really sure what this data parameter is good for anyway.

### Ambient occlusion + anti-aliasing in MATLAB

Wednesday, October 15th, 2014

I’m enjoying the new anti-aliased graphics in matlab 2014b. Here’s the xyzrgb dragon rendered with soft lighting, ambient occlusion and a simple colormap:

Here’s the code to reproduce it:

[V,F] = load_mesh('/Users/ajx/Documents/AutoDOF/Code/skinning/skinning/xyzrgb_dragon/xyzrgb_dragon.obj');
AO = ambient_occlusion(V,F,V,per_vertex_normals(V,F),1000);
colormap(parula(9));
t = tsurf(F,V,'EdgeColor','none');
C = squeeze(ind2rgb(floor(matrixnormalize(t.FaceVertexCData)*size(colormap,1))+1,colormap));
t.FaceVertexCData = bsxfun(@times,C,1-AO);
t.SpecularStrength = 0.1;
t.DiffuseStrength = 0.1;
t.AmbientStrength = 0.8;
l = light('Position',[1 1 100],'Style','infinite');
l2 = light('Position',[1 -100 1],'Style','infinite');
set(gca,'XTickLabel',[],'YTickLabel',[],'ZTickLabel',[],'Color',[0.94 0.94 0.94]);
set(gcf,'Color','w');
axis equal
camproj('persp');
t.Vertices = V*axisangle2matrix([0 0 1],pi)*axisangle2matrix([1 0 0],pi/2);
view(-43,6);
axis tight;
drawnow;

The ambient_occlusion call takes quite some time on my little laptop. But I think the result looks nice.

### Read-only proxy class for primitives in C++

Tuesday, October 14th, 2014

One of my least favorite experiences coding in C++ is writing boilerplate setters and getters. Usually I won’t write setters unless I need side effects. For that, read-and-write case I’ll just use public member functions. The most common case I run into is when I have members I’d like to expose as read-only. That is, I want to be able to get the value of a private or protected member. So I’ll end up with something like this:

class MyFancyClass
{
private:
int m_var1;
double m_var2;
...
double m_varn;
public:
int get_var1(){return m_var1}
double get_var2(){return m_var2}
...
double get_varn(){return m_varn}
} a;

This is annoying. Anytime I add a new member m_varnplus1 I’ll need to add a corresponding MyFancyClass::get_varnplus1(). It’s also clunky from the caller’s point of view. I can’t just use something like x = a.m_var1, instead I need to use the caller x = a.get_var1(). Often I find myself getting to lazy to do all this so I just sloppily use:

class MyFancyClass
{
public:
int m_var1;
double m_var2;
...
double m_varn;
} a;

Boom. Fuck it. Everything’s gonna be public.

I’m toying with the idea of widely employing this proxy class for primitives. I’d save the following in RO.h:

#ifndef RO_H
#define RO_H
// A proxy class for creating "read only" members: member
//
template<typename Container, typename Primitive>
class RO
{
friend Container;
public:
inline operator Primitive() const             { return x; }
template<typename Other> inline bool  operator==(const Other& y) const { return x == y; }
template<typename Other> inline bool  operator!=(const Other& y) const { return x != y; }
template<typename Other> inline bool  operator< (const Other& y) const { return x < y; }
template<typename Other> inline bool  operator> (const Other& y) const { return x > y; }
template<typename Other> inline bool  operator<=(const Other& y) const { return x <= y; }
template<typename Other> inline bool  operator>=(const Other& y) const { return x >= y; }
template<typename Other> inline Other operator+ (const Other& y) const { return x + y; }
template<typename Other> inline Other operator- (const Other& y) const { return x - y; }
template<typename Other> inline Other operator* (const Other& y) const { return x * y; }
template<typename Other> inline Other operator/ (const Other& y) const { return x / y; }
template<typename Other> inline Other operator<<(const Other& y) const { return x <<y; }
template<typename Other> inline Other operator>>(const Other& y) const { return x >> y; }
template<typename Other> inline Other operator^ (const Other& y) const { return x ^ y; }
template<typename Other> inline Other operator| (const Other& y) const { return x | y; }
template<typename Other> inline Other operator& (const Other& y) const { return x & y; }
template<typename Other> inline Other operator% (const Other& y) const { return x % y; }
template<typename Other> inline Other operator&&(const Other& y) const { return x && y; }
template<typename Other> inline Other operator||(const Other& y) const { return x || y; }
template<typename Other> inline Other operator~() const                { return ~x; }
template<typename Other> inline Other operator!() const                { return !x; }
protected:
inline RO()                                  :x(){ }
template<typename Other> inline RO(const Other& y)                    :x(y) { }
template<typename Other> inline Primitive& operator= (const Other& y) { return x = y; }
template<typename Other> inline Primitive& operator+=(const Other& y) { return x += y; }
template<typename Other> inline Primitive& operator-=(const Other& y) { return x -= y; }
template<typename Other> inline Primitive& operator*=(const Other& y) { return x *= y; }
template<typename Other> inline Primitive& operator/=(const Other& y) { return x /= y; }
template<typename Other> inline Primitive& operator&=(const Other& y) { return x &= y; }
template<typename Other> inline Primitive& operator|=(const Other& y) { return x |= y; }
template<typename Other> inline Primitive& operator%=(const Other& y) { return x %= y; }
template<typename Other> inline Primitive& operator++()               { return ++x; }
inline Primitive  operator++(int)            { return x++; }
template<typename Other> inline Primitive& operator--()               { return --x; }
inline Primitive  operator--(int)            { return x--; }
inline Primitive* ptr()                      { return &x; }
inline Primitive& ref()                      { return x; }
inline const Primitive* const_ptr() const    { return &x; }
inline const Primitive& const_ref() const    { return x; }
Primitive x;
};

#endif

Then I could use it with something like:

class MyFancyClass
{
typedef MyFancyClass Self;
public:
RO<Self,int> m_var1;
RO<Self,double> m_var2;
...
RO<Self,double> m_varn;
void example_of_write_access()
{
m_var1 = 10;
m_var2 = 100;
m_varn = m_var2++;
}
} a;

Outside this class I’m only allowed read operations int x = a.m_var1 or if(a.m_var1) etc. But I can’t write to these members: can’t write a.m_var2 = 3 or a.m_varn += 7.

I can use my members as usual inside my class with full read and write access: e.g. m_var1 = 10 or m_var2++.

These read only members must be declared public to be readable outside the container class. Declaring them private would be pointless. However, declaring them protected will make them read-only to friends of the container. Thus the public/protected/private class access modifiers effectively determine the read-access, and write-access is always private.

Lingering issue: I’m not sure how you’d create a publicly read-only member who’s write-access was protected (shared with friends and derived classes). Somehow I’d have to convince RO to be friends also with the inherited class, which isn’t known during the definition of the base container class. Seems since friendship is neither inherited nor transitive, this is not going to be easy.

### Burying the rainbow

Monday, October 13th, 2014

I come to bury Caesar, not to praise him.

MATLAB’s newest version has finally tossed the jet default colormap for parula.

The visualization community has long been warning against the use of “rainbow” colormaps like jet. Today I looked around for some of the papers articulating why.

The well-cited, “Rainbow Color Map (Still) Considered Harmful” by David Borland and Russell M. Taylor II presents synthetic counterexamples, highlighting why the “Rainbow” colormap should be avoided.

The first counterexample cites the book Information Visualization: Perception for Design by C. Ware. From the text in [Borland and Taylor], it seems this book contains details of a perceptual study in which subjects correctly order grayscale paint chips consistently but often fail to order “rainbow” paint chips (presumably by hue).

Borland and Taylor go on to write,

Some even put them in alphabetical order. To put them in the so-called correct order, most people must remember Roy G. Biv (red, orange, yellow, green, blue, indigo, violet), or some other mnemonic representation of the order of colors in the rainbow.

I was a bit surprised. I’m quite accustomed to matlab’s jet and would have never chosen the order red, green, yellow, blue. I could admit that perhaps I’m perceptually faster at ordering grayscale colors that hue-based spectra. So I went digging in the Ware book to find the original study to find more details.

In Chapter 4, Application 3 “Application 3: Color Sequences for Data Maps” Ware cites an earlier paper of his called “Color Sequences for Univariate Maps: Theory, Experiments, and Principles”. This paper contains three small scale studies providing evidence against chromatic sequences: one quantitative study and two qualitative survey-style studies. The studies and results are aimed specifically at a pseudocoloring’s ability to represent a height field or surface.

The other cited study is “Face-based Luminance Matching for Perceptual Colormap Generation” by [Kindlmann et al.]. This paper seems to contain a user study regarding their proposed system for luminance calibration and doesn’t seem directly related to Ware’s claim that “Experimental studies have confirmed that grayscale maps are much better for form perception.”

Their more papers cited in “How NOT to Lie with Visualization” by [Rogowitz and Treinish] backing the finding that the “[rainbow hue colormap] produces several well-documented artifacts”. Some of these artifacts are convincing without a perceptual study: e.g. focus is drawn to bright, yellow regions of this MRI while subtleties are drown out in the large green span in the spectrum:

Question: Is there no large scale study quantitatively confirming the perceptual limitations of the rainbow colormap?

Maybe now that Matlab’s changed its default everybody (including probably me) will just stop using it out of laziness and we won’t need to worry about verifying these claims empirically.

I continued through “Rainbow Color Map (Still) Considered Harmful” by David Borland and Russell M. Taylor II to the second counterexample. Here an scalar field varying frequency is mapped to a grayscale colormap and a rainbow” one:

This example immediately puzzled me. Why is so much lost in the green? I would not expect to see this in matlab using either its jet or hsv rainbow colormaps.

Indeed, this counterexample seems particular the choice of “rainbow” colormap.

As a testament to the simplicity of the grayscale colormap, we can directly recover the underlying scalar field by taking the intensity value of the grayscale image in Fig 2 left. Using this, we can recover the colormap used for the “rainbow” visualization from their Fig 2 right. Then, to verify I reproduce the input in matlab above.

Now, I can easily try other colormaps like jet and hsv:

Neither suffer from the washout of the original “rainbow” visualization. Though there’s plenty of room to argue about whether too much attention is drawn from the vertical stripes to the extrema values on the bottom.

Looking at just this scalar field makes it difficult to judge the colormaps being used. Here I’ve taken the domain of scalar values (roughly 0 to 250) linearly and applied colormap:

The top right shows the recovered “rainbow” colormap. Notice the wide range of green values and lack of purple values.

Figure 3 in the same paper shows a “rainbow” colormap with a wider gamut (left):

The recovered colormap seems is well approximated by a truncated versioned of this wider colormap (right).

If we apply the full “rainbow” from Fig 3 to the original data we get a bit more reasonable visualization (left):

whereas the truncated colormap produces a washed out visualization (right) similar to the original one in Figure 2.

It seems rather obvious that using a colormap with such a wide span covered by essentially the same green will be troublesome. Here’re the spans in the recovered colormap, the full “rainbow”, and the truncated rainbow which are within 30.72 RGB8 units from the central “green” value:

The jet and hsv colormaps don’t contain this same green. hsv seems to suffer from a similar problem, but jet to a much lesser degree (more cyan-ish colors). This finding seems to agree with the [Kindlmann et al.] idea that there are “good” rainbows and “bad” rainbows. Though it doesn’t quite count as evidence that all rainbows are bad, (even if we all know that they must be).

To come full circle, here’s that dataset visualized with MATLAB’s new parula colormap:

I’m sold on it. I agree with Robert Kosara’s explanation why rainbows are popular:

Given the issues, why are the rainbow colormap and its variants so popular? I think the answer is quite simple: it’s attractive. Using a single hue to show the data would be reasonably effective, but much less interesting to look at.

parula seems to offer a decent trade-off. I don’t think I’ll mind staring it from now on. Perhaps, I’ll still silently long to see those other hues of the rainbow.

### MATLAB2014b features anti-aliasing

Monday, October 13th, 2014

Finally. I’m pretty happy about the results:

[V,F] = load_mesh('/usr/local/igl/libigl/examples/shared/cheburashka.off');
AO = ambient_occlusion(V,F,V,per_vertex_normals(V,F),1000);
t = tsurf(F,V,fphong,'EdgeColor','none');
C = squeeze(ind2rgb(floor(matrixnormalize(t.FaceVertexCData)*size(colormap,1))+1,colormap));
t.FaceVertexCData = bsxfun(@times,C,1-AO);
t.SpecularStrength = 0.1;
t.DiffuseStrength = 0.1;
t.AmbientStrength = 0.8;
l = light('Position',[1 1 100],'Style','infinite');
l2 = light('Position',[1 -100 1],'Style','infinite');
set(gca,'XTickLabel',[],'YTickLabel',[],'ZTickLabel',[],'Color',[0.94 0.94 0.94]);
set(gcf,'Color','w');

And to spin the camera around:

axis equal
axis vis3d;
camproj('persp');
for f = 1:numel(T)
t = T(f);
view(-cos(t*2*pi)*45,sin(t*2*pi)*45+45);
drawnow;
frame = getframe(gcf);
[SIf,cm] = rgb2ind(frame.cdata,256);
if f == 1
imwrite(SIf,cm,filename,'Loop',Inf,'Delay',0);
else
imwrite(SIf,cm, filename,'WriteMode','append','Delay',0);
end
end

With the awesome but now obsolete myaa.m hacked anti-aliasing, creating this gif would have taken many minutes. This runs in real time.


text:
# Intense Angle Chasing!

Geometry Level 3

Point $$H$$ is the orthocenter of triangle $$ABC$$. Points $$D, E,$$ and $$F$$ lie on the circumcircle of triangle $$ABC$$ such that $$AD || BE || CF$$. Points $$S, T,$$ and $$U$$ are the respective reflections of $$D, E,$$ and $$F$$ across the lines $$BC, CA,$$ and $$AB$$. Given that two angles of quadrilateral $$SHUT$$ (may not be in this orientation) are $$39$$ degrees and $$91$$ degrees. Find the positive difference between the other two angles.

×

format: plain


text:
# The Garden of Clocks

Last week Math With Bad Drawings published a bunch of geometry puzzles by Catriona Shearer. I’m about ready to talk about the first one!

1.
The Garden of Clocks

Spoilers!

For the first five of these, I’m going to use one of two methods: Pairing off shaded regions with unshaded regions of the same area, or adding up shaded regions to make shapes of known area. Generally some dissection is involved in this. Here goes.

1. This is the easiest. Each yellow shaded region is congruent to an unshaded region, and vice versa. Half the circle is shaded.
2. Also easy. The three small regions are what I’ll call “one hour wedges” because if these were clocks, the outer arc would correspond to one hour. The large region can be divided into three one hour wedges. So we have six shaded hours in total, which is half the circle.
3. Just slightly harder. Notice the left shaded region is congruent to the bottom unshaded region. Move the shaded region to the bottom:And now the left unshaded region is congruent to the right shaded region; move the latter:and clearly the shaded region is half the circle.
4. A little harder yet; we’ll have to dissect. Shift the two shaded regions on the side downward by one hour, and draw in some radii:But now you have a couple of unshaded triangles near the sides that are congruent to the shaded triangles at the top. (You can work out why they’re congruent, right?) So you can move the shaded triangles to make two three-hour wedges.And once again, half the circle is shaded.
5. Start this by drawing a couple radii and a chord:Now on the lower left you have a region that’s sort of a right triangle with a curved hypotenuse which you can shift down to the bottom. And you again have a pair of congruent triangles, one shaded and one not, which you can swap.That makes half of one of the stripes into a one-hour wedge. So the three stripes have the same area as six one-hour wedges, or half the circle. Again!
6. And this brings us to the one I had the most trouble with. It’s the only one I couldn’t do by the above dissect-and-rerrange techniques, and I don’t think it can be done that way. I had to resort to calculations, though not difficult ones once I found the way. Start by drawing some extra lines.Now notice: There are 12 congruent circular segments (the little “caps” at the ends of each stripe and two more on the sides), six shaded and six not; they balance. There are eight congruent triangles, four shaded and four not; they balance. There are four congruent rectangles surrounding the central square, two shaded and two not; they balance.

To cope with the rest we need some numbers.
The triangles are $30^\circ-60^\circ-90^\circ$, so if the hypotenuse is $1$ the short side is $1/2$ and the long side is $\sqrt 3/2$. Then the remaining four shaded rectangles have area $4\times(1\times 1/2) = 2$. The shaded central square has area $1^2 = 1$. Total shaded area remaining is $3$. The remaining four unshaded squares have area $4\times(\sqrt 3/2)^2 = 3$. They balance. So the shaded area is (wait for it) half the circle area. Finis!


text:
Dirichlet {DIRECT} R Documentation

## The Dirichlet Distribution

### Description

Functions to compute the density of a Dirichlet distribution and to generate random realizations from such a distribution.

### Usage

dDirichlet (x, alpha, log=FALSE)
rDirichlet (n, alpha)

### Arguments

 alpha Shape parameter vector. x Vector of the same length as alpha. n Number of realizations (vectors) to generate. log Logical value. TRUE if computing the log density. Default is FALSE.

### Value

rDirichlet returns a vector of the same length as alpha if n=1, or a matrix with each row being an independent realization otherwise.

### Author(s)

Audrey Q. Fu coded dDirichlet.

The code for rDirichlet is taken from a similar function in R package gregmisc by Gregory R. Warnes. His code was based on code posted by Ben Bolker to R-News on 15 Dec 2000. See documentation in gregmisc for further information.

### Examples

x <- rDirichlet (5, rep (0.5, 3))
dDirichlet (x[1, ], rep (0.5, 3))

[Package DIRECT version 1.0.1 Index]


text:
# What is the second derivative of f(x)=(x-1)/(x^2+1)?

Mar 6, 2017

$f ' ' \left(x\right) = \frac{2 \left(1 + x\right) \left(1 - 4 x + {x}^{2}\right)}{1 + {x}^{2}} ^ 3.$

#### Explanation:

$f \left(x\right) = \frac{x - 1}{{x}^{2} + 1} .$

Using the Quotient Rule for Diffn., we get, the first deri.,

$f ' \left(x\right) = \frac{\left({x}^{2} + 1\right) \frac{d}{\mathrm{dx}} \left(x - 1\right) - \left(x - 1\right) \frac{d}{\mathrm{dx}} \left({x}^{2} + 1\right)}{{x}^{2} + 1} ^ 2$

$= \frac{\left({x}^{2} + 1\right) \left(1\right) - \left(x - 1\right) \left(2 x\right)}{{x}^{2} + 1} ^ 2 = \frac{{x}^{2} + 1 - 2 {x}^{2} + 2 x}{{x}^{2} + 1} ^ 2$

$\therefore f ' \left(x\right) = \frac{1 + 2 x - {x}^{2}}{1 + 2 {x}^{2} + {x}^{4}}$

Rediff.ing $f ' \left(x\right)$ to get second deri.,

$f ' ' \left(x\right) = \frac{{\left(1 + {x}^{2}\right)}^{2} \frac{d}{\mathrm{dx}} \left(1 + 2 x - {x}^{2}\right) - \left(1 + 2 x - {x}^{2}\right) \frac{d}{\mathrm{dx}} \left(1 + 2 {x}^{2} + {x}^{4}\right)}{{\left({x}^{2} + 1\right)}^{2}} ^ 2$

$= \frac{{\left(1 + {x}^{2}\right)}^{2} \left(2 - 2 x\right) - \left(1 + 2 x - {x}^{2}\right) \left(4 x + 4 {x}^{3}\right)}{{x}^{2} + 1} ^ 4$

$= \frac{2 {\left(1 + {x}^{2}\right)}^{2} \left(1 - x\right) - 4 x \left(1 + {x}^{2}\right) \left(1 + 2 x - {x}^{2}\right)}{{x}^{2} + 1} ^ 4$

$= \frac{2 \left(1 + {x}^{2}\right) \left\{\left(1 + {x}^{2}\right) \left(1 - x\right) - 2 x \left(1 + 2 x - {x}^{2}\right)\right\}}{{x}^{2} + 1} ^ 4$

$= \frac{2 \left(1 + {x}^{2}\right) \left\{1 + {x}^{2} - x - {x}^{3} - 2 x - 4 {x}^{2} + 2 {x}^{3}\right\}}{{x}^{2} + 1} ^ 4$

$\therefore f ' ' \left(x\right) = \frac{2 \left(1 - 3 x - 3 {x}^{2} + {x}^{3}\right)}{1 + {x}^{2}} ^ 3.$

$= \frac{2 \left\{\left(1 + {x}^{3}\right) - 3 x \left(1 + x\right)\right\}}{1 + {x}^{2}} ^ 3$

$= \frac{2 \left\{\left(1 + x\right) \left(1 - x + {x}^{2}\right) - 3 x \left(1 + x\right)\right\}}{1 + {x}^{2}} ^ 3$

$= \frac{2 \left(1 + x\right) \left(1 - x + {x}^{2} - 3 x\right)}{1 + {x}^{2}} ^ 3$

$\Rightarrow f ' ' \left(x\right) = \frac{2 \left(1 + x\right) \left(1 - 4 x + {x}^{2}\right)}{1 + {x}^{2}} ^ 3$

Enjoy Maths.!


text:
# Harvard Astronomy 201b

## CHAPTER: Spitzer Notation

In Book Chapter on March 5, 2013 at 3:19 am

(updated for 2013)

We will use the notation from Spitzer (1978). See also Draine, Ch. 3. We represent the density of a state j as

$n_j(X^{(r)})$, where

• n: particle density
• j: quantum state
• X: element
• (r): ionization state
• For example, $HI = H^{(0)}$

In his book, Spitzer defines something called “Equivalent Thermodynamic Equilibrium” or “ETE”. In ETE, $n_j^*$ gives the “equivalent” density in state j. The true (observed) value is $n_j$. He then defines the ratio of the true density to the ETE density to be

$b_j = n_j / n_j^*$.

This quantity approaches 1 when collisions dominate over ionization and recombination. For LTE, $b_j = 1$ for all levels. The level population is then given by the Boltzmann equation:

$\frac{n_j^\star(X^{(r)})}{n_k^\star(X^{(r)})} = (\frac{g_{rj}}{g_{rk}})~e^{ -(E_{rj} - E_{rk}) / kT }$,

where $E_{rj}$ and $g_{rj}$ are the energy and statistical weight (degeneracy) of level j, ionization state r. The exponential term is called the “Boltzmann factor”‘ and determines the relative probability for a state.

The term “Maxwellian” describes the velocity distribution of a 3-D gas. “Maxwell-Boltzmann” is a special case of the Boltzmann distribution for velocities.

Using our definition of b and dropping the “r” designation,

$\frac{n_k}{n_j} = \frac{b_k}{b_j} (\frac{g_k}{g_j})~e^{-h \nu_{jk} / kT }$

Where $\nu_{jk}$ is the frequency of the radiative transition from k to j. We will use the convention that $E_k > E_j$, such that $E_{jk}=h\nu_{jk} > 0$.

To find the fraction of atoms of species $X^{(r)}$ excited to level j, define:

$\sum_k n_k^\star (X^{(r)}) = n^\star(X^{(r)})$

as the particle density of $X^{(r)}$ in all states. Then

$\frac{ n_j^* (X^{(r)}) } { n^* (X^{(r)})} = \frac{ g_{rj} e^{-E_{rj} / kT} } {\sum_k g_{rk} e^{ -E_{rk} / kT} }$

Define $f_r$, the “partition function” for species $X^{(r)}$, to be the denominator of the RHS of the above equation. Then we can write, more simply:

$\frac{n_j^\star}{n^\star} = \frac{g_{rj}}{f_r} e^{-E_{rj}/kT}$

to be the fraction of particles that are in state j. By computing this for all j we now know the distribution of level populations for ETE.


text:
# Area and Perimeter

Sub Topics

### Area:

Area can be defined as the surface measured inside the boundary of a 2 - dimensional plane objects like triangle, circle, rectangle, square, … In the following diagrams, red surface denotes the area.

Area is measured in terms of unit squares (unit centimeter squares or unit meter squares)

Standard unit of area of plane figures is a square centimeter (cm2) or square meter(m2)

Square centimeter (cm2) is the area of planar region bounded by a square of side one centimeter.

Square meter (m2) is the area of planar region bounded by a square of side one meter.

### Perimeter

Perimeter is the total length required to make the boundary of a 2 - dimensional plane objects such as triangle, circle, rectangle, square,… The black line denotes the perimeter.

## Area and Perimeter Formulas

### Area of Plane Closed Figures

Area of a triangle = $\frac{1}{2}$ x b x h square units where b is the base and h is the height

Area of rectangle = l x w square units where l is the length and w is the width

Area of trapezoid = $\frac{1}{2}$ (a +b) h square units where a and b are the length of the sides of the trapezoid and h is the vertical height

Area of square = a2 square units where a is the length of the side of the square

Area of parallelogram= b x h square units where b and h are base and height of the parallelogram

Area of circle = $\pi$ x r2 square units where r is the radius of the circle

### Perimeter Closed Figures

Perimeter of square = 4a, where 'a' is a side of square.

Perimeter of trapezoid = a + b + c + d, where a, b, c and d are sides of the trapezoid.
Perimeter of triangle : 2s = a + b + c, where a, b, c are sides of the triangle.

Perimeter of rectangle: 2a + 2b => 2(a + b).

## Area and Perimeter Word Problems

Below you could see area and perimeter problems


text:
## Polignone, Debra A.

Compute Distance To:
 Author ID: polignone.debra-a Published as: Polignone, Debra A.; Polignone, D. A.; Polignone, Debra more...less
 Documents Indexed: 10 Publications since 1991 Co-Authors: 5 Co-Authors with 10 Joint Publications 165 Co-Co-Authors

### Co-Authors

 0 single-authored 7 Horgan, Cornelius Oliver 1 Gurtin, Morton Edward 1 Paullet, Joseph Edward 1 Viñals, Jorge 1 Warne, Paul G.

### Serials

 5 Quarterly of Applied Mathematics 2 Journal of Elasticity 1 International Journal of Solids and Structures 1 M$$^3$$AS. Mathematical Models & Methods in Applied Sciences 1 Mathematics and Mechanics of Solids

### Fields

 9 Mechanics of deformable solids (74-XX) 2 Ordinary differential equations (34-XX) 1 Fluid mechanics (76-XX)

### Citations contained in zbMATH Open

8 Publications have been cited 296 times in 271 Documents Cited by Year
Two-phase binary fluids and immiscible fluids described by an order parameter. Zbl 0857.76008
Gurtin, Morton E.; Polignone, Debra; Viñals, Jorge
1996
Cavitation for incompressible anisotropic nonlinearly elastic spheres. Zbl 0856.73024
Polignone, Debra A.; Horgan, Cornelius O.
1993
Effects of material anisotropy and inhomogeneity on cavitation for composite incompressible anisotropic nonlinearly elastic spheres. Zbl 0817.73037
Polignone, Debra A.; Horgan, Cornelius O.
1993
Pure torsion of compressible nonlinearly elastic circular cylinders. Zbl 0751.73014
Polignone, Debra A.; Horgan, Cornelius O.
1991
Pure azimuthal shear of compressible nonlinearly elastic circular tubes. Zbl 0813.73026
Polignone, Debra A.; Horgan, Cornelius O.
1994
Axisymmetric finite anti-plane shear of compressible nonlinearly elastic circular tubes. Zbl 0755.73047
Polignone, Debra A.; Horgan, Cornelius O.
1992
A note on the pure torsion of a circular cylinder for a compressible nonlinearly elastic material with nonconvex strain-energy. Zbl 0817.73008
Horgan, Cornelius O.; Polignone, Debra A.
1995
Existence and a priori bounds for the finite torsion solution for a class of general Blatzko materials. Zbl 1001.74520
Paullet, Joseph E.; Polignone, Debra A.
1996
Two-phase binary fluids and immiscible fluids described by an order parameter. Zbl 0857.76008
Gurtin, Morton E.; Polignone, Debra; Viñals, Jorge
1996
Existence and a priori bounds for the finite torsion solution for a class of general Blatzko materials. Zbl 1001.74520
Paullet, Joseph E.; Polignone, Debra A.
1996
A note on the pure torsion of a circular cylinder for a compressible nonlinearly elastic material with nonconvex strain-energy. Zbl 0817.73008
Horgan, Cornelius O.; Polignone, Debra A.
1995
Pure azimuthal shear of compressible nonlinearly elastic circular tubes. Zbl 0813.73026
Polignone, Debra A.; Horgan, Cornelius O.
1994
Cavitation for incompressible anisotropic nonlinearly elastic spheres. Zbl 0856.73024
Polignone, Debra A.; Horgan, Cornelius O.
1993
Effects of material anisotropy and inhomogeneity on cavitation for composite incompressible anisotropic nonlinearly elastic spheres. Zbl 0817.73037
Polignone, Debra A.; Horgan, Cornelius O.
1993
Axisymmetric finite anti-plane shear of compressible nonlinearly elastic circular tubes. Zbl 0755.73047
Polignone, Debra A.; Horgan, Cornelius O.
1992
Pure torsion of compressible nonlinearly elastic circular cylinders. Zbl 0751.73014
Polignone, Debra A.; Horgan, Cornelius O.
1991
all top 5

### Cited by 375 Authors

 15 Yang, Xiaofeng 13 Grasselli, Maurizio 13 Tachim Medjo, Theodore 12 Abels, Helmut 11 Shen, Jie 10 Horgan, Cornelius Oliver 10 Wang, Qi 7 Frigeri, Sergio 7 Gal, Ciprian Gheorghe Sorin 7 Kotschote, Matthias 7 Zhao, Jia 6 Deugoue, Gabriel 6 Giorgini, Andrea 5 Cheng, Changjun 5 Han, Daozhi 5 Liu, Chun 5 Miranville, Alain M. 5 Morro, Angelo 5 Murphy, Jeremiah G. 5 Saccomandi, Giuseppe 5 Xu, Chuanju 4 Fabrizio, Mauro 4 Garcke, Harald 4 Giesselmann, Jan 4 Giorgi, Claudio 4 Goriely, Alain 4 Hou, Dianming 4 Lima, Pedro Miguel 4 Lowengrub, John Samuel 4 Schimperna, Giulio 4 You, Bo 4 Yuan, Xuegang 4 Zhu, Zhengyou 3 Berti, Alessia 3 Chen, Zhengzheng 3 Dreyer, Wolfgang 3 Gong, Yuezheng 3 Haspot, Boris 3 Kraus, Christiane 3 Peyraut, François 3 Polignone Warne, Debra 3 Polignone, Debra A. 3 Rocca, Elisabetta 3 Shu, Chang 3 Tan, Zhong 3 Temam, Roger Meyer 3 Terasawa, Yutaka 3 Wang, Xiaoming 3 Warne, Paul G. 3 Zhao, Kun 2 Aki, Gonca L. 2 Bochicchio, Ivana 2 Bosia, Stefano 2 Boyer, Franck 2 Bulatov, Mikhail Valer’yanovich 2 Cai, Yongyong 2 Ceniceros, Hector D. 2 Cimmelli, Vito Antonio 2 deBotton, Gal 2 Dede’, Luca 2 Depner, Daniel 2 Diening, Lars 2 Eleuteri, Michela 2 Feng, Zhiqiang 2 Fosdick, Roger L. 2 Freistühler, Heinrich 2 Grün, Günther 2 He, Jingning 2 Huang, Kefu 2 Jiang, Jie 2 Jidjou Moghomye, B. 2 Jin, Ming 2 Jing, Xiaobo 2 Kim, Junseok 2 Labed, Nadia 2 Li, Huiyuan 2 Lin, Ping 2 Merodio, Jose 2 Metzger, Stefan 2 Morgado, Luisa 2 Negrón-Marrero, Pablo V. 2 Ogden, Raymond William 2 Oliveri, Francesco 2 Pace, Angelo Raffaele 2 Paullet, Joseph Edward 2 Pence, Thomas J. 2 Peralta, Gilbert R. 2 Pražák, Dalibor 2 Rajagopal, Kumbakonam Ramamani 2 Ren, Jiusheng 2 Rieger, Marc Oliver 2 Shang, Xinchun 2 Shmuel, Gal 2 Shokrpour Roudbari, Mahnaz 2 Sivaloganathan, Jeyabal 2 Su, Haiyan 2 Sun, Shouwen 2 Van Brummelen, Harald 2 Wang, Xue 2 Wang, Yan ...and 275 more Authors
all top 5

### Cited in 94 Serials

 26 Journal of Computational Physics 16 Journal of Elasticity 13 Mathematics and Mechanics of Solids 12 M$$^3$$AS. Mathematical Models & Methods in Applied Sciences 11 Journal of Scientific Computing 10 Journal of Mathematical Analysis and Applications 8 Annales de l’Institut Henri Poincaré. Analyse Non Linéaire 6 Computers and Fluids 6 Journal of the Mechanics and Physics of Solids 6 Journal of Differential Equations 6 Applied Mathematics and Mechanics. (English Edition) 5 Archive for Rational Mechanics and Analysis 5 Mathematical Methods in the Applied Sciences 4 Computers & Mathematics with Applications 4 International Journal of Engineering Science 4 Journal of Fluid Mechanics 4 Physics of Fluids 4 Journal of Mathematical Fluid Mechanics 3 Computer Methods in Applied Mechanics and Engineering 3 ZAMP. Zeitschrift für angewandte Mathematik und Physik 3 Applied Mathematics and Computation 3 Chinese Annals of Mathematics. Series B 3 Physica D 3 Applied Numerical Mathematics 3 Asymptotic Analysis 3 SIAM Journal on Scientific Computing 3 European Series in Applied and Industrial Mathematics (ESAIM): Control, Optimization and Calculus of Variations 3 Nonlinear Analysis. Real World Applications 3 Discrete and Continuous Dynamical Systems. Series B 2 Acta Mechanica 2 Journal of Engineering Mathematics 2 Applied Mathematics and Optimization 2 Numerische Mathematik 2 Quarterly of Applied Mathematics 2 Applied Mathematics Letters 2 Mathematical and Computer Modelling 2 Journal de Mathématiques Pures et Appliquées. Neuvième Série 2 Continuum Mechanics and Thermodynamics 2 Calculus of Variations and Partial Differential Equations 2 NoDEA. Nonlinear Differential Equations and Applications 2 Discrete and Continuous Dynamical Systems 2 Proceedings of the Royal Society of London. Series A. Mathematical, Physical and Engineering Sciences 2 Journal of Evolution Equations 2 Stochastics and Dynamics 2 Communications on Pure and Applied Analysis 2 Communications in Computational Physics 2 Advances in Applied Mathematics and Mechanics 1 Applicable Analysis 1 Communications in Mathematical Physics 1 International Journal of Solids and Structures 1 Journal of Mathematical Physics 1 Nonlinearity 1 Physics Letters. A 1 Mathematics of Computation 1 Journal of Computational and Applied Mathematics 1 Mathematische Zeitschrift 1 Meccanica 1 Results in Mathematics 1 Zeitschrift für Analysis und ihre Anwendungen 1 Stochastic Analysis and Applications 1 Computational Mechanics 1 European Journal of Applied Mathematics 1 Numerical Algorithms 1 SIAM Journal on Mathematical Analysis 1 SIAM Review 1 Journal of Dynamics and Differential Equations 1 Archive of Applied Mechanics 1 Journal of Nonlinear Science 1 Annales Mathématiques Blaise Pascal 1 Advances in Computational Mathematics 1 Journal of Applied Analysis 1 European Series in Applied and Industrial Mathematics (ESAIM): Proceedings 1 Journal of Applied Mechanics and Technical Physics 1 ZAMM. Zeitschrift für Angewandte Mathematik und Mechanik 1 European Journal of Mechanics. A. Solids 1 European Journal of Mechanics. B. Fluids 1 Interfaces and Free Boundaries 1 Acta Mathematica Sinica. English Series 1 Communications in Nonlinear Science and Numerical Simulation 1 Archives of Computational Methods in Engineering 1 Acta Mathematica Scientia. Series B. (English Edition) 1 Bulletin of the Brazilian Mathematical Society. New Series 1 Milan Journal of Mathematics 1 Multiscale Modeling & Simulation 1 Theoretical and Applied Mechanics 1 Journal of Hyperbolic Differential Equations 1 European Series in Applied and Industrial Mathematics (ESAIM): Mathematical Modelling and Numerical Analysis 1 Discrete and Continuous Dynamical Systems. Series S 1 Vestnik Yuzhno-Ural’skogo Gosudarstvennogo Universiteta. Seriya Matematicheskoe Modelirovanie i Programmirovanie 1 International Journal of Advances in Engineering Sciences and Applied Mathematics 1 Mathematical Control and Related Fields 1 Annals of Applied Mathematics 1 AIMS Mathematics 1 SN Partial Differential Equations and Applications
all top 5

### Cited in 21 Fields

 151 Fluid mechanics (76-XX) 138 Partial differential equations (35-XX) 69 Numerical analysis (65-XX) 68 Mechanics of deformable solids (74-XX) 20 Classical thermodynamics, heat transfer (80-XX) 12 Statistical mechanics, structure of matter (82-XX) 10 Dynamical systems and ergodic theory (37-XX) 9 Calculus of variations and optimal control; optimization (49-XX) 7 Integral equations (45-XX) 7 Probability theory and stochastic processes (60-XX) 7 Geophysics (86-XX) 5 Biology and other natural sciences (92-XX) 4 Ordinary differential equations (34-XX) 3 Real functions (26-XX) 3 Systems theory; control (93-XX) 1 History and biography (01-XX) 1 Special functions (33-XX) 1 Approximations and expansions (41-XX) 1 Optics, electromagnetic theory (78-XX) 1 Quantum theory (81-XX) 1 Operations research, mathematical programming (90-XX)


text:
# Uniform expansion bounds for Cayley graphs of $\mathrm{SL}_2(F_p)$

### Abstract

We prove that Cayley graphs of $\mathrm{SL}_2(\mathbb{F}_p)$ are expanders with respect to the projection of any fixed elements in $\mathrm{SL}(2, \mathbb{Z})$ generating a non-elementary subgroup, and with respect to generators chosen at random in $\mathrm{SL}_2(\mathbb{F}_p)$.

## Authors

Jean Bourgain

School of Mathematics


text:
# Lost in Integrals

integral (2x^2+3)^2dx=?

## Answers and Replies

Defennder
Homework Helper
Expand that polynomial out first, then you can integrate it termwise easily.


text:
PARENTS, STUDENTS, TEACHERS
You can now view questions, answers, 100's of hours of video explanations and step-by-step worked solutions for FREE!

### Primary 6 Problem Sums/Word Problems - Try FREE

Score :
(Single Attempt)

#### Question

Need dedicated, 1-1 help?
PSLE A* 2020 1-1 Tuition By Mr SingaporeMathGuru Results Guaranteed!*

The price of a walkman in Alaska is $90. A similar walkman can be bought in Florida for 80% of the price of the walkman in Alaska. (a) What is the price of the walkman in Florida? (b)Juliet bought the walkman from both states. Since an equal percentage discount was offered on the walkman in both the states, Juliet realized that the same walkman is$16.20 less in Florida than Alaska. Find the percentage discount given on each walkman.

Notes to students:

1. If the question above has parts, (e.g. (a) and (b)), given that the answer for part (a) is 10 and the answer for part (b) is 12, give your answer as:10,12

The correct answer is : 72,10
(a)\$_____, (b)_____%


text:
# 8.15. Balanced Binary Search Trees¶

In the previous section we looked at building a binary search tree. As we learned, the performance of the binary search tree can degrade to $$O(n)$$ for operations like get and put when the tree becomes unbalanced. In this section we will look at a special kind of binary search tree that automatically makes sure that the tree remains balanced at all times. This tree is called an AVL tree and is named for its inventors: G.M. Adelson-Velskii and E.M. Landis.

An AVL tree implements the Map abstract data type just like a regular binary search tree, the only difference is in how the tree performs. To implement our AVL tree we need to keep track of a balance factor for each node in the tree. We do this by looking at the heights of the left and right subtrees for each node. More formally, we define the balance factor for a node as the difference between the height of the left subtree and the height of the right subtree.

$balanceFactor = height(leftSubTree) - height(rightSubTree)$

Using the definition for balance factor given above we say that a subtree is left-heavy if the balance factor is greater than zero. If the balance factor is less than zero then the subtree is right heavy. If the balance factor is zero then the tree is perfectly in balance. For purposes of implementing an AVL tree, and gaining the benefit of having a balanced tree we will define a tree to be in balance if the balance factor is -1, 0, or 1. Once the balance factor of a node in a tree is outside this range we will need to have a procedure to bring the tree back into balance. Figure 1 shows an example of an unbalanced, right-heavy tree and the balance factors of each node.

You have attempted of activities on this page