text:
# Hodge Star Operator

1. Jul 21, 2014

Hi, I have real problems with the indices here, can someone give me a step by step explanation how to compute stuff with this formula?

$*\omega = \frac{\sqrt{|g|}}{r!(m-r)} \omega_{\mu_{1}\mu_{2}...\mu_{r}}\epsilon^{\mu_{1}\mu_{2}...\mu_{r}}_{v_{r+1}...v_{m}}dx^{v_{r+1}}\wedge...\wedge dx^{v_m}$

For example

$*(dx^{1} \wedge dx^{2})=dx^{3}$

I know the formula is long and ugly, but I can't make sense out of it :/

Greets

2. Jul 21, 2014

### Terandol

To be honest I would suggest never using any of the explicit formulas to compute the hodge star. They are useful for proving things about the operator sometimes but other than that I avoid them as much as possible. The Hodge star is really a very simple thing to compute intuitively but it's hard to write down explicitly so the formulas are all ugly and over complicate the process.

I would simply use the definition to do the computation. By definition, $*\omega$ satisfies the equation $\mu \wedge *\omega =\langle \mu,\omega \rangle \mathrm{vol}_n$. So in your example, we want $dx^1\wedge dx^2\wedge *(dx^1\wedge dx^2)=dx^1\wedge dx^2\wedge dx^3$. Hence, $*(dx^1\wedge dx^2)=dx^3$. This idea always works if you go term by term. Ie. just take a (simple) form, and wedge the original form and the hodge star of this form (order is important here.) This will give you an n-form so now all you have to do to compute the hodge star is normalize and pick out a sign using the volume form so that the defining equation is satified.

It is even easier to compute if you start with an orthonormal coordinate system for your metric. Then you always have
$$*(dx^{i_1}\wedge\cdots\wedge dx^{i_p})=\pm dx^{i_{p+1}}\cdots dx^{i_n}$$
where you choose the plus sign if $dx^{i_1}\wedge\cdots\wedge dx^{i_n}$ has the same orientation as your volume form and the minus sign otherwise.

So, really all the explicit formula does is pick out all the $dx^{i}$ that do not appear in your form, normalize them using the metric and then picks a plus or minus sign as needed. If you are adamant about using the explicit formula for computations, it can of course be done. To use your example again, we have $r=2$ (this is the degree of the form) and $m=3$ (this is the dimension of the manifold. ) Here $\omega_{u_1,u_2}=0$ always except $\omega_{12}=-\omega_{21}=1$ so we can get rid of all terms except $u_1=1,u_2=2$ and $u_1=2,u_2=1$. So now you can just plug everything into the formula and compute:
$$*\omega=\frac{1}{2(3-2)}\left(\omega_{12}\epsilon_{\nu}^{12} dx^\nu +\omega_{21}\epsilon_{\nu}^{21} dx^\nu\right) =\frac{1}{2}\omega_{12} dx^3-\frac{1}{2}\omega_{21} dx^3 =\frac{1}{2} dx^3+\frac{1}{2}dx^3 =dx^3.$$

3. Jul 21, 2014

In the formula $\mu \wedge *\omega = <\mu, \omega>vol_n$, $vol_{3}= \sqrt{1}dx^1\wedge dx^2 \wedge dx^3$ right? But shouldn't $<\mu, \omega>$ be zero? Because the determinant is zero. And what should I take in general for $\mu$? What about $*(dx^{1}\wedge dx^{3})=-dx^{2}$? How do I get this result?

$(dx^{1} \wedge dx^{3}) \wedge *(dx^{1} \wedge dx^{3})=(dx^{1} \wedge dx^{3})\wedge (-dx^{2})= -dx^{1}\wedge dx^{3} \wedge dx^{2}= dx^{1}\wedge dx^{2} \wedge dx^{3}$

In the complicated formula, what did you do with the $v_{r+1}$ index? Shouldn't it be $v_{3}$ then? And what does that mean? Further there is another definition where one has to contract the epsilon tensor with the metric tensor:

$\epsilon^{\mu_{1}\mu_{2}...\mu_{m}}=g^{\mu_{1}v_1}g^{\mu_{2}v_{2}}...g^{\mu_{m}v_{m}}\epsilon_{v_{1}v_{2}...v_{m}}=g^{-1}\epsilon_{\mu_{1}\mu_{2}...\mu_{m}}$

I know that you can raise and lower indices when you contract with the inverse metrics but why is it necessary in this case?

Greets

Last edited: Jul 21, 2014
4. Jul 21, 2014

### Terandol

Yes, I was using the standard volume form $vol_n=dx^1\wedge dx^2\wedge dx^3$. The determinant is not zero though. These are 2-forms so the relevant determinant using the standard metric is
$$\langle dx^1\wedge dx^2, dx^1\wedge dx^2 \rangle = \mathrm{det} \left( \begin{bmatrix} \langle dx^1, dx^1\rangle & \langle dx^1, dx^2 \rangle \\ \langle dx^2, dx^1\rangle & \langle dx^2, dx^2 \rangle \end{bmatrix} \right)= \mathrm{det} \left( \begin{bmatrix} 1&0\\ 0&1 \end{bmatrix} \right) =1.$$

The simplest thing to try is to take $\mu=\omega$ if you are trying to compute $*\omega$. This will usually allow you to compute all $*(dx^{i_1} \wedge \cdots \wedge dx^{i_p} )$ which completely computes the hodge star on all forms be linearity. If your coordinates are orthonormal this will always work and will just give the second formula in my previous post. If not, you may have to try a couple different forms to make it work.

Yes, maybe I should have used the notation $\nu=\nu_3$ in my last answer to stick to the notation in the formula. I don't really think it means anything, the formula just splits a collection of m arbitrary indices into a collection of r arbitrary indices labelled by $\mu_i$'s and a collection of m-r arbitrary indices labelled by $\nu_j$. I don't really see any significance to this other than making it easy to see which indices to contract with in the formula but you could just as easily label all $m$ indices as $\mu_i$'s.

