#include<sys/stat.h>
…
mkdir(dirname, 0777);
The above implementation is platform-dependent and not in ANSI C standard. It only works under unix type machine.
#include<sys/stat.h>
…
mkdir(dirname, 0777);
The above implementation is platform-dependent and not in ANSI C standard. It only works under unix type machine.
Matlab is great in the sense that it tremendously alleviates the pain of wrestling with data structure so that users can focus on the algorithmic part when playing with their academic or experimental toys. But this also contributes to the lack of awareness of the importance of data structure.
The title states a very simple approximation relation, which can be illustrated by the following plots:


The first plot shows the error of an FEM solution for the Poisson equation
- ∆ u = sin(x)
with Dirichlet boundary condition
u = sin(x).
The 2nd plot shows the mesh.
The equation is solved with P1 elements. So at the left part when x is small, the FEM solution well approximates the true solution sin(x); while the error grows gradually bigger on the right part, as sin(x) deviates from x to a greater extent.
All above = trivia + o(trivia)
The real purpose of this post is to show the lovely picture I got when doing some numerical tests.
The plot looks even prettier under a little finer mesh

This tip is based on several on-line documents.
Add the following line to the file .emacs in your home directory:
(server-start)
Add the following line to .Xresources in your home directory (create the file if nonexistent)
xdvi.editor: emacsclient –no-wait +%l %f
Now run in the terminal:
xrdb .Xresources
Start the Emacs server
M-x server-start
Add the following package in the preamble of the latex file
\usepackage[active]{srcltx}
srcltx is not included in the basic latex package but is still available in the Ubuntu repository.
All set.
Compile the tex file, open the dvi by xdvi, and trace back by a Ctrl +left click.
The above can also be achieved with Kile + kdvi.
References:
2. http://docs.kde.org/kde3/en/kdegraphics/kdvi/inverse-search-editor.html#editor-setup-emacs
Prove the following
det ([A, B; C, D]) = det(A) * det(D – C A^{-1} B)
where A, B, C and D are sub-matrices.
This is a very common proof question related to determinant in a linear algebra course. But very few students will have learned LU decomposition by then. And it might be a good idea to rephrase this exercise question in the later numerics course.
Given a matrix A, say
A = rand(5);
together with two index arrays of the same length, e.g.
I = [1,2];
J = [3,4];
Q: How to shorten the following script into one line? i.e. how to vectorize the performance …
%start
vec =[];
for i=1:length(I)
vec = [vec, A(I(i),J(i))];
end
%end
Any suggestion is greatly appreciated!
this is a blog entry from a simple blog software.
Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!