Contracting indices is the same thing as using the isomorphism from the tangent space to the cotangent space to transform $(r,s)$-tensors to $(r-i, s+i)$-tensors. So you can contract a (1,0)-tensor and a (0,1)-tensor directly since one is in the tangent space and one is in the cotangent space. However, if you want to contract two (1,0)-tensors you first have to use the metric to convert one of the (1,0)-tensors into a (0,1)-tensor (ie. raise/lower indices of one of the tensors) and then you can contract. My guess is that in the formula they need to contract the levi-civita tensor with some other tensors of the same kind and so they first need to raise the indices to make the tensor contraction possible.

5. Jul 21, 2014

Oh sry, I edited my post while you already answered it. I think I understood it now. Another puzzle stone done. Thank you for your clear explanations !

Greets

Last edited: Jul 21, 2014
6. Aug 12, 2014

### Geometry_dude

In case you need to formalize everything, the correct written out formula for the hodge star on pseudo-Riemannian manifolds with signature $(n^+,n^-)$ is
$$\alpha = \frac{1}{k!} \alpha_{i_1 \dots i_k} \, d x^{i_1}\wedge \dots \wedge d x^{i_k}$$
$$\implies$$
$$\star \alpha = \frac{(-1)^{n^-}}{k! (n-k!)} \, \alpha_{i_1 \dots i_k} \, g^{i_1 j_1} \cdots g^{i_k j_k} \, \varepsilon_{j_1 \dots j_k j_{k+1} \dots j_n} \, \sqrt{\lvert \det g \rvert} \, d x^{j_{k+1}} \wedge \dots \wedge d x^{j_n}$$
and you can use the identities for the Levi Civita symbol to make computations.

Last edited: Aug 12, 2014


text:
# DART: directed automated random testing

By

Full Text:
http://doi.acm.org/10.1145/1065010.1065036

## Abstract

We present a new tool, named DART, for automatically testing software that combines three main techniques: (1) automated extraction of the interface of a program with its external environment using static source-code parsing; (2) automatic generation of a test driver for this interface that performs random testing to simulate the most general environment the program can operate in; and (3) dynamic analysis of how the program behaves under random testing and automatic generation of new test inputs to direct systematically the execution along alternative program paths. Together, these three techniques constitute Directed Automated Random Testing, or DART for short. The main strength of DART is thus that testing can be performed completely automatically on any program that compiles -- there is no need to write any test driver or harness code. During testing, DART detects standard errors such as program crashes, assertion violations, and non-termination. Preliminary experiments to unit test several examples of C programs are very encouraging.

## BibTeX

@inproceedings{conf/pldi/GodefroidKS05,
author = "Godefroid, Patrice and Klarlund, Nils and Sen, Koushik",
editor = "Sarkar, Vivek and Hall, Mary W.",
title = "{DART}: directed automated random testing",
booktitle = "PLDI",
crossref = "conf/pldi/2005",
ee = "http://doi.acm.org/10.1145/1065010.1065036",
keywords = "formal methods, software engineering",
pages = "213-223",
year = "2005",
}

@proceedings{conf/pldi/2005,
editor = "Sarkar, Vivek and Hall, Mary W.",
title = "Proceedings of the ACM SIGPLAN 2005 Conference on
Programming Language Design and Implementation, Chicago, IL, USA,
June 12-15, 2005",
isbn = "1-59593-056-6",
publisher = "ACM",
year = "2005",
}

format: plain


text:
# How to calculate SNR of dead-band quantizer?

Suppose we have a dead-band quantizer with $$\ N = 5 \ quantizing \ levels$$ which uses $$\ b = 3 \ bits$$ for each produced symbol. The quantizer gets as input a uniformly distributed signal $$\ X$$ at the interval $$\ [-10,10]$$. How can I calculate the signal to noise ratio $$\ SNR$$ of the quantizer ?


text:
# 2.2. Torque Model Set-up¶

The setup of the rotational state is similar to the set-up of the translational acceleration framework.

The user can define the settings for the torque acting on a vehicle in the following variable: SelectedTorqueMap.

class SelectedTorqueMap

This is a typedef for:

std::map< std::string, std::map< std::string, std::vector< std::shared_ptr< torqueSettings > > > >

Just as in the translational acceleration setup, the first key is the body undergoing the torque, the second key is the body exerting the torque, and the third entry is a vector of torqueSettings. The available torque models are given in an enum called AvailableTorque. An example can be given using the Apollo capsule example:

SelectedTorqueMap selectedTorqueModelMap;
selectedTorqueModelMap[ "Apollo" ][ "Earth" ].push_back( std::make_shared< TorqueSettings >( aerodynamic_torque ) );

Currently, there are only two options for the torque settings, both which are not derived classes of the TorqueSettings class, and do not need extra information. Thus both can be defined in a similar way.

When all the settings of the torque acting on the body are defined, the TorqueModelMap can be created as follows:

TorqueModelMap torqueModelMap = createTorqueModelsMap( bodyMap, selectedTorqueModelMap )

This will create a map that can be used as an input to the RotationalStatePropagatorSettings.

## 2.2.1. Available Models¶

Currently, there are two torque models that can be used for the rotational state propagator:

Second-order Gravitational Torque

Torque exerted by a point mass on a body with a degree two spherical harmonics mass distribution. A degree two spherical harmonics mass distribution can be represented by an inertia tensor, thus for this torque model, the body undergoing the torque needs to have an inertia tensor defined. The body exerting the torque only needs to have a point-mass gravitational model defined.

The settings are created as follows, for a torque exerted by "Mars" on body "Phobos":

SelectedTorqueMap selectedTorqueModelMap;
selectedTorqueModelMap[ "Apollo" ][ "Earth" ].push_back( std::make_shared< TorqueSettings >( second_order_gravitational_torque ) );

Requires the following environment models to be defined:

class SphericalHarmonicTorqueSettings

Torque exerted by a point mass on a body with an arbitrary degree/order spherical harmonics mass distribution. The body exerting the torque only needs to have a gravitational model defined.

The settings are created with the dedicated SphericalHarmonicTorqueSettings class. As an example, for a spherical harmonic torque, expanded to degree and order 8, exerted by "Mars" on body "Phobos":

SelectedTorqueMap selectedTorqueModelMap;
int maximumDegree = 8;
int maximumOrder = 8;
selectedTorqueModelMap[ "Apollo" ][ "Earth" ].push_back( std::make_shared< SphericalHarmonicTorqueSettings >( maximumDegree, maximumOrder ) );

Requires the following environment models to be defined:

Aerodynamic Torque

Torque exerted by a body with an atmosphere model and shape model on another body. It is important that the body exerting the torque has an atmosphere model defined, and a shape model, if this is not the case, the torque cannot be calculated. Furthermore, the body undergoing the torque needs to have aerodynamic coefficient interface defined, and needs to have its moment coefficients defined. The settings are created as follows, for an aerodynamic torque exerted by "Earth" on body "Apollo":

SelectedTorqueMap selectedTorqueModelMap;
selectedTorqueModelMap[ "Apollo" ][ "Earth" ].push_back( std::make_shared< TorqueSettings >( aerodynamic_torque ) );

Requires the following environment models to be defined:

• Atmosphere model for body exerting torque (set by AtmosphereSettings).
• Shape model for body exerting torque (set by BodyShapeSettings).
• Aerodynamic coefficient interface for body undergoing torque (set by AerodynamicCoefficientSettings). NOTE: In the case that the aerodynamic coefficients are defined as a function of the vehicle orientation (e.g. angle of attack and sideslip angle), these angles can be manually or automatically defined.
• Current state of body undergoing torque and body with atmosphere.


text:
# The Basics of Physics with Calculus – Part II

## Presentation on theme: "The Basics of Physics with Calculus – Part II"— Presentation transcript:

The Basics of Physics with Calculus – Part II
AP Physics C

The “AREA” We have learned that the rate of change of displacement is defined as the VELOCITY of an object. Consider the graph below v (m/s) Notice that the 12 m happens to be the AREA under the line or the height( v = 3 m/s) times the base( t= 4 seconds) = 12 meters v =3 m/s Area = 12 m t(s) t1= 1s This works really nice if the function is linear. What if it isn't? t1= 5s

The “Area” How do we determine HOW FAR something travels when the function is a curve? Consider the velocity versus time graph below v (m/s) The distance traveled during the time interval between t1 and t2 equals the shaded area under the curve. As the function varies continuously, determining this area is NOT easy as was the example before. v(t +Dt) v(t) t(s) t1 t2 So how do we find the area?

Once again, we ZOOM in… Place a differential time
interval dt about time t ( see graph). This rectangle is SUPER SMALL and is only visible for the purpose of an explanation. Consider an arbitrary time t v (m/s) The idea is that the AREA under the curve is the SUM of all the areas of each individual “dt”. v(t) dt t(s) t1 t t2 2 1 With “dt” very small, area 1 fits into area 2 so that the approximate area is simply the area of the rectangle. If we find this area for ALL the small dt's between t1 and t2, then added them all up, we would end up with the TOTAL AREA or TOTAL DISPLACEMENT.

The “Integral” The temptation is to use the conventional summation sign “S" . The problem is that you can only use the summation sign to denote the summing of DISCRETE QUANTITIES and NOT for something that is continuously varying. Thus, we cannot use it. When a continuous function is summed, a different sign is used. It is called and Integral, and the symbol looks like this: When you are dealing with a situation where you have to integrate realize: • WE ARE GIVEN: the derivative already • WE WANT: The original function x(t) So what are we basically doing? WE ARE WORKING BACKWARDS!!!!! OR FINDING THE ANTI -DERIVATIVE

Example An object is moving at velocity with respect to time according to the equation v(t) = 2t. a) What is the displacement function? Hint: What was the ORIGINAL FUCNTION BEFORE the “derivative? was taken? b) How FAR did it travel from t = 2s to t = 7s? These are your LIMITS! 45 m You might have noticed that in the above example we had to find the change(D) over the integral to find the area, that is why we subtract. This might sound confusing. But integration does mean SUM. What we are doing is finding the TOTAL AREA from 0-7 and then the TOTAL AREA from 0-2. Then we can subtract the two numbers to get JUST THE AREA from 2-7.

In summary… So basically derivatives are used to find SLOPES and Integrals are used to find AREAS. When do I use limits? There are only TWO things you will be asked to do. DERIVE – Simply find a function, which do not require limits EVALUATE – Find the function and solve using a given set of limits.

Example Here is a simple example of which you may be familiar with:
Assume we know the circumference of a circle is 2pr, where r is the radius. How can we derive an expression for the area of a circle whose radius is R? We begin by taking a differential HOOP of radius "r" and differential thickness “dr” as shown. If we determine the area of JUST OUR CHOSEN HOOP, we could do the calculation for ALL the possible hoops inside the circle. Having done so, we would then SUM up all of those hoops to find the TOTAL AREA of the circle. The limits are going to be the two extremes, when r = R and when r = 0

Example cont’ If we break this hoop and make it flat, we see that it is basically a rectangle with the base equal to the circumference and the height equal to “dr”.

Can we cheat? …YES! Here is the integral equation. Simply take the exponent, add one, then divide by the exponent plus one.

The perfect tool…TI-89! The TI-89 graphing calculator can do ALL the calculus to truly need to do. Whether you are DERIVING or EVALUATING a function it can help you get the correct answer. First let me show you how to put a derivative into the calculator. Using the SECOND key the derivative symbol is just above the number "8" key. A parenthesis will automatically appear. Type in the function you want like 5t3+2t2-5 . After typing the function, put a comma after it and tell the calculator "WITH RESPECT TO WHAT" do you want to find the derivative of . In this case, we want "WITH RESPECT TO TIME or t" . So we place a "t" after the comma and close the parenthesis. Hit enter and you will find the NEW FUNCTION = DERIVATIVE.

The perfect tool…TI-89! Suppose we want to now EVALUATE this function. In other words, I may want to what the velocity is at exactly t =4 seconds. Velocity is the derivative of a displacement function! So we first have to derive the new function. Then we have to evaluate it at 4 seconds. All you do is enter a vertical line located next to the "7" key then type in t = 4. As you can see we get a velocity of 256 m/s. That is pretty fast!

The perfect tool…TI-89! Start by using the second key. The integration symbol is located just ABOVE the "7". It, as well, will come with a parenthesis to begin with. Keep this in mind as you are entering in functions. Enter the function, then use a comma, then state with respect to what. In this case we have TIME. Remember you can check your answer by taking the derivative of the function to see if you get the original equation.

The perfect tool…TI-89! Now let's look at evaluating the
function. THIS IS CALLED APPLYING THE LIMITS. In other words, over what period are we summing the area. It could be a length of time, a distance, an area, a volume...ANYTHING! After stating what you are with respect to, enter in the LOWER LIMIT first, then the UPPER LIMIT, then close the parenthesis. So let's say this function was a VELOCITY function. The area under the graph represents DISPLACEMENT. So that means in FOUR SECONDS this object traveled 332 meters.

Example A particle moving in one dimension has a position function defined as: x(t) = 6t4-2t a) At what point in time does the particle change its direction along the x-axis? The body will change its direction when it reaches either its maximum or minimum x position. At that point it will reverse its direction. The velocity at the turn around point is ZERO. Thus the velocity function is:

Example b) In what direction is the body traveling when its acceleration is 12 m/s/s? If we can determine the time at which a = +12 m/s, we can put that time back into our velocity function to determine the velocity of the body at that point of motion. Knowing the velocity (sign and all) will tell us the direction of motion. The velocity vector is negative, the body must be moving in the negative direction when the acceleration is +12 m/s/s.

Similar presentations


text:
# Parsing Vertex Buffer to find Vertices Coordinates (x, y, z)

This topic is 2137 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I want to retrieve all vertices from an instanced and loaded IDirect3DIndexBuffer9 and IDirect3DVertexBuffer9 buffers.

How can I do this?

Thanks,

fs1

##### Share on other sites

No one took on this?

I want to see if I can loop through the IDirect3DIndexBuffer9, to find the Vertices information (x,y,z).

Can anyone help me?

Edited by fs1

##### Share on other sites

You need to know format of vertices it holds, then:

struct Vertex
{
D3DXVECTOR3 pos;
... // whatever else you have
};

D3DVERTEXBUFFER_DESC desc;
buffer->GetDesc(&desc);
DWORD numVerts = desc.Size / sizeof(Vertex); // or however you obtain number of verts

Vertex* pVert;
buffer->Lock(0, 0, (void**)&pVert, lockFlags);

for(DWORD i = 0; i < numVerts; ++i)
{
D3DXVECTOR currentPos = pVert[i].pos;
}

buffer->Unlock();

##### Share on other sites
Without knowing the vertex stream declaration you're pretty much out of luck. The vertex buffer is just a chunk of memory, nothing more. You need additional information (ie the vertex stream declaration or some a priori knowledge of the buffer layout) to reliably parse any information out of it.

If you know the vertex declaration, then parsing the positions should be trivially easy: they're at the offsets (vertexStride * n + posOffset) where posOffset is the offset indicated by the vertex element with D3DDECLUSAGE_POSITION and n is the vertex index. The format of the position can be gotten from the Type field of the vertex element.

##### Share on other sites

Locking and unlocking vertex/index buffers causes stalls and very poor performance.  We don’t parse vertex buffers/index buffers for any but the most serious issues.

If you need to know which vertices are at a given point, keep a CPU-side vertex array and optional index array and parse that/those.

L. Spiro

##### Share on other sites

You need to know format of vertices it holds, then:

struct Vertex
{
D3DXVECTOR3 pos;
... // whatever else you have
};

D3DVERTEXBUFFER_DESC desc;
buffer->GetDesc(&desc);
DWORD numVerts = desc.Size / sizeof(Vertex); // or however you obtain number of verts

Vertex* pVert;
buffer->Lock(0, 0, (void**)&pVert, lockFlags);

for(DWORD i = 0; i < numVerts; ++i)
{
D3DXVECTOR currentPos = pVert[i].pos;
}

buffer->Unlock();

Without knowing the vertex stream declaration you're pretty much out of luck. The vertex buffer is just a chunk of memory, nothing more. You need additional information (ie the vertex stream declaration or some a priori knowledge of the buffer layout) to reliably parse any information out of it.

If you know the vertex declaration, then parsing the positions should be trivially easy: they're at the offsets (vertexStride * n + posOffset) where posOffset is the offset indicated by the vertex element with D3DDECLUSAGE_POSITION and n is the vertex index. The format of the position can be gotten from the Type field of the vertex element.

Samith, belfegor thank you so much, I understand the logic, how about when you have an Index Buffer? The idea is quite the same?

Locking and unlocking vertex/index buffers causes stalls and very poor performance.

L. Spiro

Thanks, could you be more specific on this issue? Appreciate it.

Edited by fs1

##### Share on other sites

Samith, belfegor thank you so much, I understand the logic, how about when you have an Index Buffer? The idea is quite the same?

The index buffer only tells the primitive assembler on the GPU which vertices to use and in which order, essentially. It doesn't say anything about the internal layout of the vertex buffer. So unfortunately the index buffer can't help you find the position values inside of a vertex buffer.

##### Share on other sites

Thanks, could you be more specific on this issue? Appreciate it.

When you are creating the vertex buffer, keep a second copy of the vertex positions in your own CPU array (std::vector for example) and do the same with the index buffer.

L. Spiro

##### Share on other sites

Thanks, could you be more specific on this issue? Appreciate it.

When you are creating the vertex buffer, keep a second copy of the vertex positions in your own CPU array (std::vector for example) and do the same with the index buffer.

L. Spiro

Thanks, I appreciate it.

Just one last quick question, let's say you don't know the VERTEX format, but you know it's size (Stride). In the following code:

struct Vertex
{
D3DXVECTOR3 pos;
... // whatever else you have
};

D3DVERTEXBUFFER_DESC desc;
buffer->GetDesc(&desc);
DWORD numVerts = desc.Size / sizeof(Vertex); // or however you obtain number of verts

Vertex* pVert;
buffer->Lock(0, 0, (void**)&pVert, lockFlags);

for(DWORD i = 0; i < numVerts; ++i)
{
D3DXVECTOR currentPos = pVert[i].pos;
}

buffer->Unlock();

Can you always assume that the coordinates of each vertex are the 3 floats starting from pVert ? Let's say pVert.x, pVert.y, pVert.z ?

Thanks.

Edited by fs1

##### Share on other sites

Usually position semantic is the first thing in the vertex and it is usually a vector of 3 floats.
You can obtain more vertex information if you are grabbing this just after vertex declaration and vertex buffers are set to be "active" on the device. Something like this:

...
// let say here is set
device->SetVertexDeclaration(...);
device->SetStreamSource(...);
device->Draw...();
...
// later here you want to grab data
IDirect3DVertexDeclaration9* pDecl;
device->GetVertexDeclaration(&pVDecl);
D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH];
UINT numElements;
pVDecl->GetDeclaration( decl, &numElements);

for(UINT i = 0; i < numElements; ++i)
{
// decl type
auto currentType = decl[i].Type;

// decl usage
auto currentUsage = decl[i].Usage;
...

// let say we want to determine when it is a position semantic
if(D3DDECLUSAGE_POSITION == currentUsage)
}
...

From D3DVERTEXELEMENT9  of vertex decl. you can obtain all information you need.

What are you trying to do?

Edited by belfegor

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 11
• 15
• 21
• 26
• 11


text:
mcgrid is hosted by Hepforge, IPPP Durham

# MCgrid: Interpolation tools for NLO event generators

## Examples

You can download a tarball containing the following examples in the Downloads section. The examples tarballs are named MCgridYExamples-X.X.X, where Y is the major MCgrid version and X.X.X specifies the Rivet version they are compatible with. You can check what Rivet version you are using with rivet-config --version. Note that only for Rivet v.2.2.0 or more recent the examples include fastNLO setups. But they can easily be adapted for earlier versions.

MCgrid is independent of the Monte Carlo event generator, as long as the generator can generate output in the .hepmc format (see HepMC). We provide Sherpa configuration files for generating your own .hepmc files, but it is easy to adapt the examples to other generators.

Unpack the tarball using tar -xzf examples.tar.gz and change into the unpacked directory (cd examples). When MCgrid and its dependencies are installed, you can use the provided Makefile to compile and install the included analyses: make plugin && make install.

With make test you can compile a simple test program to convolute APPLgrids you have produced with the examples below. You can use ./applgrid-test path/to/grid.root to generate a histogram with scale variations. If you run into an exception here, make sure that APPLgrid has been configured to link against Hoppet. You can also try applgrid2yoda, which is a bit more convenient. For convoluting fastNLO tables, you can use their in-house fnlo-tk-yodaout binary.

For more detailed instructions on how to make and use the examples, have a look into the included README file.

### Basic

In the templates folder you will find MCGRID_BASIC.cc, which is an empty Rivet analysis demonstrating the minimal modifications required to enable MCgrid. You can use it as a cheat sheet when you modify an analysis yourself.

### CDF $Z$ rapidity

This example provides the modified Rivet analysis CDF_2009_S8383952. It projects out the $Z$ rapidity in Drell-Yan production with a Tevatron-like beam setup.

This analysis comes with a Sherpa Runcard that included the modified CDF_2009_S8383952 analysis. If you have Sherpa in your path, run it using

cd CDF_2009_S8383952
make plugin-...
make install
[make install-applgrid]
Sherpa -f Run.dat
Sherpa -f Run.dat

This will generate an APPLgrid/fastNLO table in ./mcgrid.

### ATLAS $Z$ $p_T$

This one is very similar to the CDF $Z$ rapidity example. It is based on the Rivet analysis ATLAS_2011_S9131140. Besides generating a grid for the $Z$ $p_T$ distribution, it makes another one for the total cross section.

### CMS Inclusive Jets

This example is a modification of a CMS inclusive jet analysis CMS_2011_S9086218. It is intended as a demonstration of the MCGrid::BinnedGrid class, which complements the BinnedHistogram of Rivet.


text:
This notebook contains an excerpt from the Whirlwind Tour of Python by Jake VanderPlas; the content is available on GitHub.

The text and code are released under the CC0 license; see also the companion project, the Python Data Science Handbook.

List Comprehensions

If you read enough Python code, you'll eventually come across the terse and efficient construction known as a list comprehension. This is one feature of Python I expect you will fall in love with if you've not used it before; it looks something like this:

In [1]:
[i for i in range(20) if i % 3 > 0]

Out[1]:
[1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19]

The result of this is a list of numbers which excludes multiples of 3. While this example may seem a bit confusing at first, as familiarity with Python grows, reading and writing list comprehensions will become second nature.

Basic List Comprehensions¶

List comprehensions are simply a way to compress a list-building for-loop into a single short, readable line. For example, here is a loop that constructs a list of the first 12 square integers:

In [2]:
L = []
for n in range(12):
L.append(n ** 2)
L

Out[2]:
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121]

The list comprehension equivalent of this is the following:

In [3]:
[n ** 2 for n in range(12)]

Out[3]:
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121]

As with many Python statements, you can almost read-off the meaning of this statement in plain English: "construct a list consisting of the square of n for each n up to 12".

This basic syntax, then, is [expr for var in iterable], where expr is any valid expression, var is a variable name, and iterable is any iterable Python object.

Multiple Iteration¶

Sometimes you want to build a list not just from one value, but from two. To do this, simply add another for expression in the comprehension:

In [4]:
[(i, j) for i in range(2) for j in range(3)]

Out[4]:
[(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)]

Notice that the second for expression acts as the interior index, varying the fastest in the resulting list. This type of construction can be extended to three, four, or more iterators within the comprehension, though at some point code readibility will suffer!

Conditionals on the Iterator¶

You can further control the iteration by adding a conditional to the end of the expression. In the first example of the section, we iterated over all numbers from 1 to 20, but left-out multiples of 3. Look at this again, and notice the construction:

In [5]:
[val for val in range(20) if val % 3 > 0]

Out[5]:
[1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19]

The expression (i % 3 > 0) evaluates to True unless val is divisible by 3. Again, the English language meaning can be immediately read off: "Construct a list of values for each value up to 20, but only if the value is not divisible by 3". Once you are comfortable with it, this is much easier to write – and to understand at a glance – than the equivalent loop syntax:

In [6]:
L = []
for val in range(20):
if val % 3:
L.append(val)
L

Out[6]:
[1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19]

Conditionals on the Value¶

If you've programmed in C, you might be familiar with the single-line conditional enabled by the ? operator:

int absval = (val < 0) ? -val : val

Python has something very similar to this, which is most often used within list comprehensions, lambda functions, and other places where a simple expression is desired:

In [7]:
val = -10
val if val >= 0 else -val

Out[7]:
10

We see that this simply duplicates the functionality of the built-in abs() function, but the construction lets you do some really interesting things within list comprehensions. This is getting pretty complicated now, but you could do something like this:

In [8]:
[val if val % 2 else -val
for val in range(20) if val % 3]

Out[8]:
[1, -2, -4, 5, 7, -8, -10, 11, 13, -14, -16, 17, 19]

Note the line break within the list comprehension before the for expression: this is valid in Python, and is often a nice way to break-up long list comprehensions for greater readibility. Look this over: what we're doing is constructing a list, leaving out multiples of 3, and negating all mutliples of 2.

Once you understand the dynamics of list comprehensions, it's straightforward to move on to other types of comprehensions. The syntax is largely the same; the only difference is the type of bracket you use.

For example, with curly braces you can create a set with a set comprehension:

In [11]:
{n**2 for n in range(12)}

Out[11]:
{0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121}

Recall that a set is a collection that contains no duplicates. The set comprehension respects this rule, and eliminates any duplicate entries:

In [12]:
{a % 3 for a in range(1000)}

Out[12]:
{0, 1, 2}

With a slight tweak, you can add a colon (:) to create a dict comprehension:

In [13]:
{n:n**2 for n in range(6)}

Out[13]:
{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

Finally, if you use parentheses rather than square brackets, you get what's called a generator expression:

In [15]:
(n**2 for n in range(12))

Out[15]:
<generator object <genexpr> at 0x1027a5a50>

A generator expression is essentially a list comprehension in which elements are generated as-needed rather than all at-once, and the simplicity here belies the power of this language feature: we'll explore this more next.


text:
Dealing with my.contrasts with replicates containing nested samples
1
0
Entering edit mode
James • 0
@James-24772
Last seen 7 months ago
United States

I am working with experimental designs from the edgeR User Guide. In this experimental design I have a single factor with 3 levels. Each level has 2 replicates and each replicate had 5 samples taken. see below.

    Treatments <- as.factor(c(rep("control", 10), rep("dose1", 10), rep("dose2", 10)))
Replicate <- c(rep("C1", 5), rep("C2", 5), rep("D1.1", 5), rep("D1.2", 5), rep("D2.1", 5), rep("D2.2", 5))
Sample <- 1:30
y <- as.data.frame(cbind(Treatments, Replicate, Sample))
design <- model.matrix ( ~0 + Replicate, data = y)

how would I setup my.contrast to compare (C1 & C2 with D1.1 & D1.2) and then compare C1 & C2 with D2.1 & D2.2)?

my.contrasts <- makeContrasts (
ControlVsDose1 = (ReplicateC1 + ReplicateC2) - (ReplicateD1.1 + ReplicateD1.2),
ControlVsDose2 = (ReplicateC1 + ReplicateC2) - (ReplicateD2.1 + ReplicateD2.2),
levels = design)

Is this my.contrasts doing what I think it's doing?

edgeR • 633 views
0
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia

The edgeR code seems self-explanatory but your experiment itself is unclear. What you do you mean when you say that each level has 2 replicates and each replicate had 5 samples? What is the difference between replicates and samples? Your analysis is currently treating replicates as treatments and samples as replicates.

A more detailed explanation of what you mean by "nested samples" is necessary before good advice can be given. If the samples are technical replicates, then the edgeR User's Guide advices you to collapse them into one for each biological replicate by summing the counts (using sumTechReps).

0
Entering edit mode

Thank you for your help Gordon. It's an fish experiment where we have to consider variance among tanks within a treatment (aka tank effect). There are 3 treatments (2 different tanks per treatment for a total of 6 tanks). Muscle tissue sampled from 5 randomly chosen fish per tank was sequenced. I cannot treat each fish as a treatment replicate, they are nested in tank samples. These are not technical replicates either.

I know other labs that haven't figured out how to run this experimental design in edgeR, so any advice would go a long way. Also, as a bonus question, how would I set this experiment up in edgeR if I had 2 or 3 Treatments?

1
Entering edit mode

See https://support.bioconductor.org/p/132926/ for a previous answer to the same question. My advice remains the same as it was then.

0
Entering edit mode

Thanks for the link Gordon. How would you recommend best measure Tank variance with your code before moving on to the two options (collapsing the counts in each tank or using each fish as replicate?)

1
Entering edit mode

Plot the samples with plotMDS.

0
Entering edit mode

Thank you again. So any Tank Effect becomes an judgement call. I have now plotted out the samples in a few dimension on the plotMDS with method = "common" and and need to know how much variance each component explains to see if it worth considering as a Tank Effect. i.e. if the component only accounts for 0.5% of the data then I wouldn't assume that it's a significant Tank Effect.

I have read your other posts and you are very clear that any output for variance per PCA or MDS isn't in the original design for plotMDS. Would you then recommend to make a new df from the normalized DGEList and use prcom() and summary() to find how much variance each component explains?

on a similar note is there a way to get plotMDS to do a nMDS?

0
Entering edit mode

So any Tank Effect becomes an judgement call.

Is that such a problem? Do you see a clear tank effect in the plot or not? We're not worrying about invisible effects or finessing micro effects. Just looking for something noticeable. There is no substitute for judgement in choosing analysis strategies.

I have now plotted out the samples in a few dimension on the plotMDS with method = "common"

Any reason why you don't want to use the default method that we recommend for this sort of data? There's no need to forensically examine lots of dimensions. If the tank effect doesn't show up in the first two dimensions then either it isn't important or you have much worse batch effects to be worrying about.

You just need to run plotMDS with default settings and look. It's as simple as that.

need to know how much variance each component explains

Why do you need an arbitrary numerical measure that has no direct relationship to the intended analysis and which has no objective cutoff anyway?

if the component only accounts for 0.5% of the data then I wouldn't assume that it's a significant Tank Effect.

That is unhelpful. Tank would account for more than 0.5% even if the data was just random.

Would you then recommend ...

I've given my advice but you seem resistant to taking it! The edgeR package implements what I recommend.

is there a way to get plotMDS to do a nMDS?

plotMDS does what it is documented to do. How could nMDS possibly help you?

Anyway, it appears that your data has no significant DE. All the analysis options are more conservative than the analysis you've already done. So these decisions are moot. If you're not confident about making decisions, then just average the fish and accept that there's no DE. Next time consider using more tanks. Experiments with n=2 replicates are pretty minimal.

0
Entering edit mode

I am sorry, I didn't intend to frustrate you. I do appreciate and respect your advice, hence I seek your answers. I will proceed as you suggest.

Yes, two tanks per treatment was sub par. We were limited by space and cost per tank. I have several other experiments with adequate replication that I am using your code on, so I feel the need to know the code & data well.


text:
# Tag Info

43

Energetic neutrinos have been observed from the core of a supernova (SN 1987A). The inferred temperature at the "neutrinosphere" is about 4 MeV (equivalent to 50 billion K - ($5\times 10^{10}$ K, Valentim et al. 2017). Hence it is observable and has been observed. The very centre of the proto-neutron star that is responsible for the neutrino emission is ...

22

Note that while we haven't observed anything even close, there is a theorized Absolute Hot along the lines of absolute zero. Its theorized value is ~ $1.416 \cdot 10^{32}$ Kelvin. Above this temperature, it would be impossible to pump more energy into a system, even gravitationally. That gives an upper bound on the maximum temperature we could measure.

15

Under General Relativity (GR) alone, a Black Hole's (BH's) event horizon is a point of no return -- anything that passes through the event horizon is lost and gone forever, and nothing comes out. Hence, under GR alone, BHs are utterly black and don't have a temperature at all. This is why the absorption of radiation (or anything else) by a BH doesn't raise ...

13

Before I start, I'll admit that I've criticized the question based on its improbability; however, I've been persuaded otherwise. I'm going to try to do the calculations based on completely different formulas than I think have been used; I hope you'll stay with me as I work it out. Let's imagine that Lucifer becomes a main-sequence star - in fact, let's call ...

10

This is a really hard question to answer as Carl Witthoft alludes to. The main problem is that there is no way you can finagle putting at atmosphere around the Sun and have it extend to the Earth. It would be wildly unstable and no matter what happens, the general result will be an explosion of energy that kills the Earth. And you can't really say you're ...

10

Well first thing's first: You would disintegrate. At the temperature of the Sun, most of the molecules that make up our bodies could not even survive, that is why we would not only fry and die, we would really disintegrate (all the molecules breaking apart, leaving only loose atoms). Let's now pretend heat doesn't exist. This is what would happen. First, ...

9

The real reasoning has nothing to do with some civilization "deliberately" hiding its radio emissions. Rather, the problem is that we can not expect some other civilization to do something we would not do ourselves. It makes no sense whatsoever to radiate large amounts of energy into space when there exist other, more economical alternatives. Radio ...

9

As far as I understand it, the heat death of the universe is a consequence of entropy, not expansion. All processes result in the shifting of some energy to higher entropy. Though the observable universe is an open system, the entire universe is an isolated system, so as more and more energy gets shifted to higher entropy over time the universe will ...

7

I think it's a fun question, if impossible. The only way to turn Jupiter into a star that's even remotely practical is to add to it's mass. Ignoring brown dwarfs that are very limited in energy output, to get a red dwarf going, you'd need to add at least 75-80 or so Jupiter masses. (a bit more than 24,000 earth masses). You'd want to add a fair ...

7

From a physics perspective From a physics perspective an object is a star when it is undergoing nuclear fusion, generally of hydrogen atoms at its core, this is regardless of its temperature! A star is not determined by its temperature, it is instead determined by it's internal processes. This does mean that if Jupiter began nuclear fusion it would be ...

6

Ignoring the impossibility of Jupiter going solar: Assume that Jupiter turns into duplicate of the Sun in terms of energy output. Energy transmitted to the earth follows an inverse-square law. Since Jupiter is, at best, 4 times farther from the Earth than the Sun, Jupiter will supply the Earth with, at most, 1/16 the energy that the Sun supplies, for an ...

6

Does the Earth receive any heat at all from the millions of other Stars in our Galaxy ? Effectively, no. Stars are too few and far between. Qualifying that "effectively, no": From http://stjarnhimlen.se/comp/radfaq.html#10, the stellar magnitude from total starlight is -5. Compare that to the -26.7 magnitude of the Sun as viewed from the Earth. That ...

6

Stars do not get hot because of nuclear fusion, they become hot enough to sustain nuclear fusion and this process maintains their temperatures. Nuclear fusion actually stops a star getting hotter. Protostars (before nuclear fusion) get hot because of a well known statistical relationship between the gravitational potential energy of a gas and the internal ...

5

I'm not sure what you mean by "heating effect". The amount another body is heated by a star with luminosity $L$ is quantified by its effective temperature: $$T_{eff}=\left(\frac{L(1-a)}{16\pi\sigma D^2}\right)^{1/4}$$ where $a$ is the albedo, $D$ is the distance to the other body, and $\sigma$ is the Stefan-Boltzmann constant. If the luminosity is given, ...

5

First, let's get a bit of background. "Absolute hot" is the concept that a maximum temperature exists. It describes your question exactly. For a long time, no one was able to figure out whether an absolute hot exists, but in the 20th century major revolutions in theoretical physics gave us answers. "Absolute hot" isn't the name of the hottest temperature, ...

5

Yes, the Earth does receive energy from the stars, but not much. The effective temperature of the night sky is about 3 Kelvin which is not much more that that of the cosmic microwave background at 2.7 Kelvin. The difference being due to the total energy of starts etc.(room temperature is ~295 kelvin) The coldness of the night sky is interesting in itself ...

5

In reality, Jupiter doesn't have nearly enough mass to initiate stellar ignition or sustain it if we could somehow start it going. Even the smallest star would require on the order of some 80 to 90 times the mass of Jupiter just to put out a faint red glow. Even to become a brown dwarf proto-star, Jupiter would require a mass increase on the order of at ...

5

Your argument (large temperature leads to greater mixing) is correct so long as there are no other large scale forces acting on the system. This isn't true in planet formation, because gravity plays a very important role. I'm not an expert on planet formation, but I think the argument goes something like this: As a planet forms from material from the ...

5

Star temperature is an interesting question since temperature varies a lot in a star. I think that the more relevant temperature to this question is the core temperature of the star: a star is born when it starts to burn hydrodgen in its core. Finally, hydrogen begins to fuse in the core of the star, and the rest of the enveloping material is cleared ...

4

The average surface temperature on Venus is 462 °C. You would need a temperature above 800 °C before you would notice any light. Added: Here are some calculated radiation outputs of the surface temperature of Venus, a 1000 °C black body and the sun.

4

It's due to Hawking radiation, a black body radiation due to quantum effects near the event horizon of black holes and named after Stephen Hawking that predicted this phenomena. From the same Wikipedia article: Hawking radiation reduces the mass and the energy of the black hole and is therefore also known as black hole evaporation. Because of this, ...

4

Sorta depends -- you can't have a uniform density atmosphere, so to reach something close to one standard atm. near Earth's orbit (which, BTW would wreak havoc with orbital stability in the first place due to drag), the density would have to be something horrible nearer to the Sun. This would be an excellent xkcd what-if question if phrased more along the ...

4

According to this paper, there are various but enough good estimations for the temperature gradient of the Martian soil. Note, direct measurements will we have first with the next Martian lander, the InSight: Image from here The for us important part of this estimation is this: Depth penetration of the annual temperature wave at $120^\circ E, > 20^\... 3 Roughly speaking, the moon's orbit has a semi-major axis of about 400,000 km. The semi-major axis of the Earth's orbit is 149.6 million km. The intensity of sunlight received by the Moon depends on the inverse of the square of the distance, so the difference amounts to$((1.496e8 + 4e5)/(1.496e8 - 4e5))^2\$ = 1.011, or about 1%. So, not very much. The ...

3

You got some very good answers already. I just want to point out this: The "temperature" of a black hole is more like just "a way of speaking". It's not temperature as normally understood. There is this process called the Hawking radiation where vacuum near a black hole produces a stream of particles, borrowing energy from the black hole's gravity to ...

3

Sun-Earth distance: 1AU Earth-Jupiter distance (at the conjunction): 4AU So Lucifer will be four times farther than Sun when it is nearer (six times when it is farthest), and at the same time it is a thousand times smaller. This is approx 40 times more light than full moon concentrated in a tiny point on sky.

3

You seriously cannot expect the sun to have a layer that would contain some of its harmful radiation. Sun consists of a plasma and is not solid. Learn more about its structure here. Magnetic field is a kind of layer you might think of apart from all gases and energy it radiates. But that is harmful and not protective for us. It is highly unlike earth which ...

3

If you're ruling out the big bang, then the most extreme releases of energy in our universe should be cases of runaway gravitational collapse. There is a rigorous theorem in general relativity (Penrose singularity theorem) showing that these will generically lead to the creation of singularities. For realistic gravitational collapse, it's expected that in ...

2

As other answers have said, the definition of a "star" is generally taken to be an object that is undergoing sufficient hydrogen fusion to reach an equilibrium between energy produced by fusion and the energy it is radiating. The exact definition varies, but does not affect this answer much. When "stars" are young, they are large, their cores are too cool ...

2

Can the release of gravitational energy during planet formation in principle (is there enough) explain this much heat Planets in general can have internal heat sources (like radioactive breakdown or a complex hot core). During planetary formation there are thought to be multiple collisions with large proto-planets before things settle down to a more-or-...

Only top voted, non community-wiki answers of a minimum length are eligible


text:
RUS  ENG JOURNALS   PEOPLE   ORGANISATIONS   CONFERENCES   SEMINARS   VIDEO LIBRARY   PACKAGE AMSBIB
 General information Latest issue Forthcoming papers Archive Impact factor Guidelines for authors License agreement Search papers Search references RSS Latest issue Current issues Archive issues What is RSS

 Trudy MIAN: Year: Volume: Issue: Page: Find

 2011, Volume 274

 | General information | Contents |

Algorithmic aspects of algebra and logic

Collected papers. Dedicated to Academician Sergei Ivanovich Adian on the occasion of his 80th birthday

Volume Editor: L. D. Beklemishev
Editor in Chief: E. F. Mishchenko

ISBN: 5-7846-0119-9 (978-5-7846-0119-3)

Abstract: On January 1, 2011, an outstanding mathematician Academician Sergei Ivanovich Adian turned eighty. The present volume contains papers dedicated to this anniversary and written by students and close colleagues of Adian both from Russia and abroad. The papers are related to various fields of mathematical logic, algebra, and set theory: group theory, proof theory, theory of algorithms, computational complexity, etc. The volume also includes Adian's postgraduate study on descriptive set theory that was carried out under the supervision of P. S. Novikov. This study was published as a joint paper in a hardly accessible journal “Uchenye Zapiski MGPI im. V. I. Lenina” and has not yet been translated into English. The papers by foreign scientists are published in the original (in English).
The volume will be useful for mathematicians interested in the topical problems of mathematical logic, algebra, and theory of algorithms.

Citation: Algorithmic aspects of algebra and logic, Collected papers. Dedicated to Academician Sergei Ivanovich Adian on the occasion of his 80th birthday, Tr. Mat. Inst. Steklova, 274, ed. L. D. Beklemishev, E. F. Mishchenko, MAIK Nauka/Interperiodica, Moscow, 2011, 351 pp.

Citation in format AMSBIB:
\Bibitem{1} \book Algorithmic aspects of algebra and logic \bookinfo Collected papers. Dedicated to Academician Sergei Ivanovich Adian on the occasion of his 80th birthday \serial Tr. Mat. Inst. Steklova \yr 2011 \vol 274 \publ MAIK Nauka/Interperiodica \publaddr Moscow \ed L.~D.~Beklemishev, E.~F.~Mishchenko \totalpages 351 \mathnet{http://mi.mathnet.ru/book1359}