text:
Object-Oriented Sorting Algorithms

I would like a review of a library I've recently published. I realize this is a rather large request, but having looked on meta, it seems this is perfectly on-topic. I'll include a few choice samples from the library to demonstrate my approach, as well as a link to the full codebase for anyone interested in giving a full-breadth review.

So to summarize, this library, called sort-viz, is, as the title and tags suggest, an object-oriented approach at designing an educational tool for teaching sorting algorithms, which is why the sorting algorithms use generator functions to introduce interruptions in the control-flow in order to be visualized step-by-step.

Here's a few of the classes needed to implement an iterative (bottom-up) merge sort algorithm:

/**
* Abstract sort array module.
* @module sort/abstract
*
* @requires module:sort/scope.ScopeArray
*/
import { ScopeArray } from './scope'

/**
* @memberOf module:sort/virtual
*
* @class Entry
*
* @hideconstructor
*
* @extends Array
*
* @property {number} 0 - Index.
* @property {*} 1 - Value.
*/

/**
* Invoked during each interruptable step of AbstractSortArray methods.
* @memberOf module:sort/virtual
*
* @callback interruptCallback
*
* @param {Object} step - An object containing information about a generic step interruption.
* @param {string} step.type - The type of step, e.g. "compare", "swap", "put", "key".
* @param {module:sort/virtual.Entry[]} step.entries - An array of index / value pairs of elements involved in the step.
*/

/**
* Base abstract class for arrays that implement sorting algorithms. Do not invoke directly.
* @abstract
*
* @extends module:sort/scope.ScopeArray
*
* @param {module:sort/virtual.interruptCallback} [interrupt=() => {}]
*
* @throws {TypeError} Illegal constructor.
* @throws {TypeError} interrupt must be a function.
*/
export class AbstractSortArray extends ScopeArray {
constructor (interrupt = () => {}) {
super()

if (this.constructor === AbstractSortArray) {
throw new TypeError('Illegal constructor')
}

if (typeof interrupt === 'function') {
this.set('interrupt', interrupt)
} else {
throw new TypeError('interrupt must be a function')
}
}

/**
* Invoked for each index to generate an element of the array.
* @memberOf module:sort/virtual
*
* @callback fillCallback
*
* @return {*} element - A generated value with which to populate the array.
*/

/**
* A method to interruptably populate the array with elements generated from factory.
* @param {module:sort/virtual.fillCallback} factory
* @param {number} [length=this.length]
*
* @throws {TypeError} factory must be a function.
*/
* fill (factory, length = this.length) {
if (typeof factory !== 'function') {
throw new TypeError('factory must be a function')
}

this.length = 0

for (let i = 0; i < length; i++) {
yield * this.put(i, factory())
}
}

/**
* A method to interruptably randomize the order of elements in the array.
* Uses the {@link https://en.wikipedia.org/wiki/Fisher–Yates_shuffle|Knuth Fisher Yates} method.
*/
* shuffle () {
for (let i = this.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1))
yield * this.swap(i, j)
}
}

/**
* A method to interruptably swap two elements in the array.
* @param {number} i - Index of first element to swap.
* @param {number} j - Index of second element to swap.
*/
* swap (i, j) {
;[this[i], this[j]] = [this[j], this[i]]
yield this.get('interrupt')({ type: 'swap', entries: [[i, this[i]], [j, this[j]]] })
}

/**
* A method to interruptably put an element in the array.
* @param {number} index - Index to put element value.
* @param {*} value - Value to put in index.
*/
* put (index, value) {
this[index] = value
yield this.get('interrupt')({ type: 'put', entries: [[index, value]] })
}

/**
* Abstract method to interruptably sort array of elements.
* @abstract
* @throws {TypeError} Illegal invocation.
*/
* sort () {
throw new TypeError('Illegal invocation')
}
}

/**
* Comparative sort array module.
* @module sort/comparative
*
* @requires module:sort/abstract.AbstractSortArray
*/
import { AbstractSortArray } from './abstract'

/**
* Invoked during each compare step of the ComparativeSortArray sort method.
* @memberOf module:sort/virtual
*
* @callback compareCallback
*
* @param {*} a - An element to compare on the left-hand side.
* @param {*} b - An element to compare on the right-hand side.
*
* @return {number} result - See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description|compareFunction}
*/

/**
* Base abstract class for arrays that implement comparative sorting algorithms.
* @abstract
*
* @extends module:sort/abstract.AbstractSortArray
*
* @param {module:sort/virtual.interruptCallback} [interrupt]
* @param {module:sort/virtual.compareCallback} [compare=(a, b) => 0]
*
* @throws {TypeError} compare must be a function of 2 arguments.
*/
export class ComparativeSortArray extends AbstractSortArray {
constructor (interrupt, compare = (a, b) => 0) {
super(interrupt)

if (typeof compare === 'function' && compare.length === 2) {
this.set('compare', compare)
} else {
throw new TypeError('compare must be a function of 2 arguments')
}
}

/**
* A method to interruptably compare two elements in the array.
* a and b are optional, since i and j can sometimes be
* used to represent indices that are virtual in the comparsion.
*
* @param {number} i - Index of left-hand element to compare.
* @param {number} j - Index of right-hand element to compare.
* @param {*} [a=this[i]] - Value of left-hand element to compare.
* @param {*} [b=this[j]] - Value of right-hand element to compare.
*
* @return {number} result - See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description|compareFunction}
*/
* compare (i, j, a = this[i], b = this[j]) {
yield this.get('interrupt')({ type: 'compare', entries: [[i, a], [j, b]] })
return this.get('compare')(a, b)
}
}

/**
* Merge sort array module.
* @module sort/comparative/merge
*
* @requires module:sort/comparative.ComparativeSortArray
*/
import { ComparativeSortArray } from '../comparative'

/**
* Base abstract merge sort array.
*
* @abstract
*
* @extends module:sort/comparative.ComparativeSortArray
*/
export class MergeSortArray extends ComparativeSortArray {
/**
* @param {number} begin
* @param {number} middle
* @param {number} end
*/
* merge (begin, middle, end) {
const first = this.slice(begin, middle)
const last = this.slice(middle, end)
let index = begin
let i = 0
let j = 0

while (index < end) {
if (j === last.length) {
yield * this.put(index, first[i++])
} else if (i === first.length) {
yield * this.put(index, last[j++])
} else if ((yield * this.compare(begin + i, middle + j, first[i], last[j])) <= 0) {
yield * this.put(index, first[i++])
} else {
yield * this.put(index, last[j++])
}

index++
}
}
}

/**
* Iterative merge sort array module.
* @module sort/comparative/merge/iterative
*
* @requires module:sort/comparative/merge.MergeSortArray
*/
import { MergeSortArray } from '../merge'

/**
* @see {@link https://en.wikipedia.org/wiki/Merge_sort#Bottom-up_implementation|Bottom-up Merge Sort}
*
* @extends module:sort/comparative/merge.MergeSortArray
*/
export class IterativeMergeSortArray extends MergeSortArray {
/** @override */
* sort () {
for (let increment = 1; increment < this.length; increment *= 2) {
for (let begin = 0; begin < this.length; begin += increment * 2) {
const middle = begin + increment
const end = Math.min(begin + increment * 2, this.length)

yield * this.merge(begin, middle, end)
}
}
}
}

And as promised, here is the link to the repository, which also contains formatted documentation on the respective github pages, and a full demo on Heroku.

Please be responsible and only make HTTP requests to the Heroku link sparingly, as I have it hosted on a hobbyist plan, which only allows so many hours of uptime a month. I have plans to implement a service worker for it in the future to mitigate this issue.

• I just have to say, this looks incredible. Amazing work! Aug 13 '17 at 0:34
• @Gerrit0 thank you, I really appreciate the compliment. I know that having a deep prototypal inheritance and using generator functions isn't exactly performant, but then again, that was never the point to begin with. I was working more towards clean, readable, and maintainable code that tried to avoid "looking asynchronous" as much as possible. Aug 13 '17 at 0:39
• I would take another approach to this, the main class you need to have is a list, and this is already defined in javascript as an array. I would instead define methods to sort the array it instead of defining every operation as a class. Ideally a class should abstract some kind of data and the operations over these data in the form of methods. Aug 18 '17 at 7:32
• @DavidLemon if you actually look at the repository, the base class of all these algorithms is in fact Array. So, I don't really understand how that isn't already done here. And the operations aren't represented by classes, it's just the hierarchy of inheritance is based on what algorithms use what operations. Of course everything can use swap and put, so that goes in the abstract class. compare is only used by comparative algorithms, so that goes in the next class. merge is used by merge sorts, and then finally the polymorphic sort function overriden for each implementation. Aug 18 '17 at 7:52

Note- the review below only pertains to the code in the post. "Code that's not included can not be reviewed."1

Overall I would say this code is well-written. Variables are declared with const and let appropriately. It has good documentation - especially for each method- although example usage is tough to find. One possible change you could consider is using async functions.

I haven't used generators much but do believe they can be quite useful. I am intrigued by the application in certain functions - e.g. the shuffle method. Does it make sense to use an iterator to handle things like shuffling?

The shuffle method is already somewhat optimized by looping from the end of the array to the front:

for (let i = this.length - 1; i > 0; i--) {

The same can be achieved by moving the decrement operator to the while condition, and starting i at this.length:

for (let i = this.length; i--; ) {

I noticed sometimes j can be equal to i - especially as i approaches zero. Does it still make sense to call the swap method when those are equal?

The constructor for AbstractSortArray throws an error if the base constructor is called, and then if interrupt is not a function throws an error.

constructor (interrupt = () => {}) {
super()

if (this.constructor === AbstractSortArray) {
throw new TypeError('Illegal constructor')
}

if (typeof interrupt === 'function') {
this.set('interrupt', interrupt)
} else {
throw new TypeError('interrupt must be a function')
}

The else keyword can be avoided by checking if the typeof interrupt isn't a function first:

if (typeof interrupt !== 'function') {
throw new TypeError('interrupt must be a function')
}
this.set('interrupt', interrupt)

• Just to clarify, the reason that generators are used for the sort and shuffle methods is because each put() and swap() call suspends the generator function and waits for the DOM to repaint based on the changes made to the array. That's also why swap() is called in shuffle() even if the indices are equal, to allow the DOM to indicate that an item was swapped with itself. I also appreciate the feedback regarding the AbstractSortArray constructor, I realize now that the absense of abrupt returns should be outside of conditional statements in the constructor, but did not at the time. Jul 19 '20 at 8:43


text:
It is currently Wed Apr 26, 2017 4:14 am

 2 posts • Page 1 of 1
Author Message
iNow
 Post subject: History of Federal Subsidies in US Energy Sector  |  Posted: Tue Sep 27, 2011 3:20 am

Original Member

Joined: Thu Aug 04, 2011 11:40 pm
Posts: 5493
Location: Austin, Texas

 I came across this very interesting report today. I am curious if it will help to rebut the position of those who argue against solar and wind because they need subsidization to get off the ground. In this case, I wouldn't really mind history repeating itself, and providing this same level of support for renewables. How about you?What Would Jefferson Do?The Historical Role of Federal Subsidies in Shaping America’s Energy Futurehttp://www.dblinvestors.com/documents/D ... _paper.pdfhttp://www.istockanalyst.com/business/n ... -s-historyQuote:Among the report's key findings:Energy industries have enjoyed a century of federal support. From 1918-2009, the oil and gas industry received $446.96 billion (adjusted for inflation) in cumulative energy subsidies. Renewable energy sources received$5.93 billion (adjusted for inflation) for a much shorter period from 1994-2009.Average annual support for the oil and gas industry has been $4.86 billion (1918-2009), compared to$3.50 billion for nuclear (1947-1999) and \$0.37 billion (1994-2009) for renewable energy.There is a striking divergence in early federal incentives. For example, federal support for the nuclear industry overwhelms other subsidies as a percentage of federal budget, but equally striking is the support for oil and gas which was at least 25% higher than renewables, and in the most extreme years 10x as great."The take away from this history lesson is that government support has been and should continue to be an essential component in the growth of emerging energy sources, enabling U.S. technology innovation, job creation and economic expansion." said Pfund. _________________iNow"[Time] is one of those concepts that is profoundly resistant to a simple definition." ~C. Sagan
csiguy55
 Post subject: Re: History of Federal Subsidies in US Energy Sector  |  Posted: Wed May 16, 2012 4:08 pm

Joined: Tue May 15, 2012 4:45 pm
Posts: 4

 I think this is a very interesting article and for those that were ever against it, will def have a new outlook on this!
 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 2 posts • Page 1 of 1

Who is online
 Users browsing this forum: No registered users and 1 guest You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forum

format: plain


text:
Jump to content
• Advertisement

# OpenGL Sub-surface scattering hack ( comments wanted! )

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

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I was fiddling around in FX Composer last night and came up with a pretty nice-looking fake sub-surface scattering effect, as follows: http://img131.imageshack.us/img131/1489/sss1je8.jpg http://img131.imageshack.us/img131/2131/sss2tt2.jpg http://img131.imageshack.us/img131/3440/sss3gu5.jpg http://img141.imageshack.us/img141/3603/sss4nu5.jpg I'll post my full algorithm/code when I get back from work later today. In a nutshell, I have a simple half-lambert base diffuse term, nothing special. The sub-surface scattering effect is divided up into three parts: 1) A dot product between the inverse surface normal and the light, clamped from 0 to 1, and finally distance attenuated; 2) Another half-lambert term between the inverse normal and view, also distance attenuated; 3) Scaling of subsurface color by red, green and blue extinction coefficients. The final shot demonstrates the effects of tweaking these to produce a blue scatter color. In addition, I have the 1 - N dot V squared rim lighting term put forth in the Dawn demo by nVidia (but this time scaled by the clamped dot product between light and normal, to avoid that weird backlighting) and a basic Blinn-Phong specular added on top. Since those pictures were taken I've done some basic work on extending my algorithm to account for colored lighting and non-uniform material thickness, although it doesn't look quite as nice as it does in those earlier screens. So, my questions are: 1) Anyone know of a good way to make this handle the non-uniform thickness more gracefully (I'll post some pictures later for review) 2) Any additonal suggestions for improving this to look more skin-like as a whole? Feedback of any sort is appreciated, though. I originally wrote this to replace some shaders in Oblivion and possibly even Doom 3, and as such lack the ability to use depth buffers, spherical harmonics or any of that stuff, unless any and all information can be passed in through textures and shader constants ONLY. This is also targeted at SM3.0, although it works just fine in SM2.0 and the OpenGL equivalents (this has been ported to ARB assembly without incident)

#### Share this post

##### Share on other sites
Advertisement
Alright, that took decidedly longer than expected to post-- that's what you get for being busy, I guess :(

Anyways, here's a shot with the translucency map and a few tweaks:
http://img143.imageshack.us/img143/2391/sssab9.jpg

I obviously fixed the eyebrow and hair thing, but it looks less... soft. Any suggestions? Should I even bother posting the code?

#### Share this post

##### Share on other sites
For being so simple, these screenies look quite impressive. I'd certainly love to see that fx/fxproj to play with it :)

I only miss a little rougness (pores) and some more oilyness (specular) to be convinced that this is skin. But again, for being a quite simple approximation, this already looks awesome.

To address the thickness problem, maybe xNormal can help? That tool supports among many other things producing a thickness map. Having thickness from every point of view as shader input, the wrong lighting visible on the ear in the last shot should disappear.
One could also overlay two thickness maps, to account for bones (this would need another model for the skull to be created, but I guess that wouldn't be too hard to derive from the original mesh - it doesn't have to be perfect). This would make the head in the last shot look less like an obsidian statue and more like a flesh and bone thing (well, if red was used for scattering).

#### Share this post

##### Share on other sites
Code isn't a problem, here's all the relevant shader stuff
string description = "Subsurface Scattering Hack";//------------------------------------float4x4 worldViewProj : WorldViewProjection;float4x4 world   : World;float4x4 worldInverseTranspose : WorldInverseTranspose;float4x4 viewInverse : ViewInverse;float4 LightPosition1 : POSITION<	string Object = "PointLight";	string UIName =  "Light 1";	string Space = "World";> 	= {1403.0f, 1441.0f, 1690.0f, 0.0f};float3 specColor<	string UIWidget = "color";	string UIName = "Specular Color";> = {0.9f, 0.9f, 1.0f};float3 lightColor<	string UIWidget = "color";	string UIName = "Light Color";> = {1.0f, 1.0f, 1.0f};float materialThickness<	string UIWidget = "Slider";	float UIMin = 0.0f;	float UIMax = 1.0f;	float UIStep = 0.01f;	string UIName = "Material Thickness Factor";> 	= 0.6f;float rimScalar<	string UIWidget = "Slider";	float UIMin = 0.0f;	float UIMax = 1.0f;	float UIStep = 0.01f;	string UIName = "Rim Light Strength";> 	= 1.0f;float extinctionCoefficientRed<	string UIWidget = "Slider";	float UIMin = 0.0f;	float UIMax = 1.0f;	float UIStep = 0.01f;	string UIName = "Extinction Coefficient, Red";> 	= 0.80f;float extinctionCoefficientBlue<	string UIWidget = "Slider";	float UIMin = 0.0f;	float UIMax = 1.0f;	float UIStep = 0.01f;	string UIName = "Extinction Coefficient, Blue";> 	= 0.12f;float extinctionCoefficientGreen<	string UIWidget = "Slider";	float UIMin = 0.0f;	float UIMax = 1.0f;	float UIStep = 0.01f;	string UIName = "Extinction Coefficient, Green";> 	= 0.20f;float specularPower<	string UIWidget = "Slider";	float UIMin = 0.0f;	float UIMax = 100.0f;	float UIStep = 0.50f;	string UIName = "Blinn Specular Power";> = 1.0f;texture diffuseTex;texture thicknessTex;texture normalTex;sampler normalSampler = sampler_state{	texture		= <normalTex>;	MinFilter	=	point;	MagFilter	=	point;	MipFilter	=	point;	AddressU	=	CLAMP;	AddressV	=	CLAMP;};sampler2D diffuseSampler = sampler_state{	Texture		=	<diffuseTex>;	MinFilter	=	Linear;	MagFilter	=	Linear;	MipFilter	=	Linear;	AddressU	=	WRAP;	AddressV	=	WRAP;};sampler2D thicknessSampler = sampler_state{	Texture		=	<diffuseTex>;	MinFilter	=	Linear;	MagFilter	=	Linear;	MipFilter	=	Linear;	AddressU	=	WRAP;	AddressV	=	WRAP;};struct VSOut{	float4 position			:	POSITION;	float2 texCoord			:	TEXCOORD0;	float3 worldNormal		:	TEXCOORD1;	float3 eyeVec     		:	TEXCOORD2;	float3 lightVec			:	TEXCOORD3;	float3 worldTangent		: 	TEXCOORD4;	float3 worldBinormal		: 	TEXCOORD5;	float3 vertPos			:	TEXCOORD6;};struct AppData {   	float4 position	:	POSITION;	float2 UV	:	TEXCOORD0;	float3 normal	:	NORMAL;	float3 tangent	: 	TANGENT;	float3 binormal	: 	BINORMAL;};VSOut SkinVS(AppData IN, uniform float4 lightPosition){	VSOut OUT;	OUT.worldNormal = normalize(mul(IN.normal, worldInverseTranspose).xyz);	OUT.worldTangent = normalize(mul(IN.tangent, worldInverseTranspose).xyz);	OUT.worldBinormal = normalize(mul(IN.binormal, worldInverseTranspose).xyz);	 	float3 worldSpacePos = mul(IN.position, world);	OUT.lightVec = lightPosition - worldSpacePos;	OUT.texCoord = IN.UV;	OUT.eyeVec = viewInverse[3].xyz - worldSpacePos;	OUT.position = mul(IN.position, worldViewProj);	OUT.vertPos = worldSpacePos;	return OUT;};float halfLambert(float3 vec1, float3 vec2){	float product = dot(vec1, vec2);	product *= 0.5;	product += 0.5;	return product;}float blinnPhongSpecular(float3 normalVec, float3 lightVec, float specPower){	float3 halfAngle = normalize(normalVec + lightVec);	return pow(saturate(dot(normalVec, halfAngle)), specPower);}float4 SkinPS(VSOut IN) : COLOR0{	float attenuation = (1.0f/distance(LightPosition1, IN.vertPos));	attenuation *= 10.0f;	float3 eyeVec 	= normalize(IN.eyeVec);	float3 lightVec = normalize(IN.lightVec.xyz);	float3 worldNormal = normalize(IN.worldNormal);	//float3 nMap = tex2D(normalSampler, IN.texCoord);	//worldNormal.x = dot(nMap.x, IN.worldTangent);	//worldNormal.y = dot(nMap.y, IN.worldBinormal);	//worldNormal.z = dot(nMap.z, IN.worldNormal);	float4 dotLN	= halfLambert(lightVec, worldNormal) * attenuation;	float3 indirectLightComponent = (float3)(materialThickness * max(0, dot(-worldNormal, lightVec)));	indirectLightComponent += materialThickness * halfLambert(-eyeVec, lightVec);	indirectLightComponent *= attenuation;	indirectLightComponent.r *= extinctionCoefficientRed;	indirectLightComponent.g *= extinctionCoefficientGreen;	indirectLightComponent.b *= extinctionCoefficientBlue;	indirectLightComponent.rgb *= tex2D(thicknessSampler, IN.texCoord).r;	float3 rim = (float3)(1.0f - max(0.0f, dot(worldNormal, eyeVec)));	rim *= rim;	dotLN *= tex2D(diffuseSampler, IN.texCoord);	float4 finalCol = dotLN + float4(indirectLightComponent, 1.0f);	rim *= max(0.0f, dot(worldNormal, lightVec)) * specColor;	finalCol.rgb += (rim * rimScalar * attenuation * finalCol.a);	finalCol.rgb += (blinnPhongSpecular(worldNormal, lightVec, specularPower) * attenuation * specColor * finalCol.a * 0.05f);	finalCol.rgb *= lightColor;	return float4(finalCol);};technique subSurfaceScattering{    pass p0     {				VertexShader		= compile vs_2_0 SkinVS(LightPosition1);		PixelShader			= compile ps_2_0 SkinPS();		ZEnable 			= true;		ZWriteEnable 		= true;		AlphaBlendEnable	= false;		SrcBlend 			= SrcAlpha;		DestBlend 			= InvSrcAlpha;		CullMode 			= CW; //None, CW, or CCW    }}

That's regular HLSL, could be converted to Cg, GLSL or whatever other shading language you prefer. I just use the Dawn lambert skin fxproj and apply that skin shader to the face. I made the thickness map myself, as you can see it's pretty hack-y, so I'll leave you be on that. Diffuse map comes with FX Composer.

Thanks for the tips! :) I'm working on a normal map thing as we speak, although the ones supplied with the Dawn demo just look kind of funny when I apply them-- perhaps they're in the wrong space or something.

#### Share this post

##### Share on other sites
Thanks for the shader code, InvalidPointer. Unluckily, it'll take some work this weekend to get it to work, since FX Composer doesn't like something, it crashes right away :(

I've been thinking about thickness and all for a while, there seems to be no easy way to get it perfect everywhere. Even a thickness map won't do, because no matter how you turn it, the ears will always be shaded wrong. There's of course the option to calculate per-pixel thicknes like in nVidia's "Luna" demo, but then we're not talking about a fast and efficient implementation any more (render several passes, blur, etc...). Also, the algorithm again is only an approximation. Mostly it doesn't matter much, but for example looking at the oral cavity from the side, it will produce a false "thick" result, when in fact it's mostly "empty" air with two thin layers of cheeks.

So, I was wondering if shadow mapping the skull wouldn't be helpful, and still cheap enough (a single z-only render of a possibly much simplified model).
The idea is to scale the head model down a bit, and remove/flatten ears and nose and render that into the shadow map. It probably doesn't even have to be perfectly anatomically accurate.
So that will leave you with an "outer part" where there is skin and flesh (and rim light scattering), and an "inner part" where bones absorb all of the back light (regardless of thickness), so only scattering from incidential light and half-lambert lighting account to the colour.

Thickness should not be something to worry about much then. Around the border, anything N dot V isn't a terribly bad approximation, since the normals will point more "sidewards" the thinner the cross-section.
Now, in the "deeper" regions it does not work so well, but we have these masked out with the shadow map. Also, the disturbing artefacts when the ear is rim-lit although it obviously couldn't be (as the head is in the way) are gone.

#### Share this post

##### Share on other sites
Quote:
 Original post by samothThanks for the shader code, InvalidPointer. Unluckily, it'll take some work this weekend to get it to work, since FX Composer doesn't like something, it crashes right away :(I've been thinking about thickness and all for a while, there seems to be no easy way to get it perfect everywhere. Even a thickness map won't do, because no matter how you turn it, the ears will always be shaded wrong. There's of course the option to calculate per-pixel thicknes like in nVidia's "Luna" demo, but then we're not talking about a fast and efficient implementation any more (render several passes, blur, etc...). Also, the algorithm again is only an approximation. Mostly it doesn't matter much, but for example looking at the oral cavity from the side, it will produce a false "thick" result, when in fact it's mostly "empty" air with two thin layers of cheeks.So, I was wondering if shadow mapping the skull wouldn't be helpful, and still cheap enough (a single z-only render of a possibly much simplified model).The idea is to scale the head model down a bit, and remove/flatten ears and nose and render that into the shadow map. It probably doesn't even have to be perfectly anatomically accurate.So that will leave you with an "outer part" where there is skin and flesh (and rim light scattering), and an "inner part" where bones absorb all of the back light (regardless of thickness), so only scattering from incidential light and half-lambert lighting account to the colour.Thickness should not be something to worry about much then. Around the border, anything N dot V isn't a terribly bad approximation, since the normals will point more "sidewards" the thinner the cross-section.Now, in the "deeper" regions it does not work so well, but we have these masked out with the shadow map. Also, the disturbing artefacts when the ear is rim-lit although it obviously couldn't be (as the head is in the way) are gone.

Could the thickness map not be tweaked? I can use XNormal with some settings fiddles to make a decent thickness thing and then just work in Photoshop to make a nice-looking approximation for some of the effects you describe.

#### Share this post

##### Share on other sites

• Advertisement

### Announcements

• Advertisement

• ### Similar Content

• By nOoNEE
i am reading this book : link
in the OpenGL Rendering Pipeline section there is a picture like this: link
but the question is this i dont really understand why it is necessary to turn pixel data in to fragment and then fragment into pixel could please give me a source or a clear Explanation that why it is necessary ? thank you so mu

• By Inbar_xz
I'm using the OPENGL with eclipse+JOGL.
My goal is to create movement of the camera and the player.
I create main class, which create some box in 3D and hold
an object of PlayerAxis.
I create PlayerAxis class which hold the axis of the player.
If we want to move the camera, then in the main class I call to
the func "cameraMove"(from PlayerAxis) and it update the player axis.
That's work good.
The problem start if I move the camera on 2 axis,
for example if I move with the camera right(that's on the y axis)
and then down(on the x axis) -
in some point the move front is not to the front anymore..
In order to move to the front, I do
player.playerMoving(0, 0, 1);
And I learn that in order to keep the front move,
I need to convert (0, 0, 1) to the player axis, and then add this.
I think I dont do the convert right..
I will be glad for help!

Here is part of my PlayerAxis class:

//player coordinate float x[] = new float[3]; float y[] = new float[3]; float z[] = new float[3]; public PlayerAxis(float move_step, float angle_move) { x[0] = 1; y[1] = 1; z[2] = -1; step = move_step; angle = angle_move; setTransMatrix(); } public void cameraMoving(float angle_step, String axis) { float[] new_x = x; float[] new_y = y; float[] new_z = z; float alfa = angle_step * angle; switch(axis) { case "x": new_z = addVectors(multScalar(z, COS(alfa)), multScalar(y, SIN(alfa))); new_y = subVectors(multScalar(y, COS(alfa)), multScalar(z, SIN(alfa))); break; case "y": new_x = addVectors(multScalar(x, COS(alfa)), multScalar(z, SIN(alfa))); new_z = subVectors(multScalar(z, COS(alfa)), multScalar(x, SIN(alfa))); break; case "z": new_x = addVectors(multScalar(x, COS(alfa)), multScalar(y, SIN(alfa))); new_y = subVectors(multScalar(y, COS(alfa)), multScalar(x, SIN(alfa))); } x = new_x; y = new_y; z = new_z; normalization(); } public void playerMoving(float x_move, float y_move, float z_move) { float[] move = new float[3]; move[0] = x_move; move[1] = y_move; move[2] = z_move; setTransMatrix(); float[] trans_move = transVector(move); position[0] = position[0] + step*trans_move[0]; position[1] = position[1] + step*trans_move[1]; position[2] = position[2] + step*trans_move[2]; } public void setTransMatrix() { for (int i = 0; i < 3; i++) { coordiTrans[0][i] = x[i]; coordiTrans[1][i] = y[i]; coordiTrans[2][i] = z[i]; } } public float[] transVector(float[] v) { return multiplyMatrixInVector(coordiTrans, v); }
and in the main class i have this:

public void keyPressed(KeyEvent e) { if (e.getKeyCode()== KeyEvent.VK_ESCAPE) { System.exit(0); //player move } else if (e.getKeyCode()== KeyEvent.VK_W) { //front //moveAmount[2] += -0.1f; player.playerMoving(0, 0, 1); } else if (e.getKeyCode()== KeyEvent.VK_S) { //back //moveAmount[2] += 0.1f; player.playerMoving(0, 0, -1); } else if (e.getKeyCode()== KeyEvent.VK_A) { //left //moveAmount[0] += -0.1f; player.playerMoving(-1, 0, 0); } else if (e.getKeyCode()== KeyEvent.VK_D) { //right //moveAmount[0] += 0.1f; player.playerMoving(1, 0, 0); } else if (e.getKeyCode()== KeyEvent.VK_E) { //moveAmount[0] += 0.1f; player.playerMoving(0, 1, 0); } else if (e.getKeyCode()== KeyEvent.VK_Q) { //moveAmount[0] += 0.1f; player.playerMoving(0, -1, 0); //camera move } else if (e.getKeyCode()== KeyEvent.VK_I) { //up player.cameraMoving(1, "x"); } else if (e.getKeyCode()== KeyEvent.VK_K) { //down player.cameraMoving(-1, "x"); } else if (e.getKeyCode()== KeyEvent.VK_L) { //right player.cameraMoving(-1, "y"); } else if (e.getKeyCode()== KeyEvent.VK_J) { //left player.cameraMoving(1, "y"); } else if (e.getKeyCode()== KeyEvent.VK_O) { //right round player.cameraMoving(-1, "z"); } else if (e.getKeyCode()== KeyEvent.VK_U) { //left round player.cameraMoving(1, "z"); } }
finallt found it.... i confused with the transformation matrix row and col. thanks anyway!
• By Lewa
So, i'm currently trying to implement an SSAO shader from THIS tutorial and i'm running into a few issues here.
Now, this SSAO method requires view space positions and normals. I'm storing the normals in my deferred renderer in world-space so i had to do a conversion and reconstruct the position from the depth buffer.
And something there goes horribly wrong (which has probably to do with worldspace to viewspace transformations).
(here is the full shader source code if someone wants to take a look at it)
Now, i suspect that the normals are the culprit.
vec3 normal = ((uNormalViewMatrix*vec4(normalize(texture2D(sNormals, vTexcoord).rgb),1.0)).xyz); "sNormals" is a 2D texture which stores the normals in world space in a RGB FP16 buffer.
Now i can't use the camera viewspace matrix to transform the normals into viewspace as the cameras position isn't set at (0,0,0), thus skewing the result.
So what i did is to create a new viewmatrix specifically for this normal without the position at vec3(0,0,0);
//"camera" is the camera which was used for rendering the normal buffer renderer.setUniform4m(ressources->shaderSSAO->getUniform("uNormalViewMatrix"), glmExt::createViewMatrix(glm::vec3(0,0,0),camera.getForward(),camera.getUp())//parameters are (position,forwardVector,upVector) ); Though i have the feeling this is the wrong approach. Is this right or is there a better/correct way of transforming a world space normal into viewspace?

• Hi,
I'm trying mix two textures using own shader system, but I have a problem (I think) with uniforms.
Code: https://github.com/HawkDeath/shader/tree/test
To debug I use RenderDocs, but I did not receive good results. In the first attachment is my result, in the second attachment is what should be.
PS. I base on this tutorial https://learnopengl.com/Getting-started/Textures.

• I'm having issues loading textures, as I'm clueless on how to handle / load images maybe I missing something, but the past few days I just google a lot to try to find a solution. Well theres two issues I think, one I'm using Kotlin Native (EAP) and OpenGL wrapper / STB image, so I'm not quite sure wheres the issue, if someone with more experience could give me some hints on how to solve this issue?
The code is here, if I'm not mistaken the workflow is pretty straight forward, stbi_load returns the pixels of the image (as char array or byte array) and you need to pass those pixels directly to glTexImage2D, so a I'm missing something here it seems.
Regards

• I've noticed in most post processing tutorials several shaders are used one after another: one for bloom, another for contrast, and so on. For example:
postprocessing.quad.bind() // Effect 1 effect1.shader.bind(); postprocessing.texture.bind(); postprocessing.quad.draw(); postprocessing.texture.unbind(); effect1.shader.unbind(); // Effect 2 effect2.shader.bind(); // ...and so on postprocessing.quad.unbind() Is this good practice, how many shaders can I bind and unbind before I hit performance issues? I'm afraid I don't know what the good practices are in open/webGL regarding binding and unbinding resources.
I'm guessing binding many shaders at post processing is okay since the scene has already been updated and I'm just working on a quad and texture at that moment. Or is it more optimal to put shader code in chunks and bind less frequently? I'd love to use several shaders at post though.
Another example of what I'm doing at the moment:
1) Loop through GameObjects, bind its phong shader (send color, shadow, spec, normal samplers), unbind all.
2) At post: bind post processor quad, and loop/bind through different shader effects, and so on ...
Thanks all!

• void collision(int v) { collision_bug_one(0.0f, 10.0f); glutPostRedisplay(); glutTimerFunc(1000, collision, 0); } void coll_sprite() { if (board[0][0] == 1) { collision(0); flag[0][0] = 1; } } void erase_sprite() { if (flag[0][0] == 1) { glColor3f(0.0f, 0.0f, 0.0f); glBegin(GL_POLYGON); glVertex3f(0.0f, 10.0f, 0.0f); glVertex3f(0.0f, 9.0f, 0.0f); glVertex3f(1.0f, 9.0f, 0.0f); glVertex3f(1.0f, 10.0f, 0.0f); glEnd(); } } I am using glutTimerFunc to wait a small amount of time to display a collision sprite before I black out the sprite. unfortunately my code only blacks out the said sprite without drawing the collision sprite, I have done a great deal of research on the glutTimerFunc and  animation.
• By Lewa
So, i stumbled upon the topic of gamma correction.
https://learnopengl.com/Advanced-Lighting/Gamma-Correction
So from what i've been able to gather: (Please correct me if i'm wrong)
Old CRT monitors couldn't display color linearly, that's why gamma correction was nessecary. Modern LCD/LED monitors don't have this issue anymore but apply gamma correction anyway. (For compatibility reasons? Can this be disabled?) All games have to apply gamma correction? (unsure about that) All textures stored in file formats (.png for example) are essentially stored in SRGB color space (as what we see on the monitor is skewed due to gamma correction. So the pixel information is the same, the percieved colors are just wrong.) This makes textures loaded into the GL_RGB format non linear, thus all lighting calculations are wrong You have to always use the GL_SRGB format to gamma correct/linearise textures which are in SRGB format
Now, i'm kinda confused how to proceed with applying gamma correction in OpenGL.
First of, how can i check if my Monitor is applying gamma correction? I noticed in my monitor settings that my color format is set to "RGB" (can't modify it though.) I'm connected to my PC via a HDMI cable. I'm also using the full RGB range (0-255, not the 16 to ~240 range)

What i tried to do is to apply a gamma correction shader shown in the tutorial above which looks essentially like this: (it's a postprocess shader which is applied at the end of the renderpipeline)
vec3 gammaCorrection(vec3 color){ // gamma correction color = pow(color, vec3(1.0/2.2)); return color; } void main() { vec3 color; vec3 tex = texture2D(texture_diffuse, vTexcoord).rgb; color = gammaCorrection(tex); outputF = vec4(color,1.0f); } The results look like this:
No gamma correction:
With gamma correction:

The colors in the gamma corrected image look really wased out. (To the point that it's damn ugly. As if someone overlayed a white half transparent texture. I want the colors to pop.)
Do i have to change the textures from GL_RGB to GL_SRGB in order to gamma correct them in addition to applying the post process gamma correction shader? Do i have to do the same thing with all FBOs? Or is this washed out look the intended behaviour?

• Hi

I am trying to program shadow volumes and i stumbled upon an artifact which i can not find the cause for.
I generate the shadow volumes using a geometry shader with reversed extrusion (projecting the lightfacing triangles to infinity) and write the stencil buffer according to z-fail. The base of my code is the "lighting" chapter from learnopengl.com, where i extended the shader class to include geometry shader. I also modified the "lightingshader" to draw the ambient pass when "pass" is set to true and the diffuse/ specular pass when set to false. For easier testing i added a view controls to switch on/off the shadow volumes' color rendering or to change the cubes' position, i made the lightnumber controllable and changed the diffuse pass to render green for easier visualization of my problem.

The first picture shows the rendered scene for one point light, all cubes and the front cube's shadow volume is the only one created (intentional). Here, all is rendered as it should be with all lit areas green and all areas inside the shadow volume black (with the volume's sides blended over).

If i now turn on the shadow volumes for all the other cubes, we get a bit of a mess, but its also obvious that some areas that were in shadow before are now erroneously lit (for example the first cube to the right from the originaly shadow volumed cube). From my testing the areas erroneously lit are the ones where more than one shadow volume marks the area as shadowed.

To check if a wrong stencil buffer value caused this problem i decided to change the stencil function for the diffuse pass to only render if the stencil is equal to 2. As i repeated this approach with different values for the stencil function i found out that if i set the value equal to 1 or any other uneven value the lit and shadowed areas are inverted and if i set it to 0 or any other even value i get the results shown above.
This lead me to believe that the value and thus the stencil buffer values may be clamped to [0,1] which would also explain the artifact, because twice in shadow would equal in no shadow at all, but from what i found on the internet and from what i tested with
GLint stencilSize = 0; glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &stencilSize); my stencilsize is 8 bit, which should be values within [0,255].
Does anyone know what might be the cause for this artifact or the confusing results with other stencil functions?

// [the following code includes all used gl* functions, other parts are due to readability partialy excluded] // glfw: initialize and configure // ------------------------------ glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // glfw window creation // -------------------- GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); if (window == NULL) { cout << "Failed to create GLFW window" << endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetCursorPosCallback(window, mouse_callback); glfwSetScrollCallback(window, scroll_callback); // tell GLFW to capture our mouse glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); // glad: load all OpenGL function pointers // --------------------------------------- if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { cout << "Failed to initialize GLAD" << endl; return -1; } // ==================================================================================================== // window and functions are set up // ==================================================================================================== // configure global opengl state // ----------------------------- glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); // build and compile our shader program [...] // set up vertex data (and buffer(s)) and configure vertex attributes [...] // shader configuration [...] // render loop // =========== while (!glfwWindowShouldClose(window)) { // input processing and fps calculation[...] // render // ------ glClearColor(0.1f, 0.1f, 0.1f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDepthMask(GL_TRUE); //enable depth writing glDepthFunc(GL_LEQUAL); //avoid z-fighting //draw ambient component into color and depth buffer view = camera.GetViewMatrix(); projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f); // setting up lighting shader for ambient pass [...] // render the cubes glBindVertexArray(cubeVAO); for (unsigned int i = 0; i < 10; i++) { //position cube [...] glDrawArrays(GL_TRIANGLES, 0, 36); } //------------------------------------------------------------------------------------------------------------------------ glDepthMask(GL_FALSE); //disable depth writing glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); //additive blending glEnable(GL_STENCIL_TEST); //setting up shadowShader and lightingShader [...] for (int light = 0; light < lightsused; light++) { glDepthFunc(GL_LESS); glClear(GL_STENCIL_BUFFER_BIT); //configure stencil ops for front- and backface to write according to z-fail glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_DECR_WRAP, GL_KEEP); //-1 for front-facing glStencilOpSeparate(GL_BACK, GL_KEEP, GL_INCR_WRAP, GL_KEEP); //+1 for back-facing glStencilFunc(GL_ALWAYS, 0, GL_TRUE); //stencil test always passes if(hidevolumes) glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); //disable writing to the color buffer glDisable(GL_CULL_FACE); glEnable(GL_DEPTH_CLAMP); //necessary to render SVs into infinity //draw SV------------------- shadowShader.use(); shadowShader.setInt("lightnr", light); int nr; if (onecaster) nr = 1; else nr = 10; for (int i = 0; i < nr; i++) { //position cube[...] glDrawArrays(GL_TRIANGLES, 0, 36); } //-------------------------- glDisable(GL_DEPTH_CLAMP); glEnable(GL_CULL_FACE); glStencilFunc(GL_EQUAL, 0, GL_TRUE); //stencil test passes for ==0 so only for non shadowed areas glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); //keep stencil values for illumination glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); //enable writing to the color buffer glDepthFunc(GL_LEQUAL); //avoid z-fighting //draw diffuse and specular pass lightingShader.use(); lightingShader.setInt("lightnr", light); // render the cubes for (unsigned int i = 0; i < 10; i++) { //position cube[...] glDrawArrays(GL_TRIANGLES, 0, 36); } } glDisable(GL_BLEND); glDepthMask(GL_TRUE); //enable depth writing glDisable(GL_STENCIL_TEST); //------------------------------------------------------------------------------------------------------------------------ // also draw the lamp object(s) [...] // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.) // ------------------------------------------------------------------------------- glfwSwapBuffers(window); glfwP } // optional: de-allocate all resources once they've outlived their purpose: // ------------------------------------------------------------------------ glDeleteVertexArrays(1, &cubeVAO); glDeleteVertexArrays(1, &lightVAO); glDeleteBuffers(1, &VBO); // glfw: terminate, clearing all previously allocated GLFW resources. // ------------------------------------------------------------------ glfwTerminate(); return 0;

• Hi,
i am self teaching me graphics and oo programming and came upon this:
My Window class creates an input handler instance, the glfw user pointer is redirected to that object and methods there do the input handling for keyboard and mouse. That works. Now as part of the input handling i have an orbiting camera that is controlled by mouse movement. GLFW_CURSOR_DISABLED is set as proposed in the glfw manual. The manual says that in this case the cursor is automagically reset to the window's center. But if i don't reset it manually with glfwSetCursorPos( center ) mouse values seem to add up until the scene is locked up.
Here are some code snippets, mostly standard from tutorials:
// EventHandler m_eventHandler = new EventHandler( this, glm::vec3( 0.0f, 5.0f, 0.0f ), glm::vec3( 0.0f, 1.0f, 0.0f ) ); glfwSetWindowUserPointer( m_window, m_eventHandler ); m_eventHandler->setCallbacks(); Creation of the input handler during window creation. For now, the camera is part of the input handler, hence the two vectors (position, up-vector).  In future i'll take that functionally out into an own class that inherits from the event handler.
void EventHandler::setCallbacks() { glfwSetCursorPosCallback( m_window->getWindow(), cursorPosCallback ); glfwSetKeyCallback( m_window->getWindow(), keyCallback ); glfwSetScrollCallback( m_window->getWindow(), scrollCallback ); glfwSetMouseButtonCallback( m_window->getWindow(), mouseButtonCallback ); } Set callbacks in the input handler.
// static void EventHandler::cursorPosCallback( GLFWwindow *w, double x, double y ) { EventHandler *c = reinterpret_cast<EventHandler *>( glfwGetWindowUserPointer( w ) ); c->onMouseMove( (float)x, (float)y ); } Example for the cursor pos callback redirection to a class method.
// virtual void EventHandler::onMouseMove( float x, float y ) { if( x != 0 || y != 0 ) { // @todo cursor should be set automatically, according to doc if( m_window->isCursorDisabled() ) glfwSetCursorPos( m_window->getWindow(), m_center.x, m_center.y ); // switch up/down because its more intuitive m_yaw += m_mouseSensitivity * ( m_center.x - x ); m_pitch += m_mouseSensitivity * ( m_center.y - y ); // to avoid locking if( m_pitch > 89.0f ) m_pitch = 89.0f; if( m_pitch < -89.0f ) m_pitch = -89.0f; // Update Front, Right and Up Vectors updateCameraVectors(); } } // onMouseMove() Mouse movement processor method. The interesting part is the manual reset of the mouse position that made the thing work ...
// straight line distance between the camera and look at point, here (0,0,0) float distance = glm::length( m_target - m_position ); // Calculate the camera position using the distance and angles float camX = distance * -std::sin( glm::radians( m_yaw ) ) * std::cos( glm::radians( m_pitch) ); float camY = distance * -std::sin( glm::radians( m_pitch) ); float camZ = -distance * std::cos( glm::radians( m_yaw ) ) * std::cos( glm::radians( m_pitch) ); // Set the camera position and perspective vectors m_position = glm::vec3( camX, camY, camZ ); m_front = glm::vec3( 0.0, 0.0, 0.0 ) - m_position; m_up = m_worldUp; m_right = glm::normalize( glm::cross( m_front, m_worldUp ) ); glm::lookAt( m_position, m_front, m_up ); Orbiting camera vectors calculation in updateCameraVectors().
Now, for my understanding, as the glfw manual explicitly states that if cursor is disabled then it is reset to the center, but my code only works if it is reset manually, i fear i am doing something wrong. It is not world moving (only if there is a world to render :-)), but somehow i am curious what i am missing.

I am not a professional programmer, just a hobbyist, so it may well be that i got something principally wrong :-)
And thanks for any hints and so ...

• Advertisement

• 35
• 12
• 10
• 9
• 9
• ### Forum Statistics

• Total Topics
631358
• Total Posts
2999530
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!


text:
# VariationalD with respect to two-variable function of integral over one variable

I have a function $q(x,t)=u(x,t)+iv(x,t),$ some functions $p_n$ and I want to find the following functional derivative:

$$\frac{\delta}{\delta\overline{q}}\int p_ndt$$

Because Mathematica's VariationalMethods package uses syntax which makes it ask for something like

VariationalD[f,u[x],x]
VariationalD[f,u[x,y,…],{x,y,…}]

I want to know how to get it to evaluate the above variational derivative, where the integral is only over $t,$ but $\overline{q}$ is a function of $x$ and $t.$ I have tried the following:

treq[t_] := u[x, t]
timq[t_] := v[x, t]
F[n_] := VariationalD[p[n, x, t], treq[t] - I*timq[t], t]

but Mathematica simply spits out the trivial result for e.g. $n=3$:

F[3] = VariationalD[p[3], u[x, t] - I v[x, t], t]

However, Mathematica knows exactly what the functions $p_n$ are, and I know how to evaluate the first few $F_n$ by myself, which are not very complicated. Does anyone know what I'm doing wrong, and how to get Mathematica to be able to give me the proper expression for the above functional derivative?

Thanks

• In such cases one needs to represent the function p as the one depending upon q and q*: p=f(q,q*), the variables q and q* being regarded as independent. If this can be done, the calculation of the variational derivative becomes straightforward. – Alexei Boulbitch Aug 16 '17 at 6:52
• So do you mean to say that I should add to this code a section which simplifies $p_n$ explicitly in terms of $q$ and its conjugate? Currently it is defined recursively and Mathematica may possibly not bother to recognise that, say, $p_1=q.$ – user41208 Aug 16 '17 at 7:03
• That's how I would start in this situation, if I would want to evaluate the integral written in your question. On the other hand, if I would be interested, say, in extremum of this functional, I would express p as a function of u, v and their derivatives, and make a variation with respect to both of them. – Alexei Boulbitch Aug 16 '17 at 13:23
• So, since the $p_n$ are defined by recursion, do you know of a simple way to get Mathematica to write each new $p_n$ in terms of $q$ at each step? For instance if I make the substitution $p_1\to q$ Mathematica will still work in terms of $p_2$ when calculating $p_3,$ and so on. – user41208 Aug 22 '17 at 5:16
• You did not post your recursion procedure, and, therefore, I have no idea of how the expression looks like. In this situation, I can only offer some general advice. – Alexei Boulbitch Aug 22 '17 at 7:04


text:
# Bootstrap confidence intervals for partitioned variances in R

I'm trying to determine the variance partitioning within plant drought tolerance data among hierarchical ecological levels, from species to forest sites to biome levels. I did that with the varcomp random effects model in R:

varcomp(lme(TLP_DRY~1, random=~1|Biomes/SiteNum/Species, data=d, na.action =na.omit),1)

Now, I want to bootstrap 95% confidence intervals for variance at each level, but I get incredibly weird results! Almost all of my species variance percentages become 100%, while within-species and biome variation becomes 10E-32, which looks nothing like the results for the actual dataset.

My questions: What is happening in the bootstrap and What does it mean about my ability to calculate confidence intervals?

My code in R for generating the bootstrap is:

matrix(NA, nrow=1000, ncol = 4)-> emptylist # define a place to put the simulated values

for(ii in 1:1000){
Data[sample(nrow(Data),100, replace = TRUE),] -> d # take a random sample the same size as the dataset with replacement

varcomp(lme(TLP_DRY~1, random=~1|Biomes/SiteNum/Species, data=d, na.action =na.omit),1) -> mod  # calculate variance partitioning

mod[1]-> emptylist[ii,1] # stick the values together in one place
mod[2]-> emptylist[ii,2]
mod[3]-> emptylist[ii,3]
mod[4]-> emptylist[ii,4]
}
quantile(emptylist[,1], c(.025, .975))  # determine the 95% confidence intervals
quantile(emptylist[,2], c(.025, .975))
quantile(emptylist[,3], c(.025, .975))
quantile(emptylist[,4], c(.025, .975))


text:
Error in a math expression

I have a problem with this expression:

$$n \geq \Bigg\lvert \bigcup_{l \leq |A_{i}| \leq 2l} |A_{i}| \Bigg\rvert \geq \sum_{i = 1}^{N_{l}}\Bigg\lvert A_{i} \Biggl \bigcup_{j =1}^{i-1} A_{j}\Biggr \Bigg\rvert$$

The report is:

* Local config file bblopts.cfg used * ("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\bblopts.cfg") ("C:\Program Files\MiKTeX 2.9\tex\generic\babel\italian.ldf" ("C:\Program Files\MiKTeX 2.9\tex\generic\babel\babel.def"))) (C:\Users\Stefano1\Desktop\Seminario\Seminario.aux) ("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\umsa.fd") ("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd") ("C:\Program Files\MiKTeX 2.9\tex\latex\base\omscmr.fd") [1{C:/ProgramData/MiKT eX/2.9/pdftex/config/pdftex.map}] [2] [3] [4] [5] [6] [7] [8] [9] ! Missing delimiter (. inserted). \bigcup@ l.296 ...}^{N_{l}}\Bigg\lvert A_{i} \Biggl \bigcup {j =1}^{i-1} A{j}\Biggr ...

?

I don't understand where is the error.

-
Don't use . This is outdated. Use one \$ for inline or  for display. –  LaRiFaRi Apr 3 '14 at 9:11

Both after one \Biggl and one \Biggr a delimiter, such as \lvert or \rvert or any other (parenthessis, brace, dot), is missing. There's just a blank and another command following.

Compilable example code:

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
$n \geq \Bigg\lvert \bigcup_{l \leq |A_{i}| \leq 2l} |A_{i}| \Bigg\rvert \geq \sum_{i = 1}^{N_{l}}\Bigg\lvert A_{i} \Biggl\lvert \bigcup_{j =1}^{i-1} A_{j}\Biggr\rvert \Bigg\rvert$
\end{document}

-
As you just write, it would be great to have all \Bigg changed to \Biggl \Biggr and so on. –  Manuel Apr 3 '14 at 10:08
I think the expression would look even better if you replaced all \Bigg directives with \bigg: Just as it's not desirable in general, to surround a summation sign with upper and lower limits with parentheses that fully enclose the entire expression, the vertical bars generated by \Bigg seem oppresively tall; switching to \bigg[lr] will give less visual prominence to the fences, without creating any uncertainty as to what's being enclosed. –  Mico Apr 3 '14 at 11:12


text:
# Triangular numbers (Euler 11)

What’s a triangular number? It is the sequence found by summing all the natural numbers, for example the third number is $1+2+3=6$. Interestingly, it counts objects arranged as a triangle.

This also has closed form $T_n=\sum_{i=1}^{n}i=\frac{n(n+1)}{2}$.

I started with a brute force approach – iterate through the triangular numbers and test if the number of divisors is greater than 500. I’m using the “numbers” package’s Sigma function to implement divisor function $\sigma x(n)=\sum{d n}d^x$ where $\sigma _0(n)$ gives the total number of factors for a given number. That requires a loop, which is going to dominate for large $n$, so $O(n^2)$.

library(numbers)

triangular.number <- function(number) {
number = (number * (number + 1)) / 2
}

num.factors <- 0
i <- 1

while (num.factors < 500) {
num.factors <- (Sigma1, k = 0))
print(triangular.number(i)) i <- i + 1
}

Not terribly efficient but it gets the correct answer. So how can we improve the algorithm? Reducing the number of times we repeat the loop would be a good place to start.

Now, $a(n)$ and $b(n+1)$ are co-prime – the only positive integer that divides them both is 1. This has a useful property, that $lcm(a,b)=ab$. Thing is, I can’t see how to incorporate it…

1. triangular.number(i[]


text:
Solved

# Problems with DTS package execution using COM

Posted on 2006-07-18
933 Views
Hello Experts,

I have a DTS package on my SQL server.  The package reads a text file and imports it into an SQL database.  During the import one of the fields is assigned a value from my GlobalVariable (ActiveX script in DTS)  The package runs fine from Enterprise Manager, but when I try run it from ASP.NET  I get the following error:

Step Error Source: Microsoft Data Transformation Services (DTS) Data Pump
Step Error Description:The number of failing rows exceeds the maximum specified. (Microsoft Data Transformation Services (DTS) Data Pump (80020101): Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Invalid procedure call or argument: 'DTSDestination'

Error on Line 18
) (mscorlib (80004005): Missing parameter does not have a default value.
Parameter name: parameters)
Step Error code: 8004206A
Step Error Help File:sqldts80.hlp
Step Error Help Context ID:0

My code in ASP.NET is very simple, here it is.

Dim dtsPack As New DTS.Package
dtsPack.LoadFromSQLServer("int-vip-02", "warranty", "warranty", DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, Nothing, Nothing, Nothing, "warranty_DCX_Claims_Import", Nothing)

Dim fileClaims As DTS.Connection
Dim fileVerbatims As DTS.Connection
fileClaims = dtsPack.Connections.Item("Claims_File")
fileVerbatims = dtsPack.Connections.Item("Verbatims_File")
fileClaims.DataSource = "\\int-vip-02\warranty$\DCX\DCX_INTERIORS_Claims.txt" fileVerbatims.DataSource = "\\int-vip-02\warranty$\DCX\DCX_INTERIORS_Verbatims.txt"

Dim varDivision As DTS.GlobalVariable
Dim varFRCode As DTS.GlobalVariable
varDivision = dtsPack.GlobalVariables.Item("Division")
varFRCode = dtsPack.GlobalVariables.Item("DCX_FR_Code")
varDivision.Value = "INTERIORS"
varFRCode.Value = "X"

dtsPack.Execute()

As you can tell, the DTS package reads the file names in no problem, when I comment out the GlobalVariable code everything works, but the GlobalVariables don't want to go further then the error message that I get.  The message shows up in the SQL log.

Thanks for any help to this.

0
Question by:tomasz_k
• 2

LVL 30

Expert Comment

ID: 17136606
Well my first suggestion would be to do it differently - use a stored procedure, but that may not be an option for you.

Are there any other bits of ActiveX code that use the DTSDestination function or is that the only one?

are the IIS and SQL Server on the same box? If not does it run OK from the IIS box? Possibly it doesn't have a required library installed.

It certainly is  strange error and my other suggestion would be to make sure all SP's are up to date.

0

Author Comment

ID: 17137739
The ActiveX function has about 6 destination columns, and they all are using DTSDestination.  5 of the columns get data from the import file, and they work fine, ony when I try to assign a GlobalVariable dynamically to my other DTSDestination the error occurs.  If I assign a GlobalVariable within ActiveX the DTS runs without any issues.  I'm thinking it's the way I call or assign the GlobalVariable in ASP.NET, but I'm not able to figure out what's wrong with it.
0

Author Comment

ID: 17138210
I have just solved my own problem.  Instead of trying to change the current GlobalVariables in DTS.  I deleted them, and assigned new variables in ASP.NET like so:

So far it's working no problem, but thanks anyway.
0

LVL 1

Accepted Solution

GhostMod earned 0 total points
ID: 17168285
Closed, 500 points refunded.

GhostMod
Community Support Moderator
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

#### 778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.


text:
# Suppose SUNY Oswego needs to purchase a new Central AC for the Rich Hall. There are...

###### Question:

Suppose SUNY Oswego needs to purchase a new Central AC for the Rich Hall. There are two choices, the first system costs $50,000 and is expected to last 10 years, and the second system costs$72,000 and is expected to last 15 years. Assume that the opportunity cost of capital is 10 percent. Which air-conditioning system should SUNY Oswego purchase?

#### Similar Solved Questions

##### 7. The entire graph f'(x) ofthe derivative of fis given below: Where is f increasing? points) Where does f have a local maximum? Justify your answer: points)
7. The entire graph f'(x) ofthe derivative of fis given below: Where is f increasing? points) Where does f have a local maximum? Justify your answer: points)...
##### Draw the angle using a ray through the origin, and determine whether the sine, cosine, and tangent of that angle are positive, negative, zero, or undefined. $\frac{3 \pi}{2}$
Draw the angle using a ray through the origin, and determine whether the sine, cosine, and tangent of that angle are positive, negative, zero, or undefined. $\frac{3 \pi}{2}$...
##### Calculate the pH of a solution that has hydronium ion concentration; [H,0 ']. of 1.48 x 10 M:pH =
Calculate the pH of a solution that has hydronium ion concentration; [H,0 ']. of 1.48 x 10 M: pH =...
##### Find the limit.limvx+Y (xy)-(50,50)X-Y100There is no limit
Find the limit. lim vx+Y (xy)-(50,50) X-Y100 There is no limit...
##### Determine the percent yield of a reaction that produces 28 65 g of Fe when 50.0...
Determine the percent yield of a reaction that produces 28 65 g of Fe when 50.0 00 g of Fez0s react with excess Al according to the following reaction Fe2O3(s)+2 Al(s) Al2O3(s)+2 Fe(s) W-SUMMERZC xCourse Home urse html?courseld-14733194&OpenVellumHMAC 01b27od2b2d7819a51616320b79deb92 10001 CHI...
##### Find the indicated roots of the given equations to at least four decimal places by using Newton's method. Compare with the value of the root found using a calculator. $x=\frac{1}{\sqrt{x+2}} \quad$ (the real solution)
Find the indicated roots of the given equations to at least four decimal places by using Newton's method. Compare with the value of the root found using a calculator. $x=\frac{1}{\sqrt{x+2}} \quad$ (the real solution)...
##### SearcFor two given planes Ta; 2*-37+4=3 42: 41-63+8 =13Da 827Show Ty/TzE0Find dislanca (J1,Jz)20LConv
Searc For two given planes Ta; 2*-37+4=3 42: 41-63+8 =13 Da 82 7 Show Ty/Tz E0 Find dislanca (J1,Jz) 2 0 L Conv...
##### Chargee of uniform density 81 nC/m Is distributed along the >-ars from xz-3 to x = +30 m What is the magmilebeke' 0U Uhe clectric feld ( in units of N/C) at the point > 450mon the {-MsSelect one: 04. 273.38 B. 364.50Oc 91.12 O0. 136.69
Chargee of uniform density 81 nC/m Is distributed along the >-ars from xz-3 to x = +30 m What is the magmilebeke' 0U Uhe clectric feld ( in units of N/C) at the point > 450mon the {-Ms Select one: 04. 273.38 B. 364.50 Oc 91.12 O0. 136.69...
##### Pei oiYour responseThe mass of Saturn is 5.69 x 1026 kg and the acceleration of gravity is 9.81 m/s? Find the period of its moon Mimas, whose mean orbital raclius is 1,88 x 10" m; Answer in uits ofPrevious responses3.8e8 (3/15/21 10*58 Pm) 8,33e6 (3/15/21 11*00 PM)Pert 2 0t 2Fiwl the [enu othital reclius of its HOO Tital; whos" pericd] is L.38 * 10" Ausuer in Ulits ofM.Your responseProvlous rosponsos1,94020 (3/15/21 10.59 Pm) 1.2207 (3/15/2111*00 Pm)
pei oi Your response The mass of Saturn is 5.69 x 1026 kg and the acceleration of gravity is 9.81 m/s? Find the period of its moon Mimas, whose mean orbital raclius is 1,88 x 10" m; Answer in uits of Previous responses 3.8e8 (3/15/21 10*58 Pm) 8,33e6 (3/15/21 11*00 PM) Pert 2 0t 2 Fiwl the [enu...
##### What are the post. Ref. 2. Continuing Problem Chapter 3 - Instruction 1 The unadjusted trial...
what are the post. Ref. 2. Continuing Problem Chapter 3 - Instruction 1 The unadjusted trial balance for PS Music as of July 31, 2019 is as follows: PS Music Unadjusted Trial Balance July 31, 2019 Account No. Debit Balances Credit Balances Cash ,945 119 12 Accounts Receivable 2,750 Supplie...
##### What is 595 divided by 23?
What is 595 divided by 23?...
##### {please} help rotational bodies question
Two metal disks, one with radius = 2.47cm and mass = 0.850kg and the other with radius = 5.00cm and mass = 1.58kg , are welded together and mounted on a frictionlessaxis through their common center. .A)What is the total moment of inertia of the two disks?B)A light string is wrapped around the edge o...
##### Saved points QUESTION 2 Which of the following defines gross profit? a. The amount remaining from...
Saved points QUESTION 2 Which of the following defines gross profit? a. The amount remaining from the sales value after deducting interest expense. b. The amount remaining from the sales value after deducting overhead costs c. The amount remaining from the sales value after deducting the cost of goo...
##### Waler pollution study. sample of lakes is selected from the 320 lakes in sludy region by the following procedure: reclangle of length and width w was drawn around the study region On. map. Pairs of random numbers between 0 and were generated from the uniform distribution using rndom number generalor on computer: The lirst random number o pair waS multiplied by and the second by W t0 give location coordinates within the study region. If the location Was in lake; that Iake Was selected; This proce
waler pollution study. sample of lakes is selected from the 320 lakes in sludy region by the following procedure: reclangle of length and width w was drawn around the study region On. map. Pairs of random numbers between 0 and were generated from the uniform distribution using rndom number generalor...
##### A firm operates two plants with the marginal cost curves given by MC1 = 50 +...
A firm operates two plants with the marginal cost curves given by MC1 = 50 + Q1 , MC2 = 40 + 2Q2 . If the firm’s total output must be 110 units, how much will it produce at each plant?...
##### What policies might the government pursue to increase economic mobility across a generation
what policies might the government pursue to increase economic mobility across a generation?Since this is not my area of expertise, I searched Google under the key words "'economic mobility' 'government policy'" to get these possible sources: http://delong.typepad.com/sdj/200...
##### Let U = (3,5,7,9,W,x,%,z} Find : the complement of set A A= (3,W,z}None of these answers0 (5,7,xY} 0 (3,5,7,9,W,x;Y,z} {9 *Y}(5,7,9 x,v}
Let U = (3,5,7,9,W,x,%,z} Find : the complement of set A A= (3,W,z} None of these answers 0 (5,7,xY} 0 (3,5,7,9,W,x;Y,z} {9 *Y} (5,7,9 x,v}...
##### Sin 103. sin >csc sin y esc"> +csc
sin 103. sin > csc sin y esc"> + csc...
##### What is the area enclosed by r=-sin(3theta-(7pi)/4)  between theta in [pi/8,(pi)/4]?
What is the area enclosed by r=-sin(3theta-(7pi)/4)  between theta in [pi/8,(pi)/4]#?...


text:
# Is this problem NP-hard? select k sets from a collection of sets such that each selected set has an empty intersection with the non selected ones

select k sets from a collection of sets such that each selected set has an empty intersection with the non selected ones

Your problem can be solved in polynomial time. Form an undirected graph where each set is a vertex, and there is an edge between two sets if they have a non-empty intersection. Decompose it into connected components, and let the sizes of the connected components be $n_1,\dots,n_t$. Then there exists a solution to your problem if and only if there is a subset of the integers $n_1,\dots,n_t$ that sums to $k$. This is the unary subset-sum problem, and it has a polynomial-time algorithm (via dynamic programming). Consequently, your problem can be solved in polynomial time, too.


text:
# 9.1 Homework (modified r. bloom)  (Page 5/5)

 Page 5 / 5

The alternate hypothesis is

• ## A

$p<0\text{.}\text{30}$
• ## B

$p\le 0\text{.}\text{30}$
• ## C

$p\ge 0\text{.}\text{30}$
• ## D

$p>0\text{.}\text{30}$

D

After conducting the test, your decision and conclusion are

• ## A

Reject ${H}_{o}$ : More than 30% of teen girls smoke to stay thin.
• ## B

Do not reject ${H}_{o}$ : Less than 30% of teen girls smoke to stay thin.
• ## C

Do not reject ${H}_{o}$ : At most 30% of teen girls smoke to stay thin.
• ## D

Reject ${H}_{o}$ : Less than 30% of teen girls smoke to stay thin.

C

The next three questions refer to the following information: A statistics instructor believes that fewer than 20% of Evergreen Valley College (EVC) students attended the opening night midnight showing of the latest Harry Potter movie. For a random sample of 84 EVC students, 11 of the students in the sample attended the midnight showing.

An appropriate alternative hypothesis is

• ## A

$p=0\text{.}\text{20}$
• ## B

$p>0\text{.}\text{20}$
• ## C

$p<0\text{.}\text{20}$
• ## D

$p\le 0\text{.}\text{20}$

C

At a 1% level of significance, an appropriate conclusion is:

• ## A

The percent of EVC students who attended the midnight showing of Harry Potter is at least 20%.
• ## B

The percent of EVC students who attended the midnight showing of Harry Potter is more than 20%.
• ## C

The percent of EVC students who attended the midnight showing of Harry Potter is less than 20%.
• ## D

There is not enough information to make a decision.

A

The Type I error is believing that the percent of EVC students who attended is:

• ## A

at least 20%, when in fact, it is less than 20%.
• ## B

20%, when in fact, it is 20%.
• ## C

less than 20%, when in fact, it is at least 20%.
• ## D

less than 20%, when in fact, it is less than 20%.

C

The next two questions refer to the following information:

It is believed that Lake Tahoe Community College (LTCC) Intermediate Algebra students get less than 7 hours of sleep per night, on average. A survey of 22 LTCC Intermediate Algebra students generated an average of 7.24 hours with a standard deviation of 1.93 hours. At a level of significance of 5%, do LTCC Intermediate Algebra students get less than 7 hours of sleep per night, on average?

The distribution to be used for this test is $\overline{X}$ ~

• ## A

$N\left(7\text{.}\text{24},\frac{1\text{.}\text{93}}{\sqrt{\text{22}}}\right)$
• ## B

$N\left(7\text{.}\text{24},1\text{.}\text{93}\right)$
• ## C

${t}_{\text{22}}$
• ## D

${t}_{\text{21}}$

D

The Type II error is “I believe that the average number of hours of sleep LTCC students get per night

• ## A

is less than 7 hours when, in fact, it is at least 7 hours.”
• ## B

is less than 7 hours when, in fact, it is less than 7 hours.”
• ## C

is at least 7 hours when, in fact, it is at least 7 hours.”
• ## D

is at least 7 hours when, in fact, it is less than 7 hours.”

D

The next three questions refer to the following information: An organization in 1995 reported that teenagers spent an average of 4.5 hours per week on the telephone. The organization thinks that, in 2007, the average is higher. Fifteen (15) randomly chosen teenagers were asked how many hours per week they spend on the telephone. The sample mean was 4.75 hours with a sample standard deviation of 2.0.

The null and alternate hypotheses are:

• ## A

${H}_{o}:\overline{x}=4\text{.}5$ , ${H}_{a}:\overline{x}>4\text{.}5$
• ## B

${H}_{o}:\mu \ge 4\text{.}5$ ${H}_{a}:\mu <4\text{.}5$
• ## C

${H}_{o}:\mu =4\text{.}\text{75}$ ${H}_{a:}\mu >4\text{.}\text{75}$
• ## D

${H}_{o}:\mu =4\text{.}5$ ${H}_{a}:\mu >4\text{.}5$

D

At a significance level of $a=0\text{.}\text{05}$ , the correct conclusion is:

• ## A

The average in 2007 is higher than it was in 1995.
• ## B

The average in 1995 is higher than in 2007.
• ## C

The average is still about the same as it was in 1995.
• ## D

The test is inconclusive.

C

The Type I error is:

• ## A

To conclude the average hours per week in 2007 is higher than in 1995, when in fact, it is higher.
• ## B

To conclude the average hours per week in 2007 is higher than in 1995, when in fact, it is the same.
• ## C

To conclude the average hours per week in 2007 is the same as in 1995, when in fact, it is higher.
• ## D

To conclude the average hours per week in 2007 is no higher than in 1995, when in fact, it is not higher.

B

Introduction about quantum dots in nanotechnology
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
it is a goid question and i want to know the answer as well
Maciej
Abigail
for teaching engĺish at school how nano technology help us
Anassong
Do somebody tell me a best nano engineering book for beginners?
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
what is fullerene does it is used to make bukky balls
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
so some one know about replacing silicon atom with phosphorous in semiconductors device?
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
for screen printed electrodes ?
SUYASH
What is lattice structure?
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
what's the easiest and fastest way to the synthesize AgNP?
China
Cied
types of nano material
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials and their applications of sensors.
what is nano technology
what is system testing?
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!


text:
Ernest Schimmerling

### Mathematical logic seminar - October 30, 2002

 Speaker: Natasha Dobrinen S. Chowla Research Assistant Professor Department of Mathematics Pennsylvania State University Title: General Infinitary Distributive Laws and Related Games in Boolean Algebras Abstract:

General infinitary distributive laws generalize the basic finitary distributive law in Boolean algebras:

$(x_0 + y_0)(x_1 + y_1) = (x_0 \times y_0) + (x_1 \times y_0) + (x_0 \times y_1) + (x_1 \times y_1)$.

Infinitary distributive laws are of interest in their own right, and also for their equivalences to some useful forcing properties. Jech pioneered the connections between the $(\omega,\infty)$-, $(\omega,\lambda)$-, weak$(\omega,\lambda)$-, and $(\omega,\lambda,\omega)$-distributive laws and related infintary games between two players. Foreman, Kamburelis, and others have added to this body of knowledege.

We will present some results of Jech, Foreman, and Kamburelis along with some of our own. We will also present a generalized notion of weak distributivity, namely the hyper-weak distributive laws, and show that for certain pairs of cardinal numbers, the $(\kappa,\lambda,\nu)$-d.l. and the hyper-weak $(\kappa,\lambda)$-d.l. are equivalent to the non-existence of a winning strategy for the first player in the appropriate games. Under GCH, this equivalence holds for all pairs $\kappa \geq \lambda$.

We will also show that, assuming $\kappa^{<\kappa}=\kappa$ and $\diamond_{\kappa^+}(E(\kappa))$ and certain assumptions about the relationships between $\kappa$ and $\lambda$, there are $\kappa^+$-Suslin algebras in which the games are undetermined. This is a correction to a previous "result" where we only assumed $\kappa$ regular and $\diamond_{\kappa^+}$ to construct such a $\kappa^+$-Suslin tree. Balcar pointed out the error and also that $\kappa^{<\kappa}=\kappa$ and $\diamond_{\kappa^+}(E(\kappa))$ suffice to construct a $\kappa^+$-Suslin tree. We have found that the previous construction in which the games are undetermined still can be carried out under these stronger assumptions. Similarly for the hyper-weak distributive laws.


text:
# Schur–Zassenhaus theorem

(Redirected from Schur-Zassenhaus theorem)

The Schur–Zassenhaus theorem is a theorem in group theory which states that if ${\displaystyle G}$ is a finite group, and ${\displaystyle N}$ is a normal subgroup whose order is coprime to the order of the quotient group ${\displaystyle G/N}$, then ${\displaystyle G}$ is a semidirect product (or split extension) of ${\displaystyle N}$ and ${\displaystyle G/N}$. An alternative statement of the theorem is that any normal Hall subgroup ${\displaystyle N}$ of a finite group ${\displaystyle G}$ has a complement in ${\displaystyle G}$. Moreover if either ${\displaystyle N}$ or ${\displaystyle G/N}$ is solvable then the Schur–Zassenhaus theorem also states that all complements of ${\displaystyle N}$ in G are conjugate. The assumption that either ${\displaystyle N}$ or ${\displaystyle G/N}$ is solvable can be dropped as it is always satisfied, but all known proofs of this require the use of the much harder Feit-Thompson theorem.

The Schur–Zassenhaus theorem at least partially answers the question: "In a composition series, how can we classify groups with a certain set of composition factors?" The other part, which is where the composition factors do not have coprime orders, is tackled in extension theory.

## History

The Schur–Zassenhaus theorem was introduced by Zassenhaus (1937, 1958, Chapter IV, section 7). Theorem 25, which he credits to Issai Schur, proves the existence of a complement, and theorem 27 proves that all complements are conjugate under the assumption that ${\displaystyle N}$ or ${\displaystyle G/N}$ is solvable. It is not easy to find an explicit statement of the existence of a complement in Schur's published works, though the results of Schur (1904, 1907) on the Schur multiplier imply the existence of a complement in the special case when the normal subgroup is in the center. Zassenhaus pointed out that the Schur–Zassenhaus theorem for non-solvable groups would follow if all groups of odd order are solvable, which was later proved by Feit and Thompson. Ernst Witt showed that it would also follow from the Schreier conjecture (see Witt (1998, p.277) for Witt's unpublished 1937 note about this), but the Schreier conjecture has only been proved using the classification of finite simple groups, which is far harder than the Feit–Thompson theorem.

## Examples

If we do not impose the coprime condition, the theorem is not true: consider for example the cyclic group ${\displaystyle C_{4}}$ and its normal subgroup ${\displaystyle C_{2}}$. Then if ${\displaystyle C_{4}}$ were a semidirect product of ${\displaystyle C_{2}}$ and ${\displaystyle C_{4}/C_{2}\cong C_{2}}$ then ${\displaystyle C_{4}}$ would have to contain two elements of order 2, but it only contains one. Another way to explain this impossibility of splitting ${\displaystyle C_{4}}$ (i.e. expressing it as a semidirect product) is to observe that the automorphisms of ${\displaystyle C_{2}}$ are the trivial group, so the only possible [semi]direct product of ${\displaystyle C_{2}}$ with itself is a direct product (which gives rise to the Klein four-group, a group that is non-isomorphic with ${\displaystyle C_{4}}$).

An example where the Schur–Zassenhaus theorem does apply is the symmetric group on 3 symbols, ${\displaystyle S_{3}}$, which has a normal subgroup of order 3 (isomorphic with ${\displaystyle C_{3}}$) which in turn has index 2 in ${\displaystyle S_{3}}$ (in agreement with the theorem of Lagrange), so ${\displaystyle S_{3}/C_{3}\cong C_{2}}$. Since 2 and 3 are relatively prime, the Schur–Zassenhaus theorem applies and ${\displaystyle S_{3}\cong C_{3}\rtimes C_{2}}$. Note that the automorphism group of ${\displaystyle C_{3}}$ is ${\displaystyle C_{2}}$ and the automorphism of ${\displaystyle C_{3}}$ used in the semidirect product that gives rise to ${\displaystyle S_{3}}$ is the non-trivial automorphism that permutes the two non-identity elements of ${\displaystyle C_{3}}$. Furthermore, the three subgroups of order 2 in ${\displaystyle S_{3}}$ (any of which can serve as a complement to ${\displaystyle C_{3}}$ in ${\displaystyle S_{3}}$) are conjugate to each other.

The non-triviality of the (additional) conjugacy conclusion can be illustrated with the Klein four-group ${\displaystyle V}$ as the non-example. Any of the three proper subgroups of ${\displaystyle V}$ (all of which have order 2) is normal in ${\displaystyle V}$; fixing one of these subgroups, any of the other two remaining (proper) subgroups complements it in ${\displaystyle V}$, but none of these three subgroups of ${\displaystyle V}$ is a conjugate of any other one, because ${\displaystyle V}$ is Abelian.

The quaternion group has normal subgroups of order 4 and 2 but is not a [semi]direct product. Schur's papers at the beginning of the 20th century introduced the notion of central extension to address examples such as such ${\displaystyle C_{4}}$ and the quaternions.

## Proof

The existence of a complement to a normal Hall subgroup H of a finite group G can be proved in the following steps:

1. By induction on the order of G, we can assume that it is true for any smaller group.
2. If H is abelian, then the existence of a complement follows from the fact that the cohomology group H2(G/H,H) vanishes (as H and G/H have coprime orders) and the fact that all complements are conjugate follows from the vanishing of H1(G/H,H).
3. If H is solvable, it has a nontrivial abelian subgroup A that is characteristic in H and therefore normal in G. Applying the Schur–Zassenhaus theorem to G/A reduces the proof to the case when H=A is abelian which has been done in the previous step.
4. If the normalizer N=NG(P) of every p-Sylow subgroup P of H is equal to G, then H is nilpotent, and in particular solvable, so the theorem follows by the previous step.
5. If the normalizer N=NG(P) of some p-Sylow subgroup P of H is smaller than G, then by induction the Schur–Zassenhaus theorem holds for N, and a complement of NH in N is a complement for H in G because G=NH.


text:
18.S997 | Fall 2011 | Undergraduate
Introduction To MATLAB Programming
Conway Game of Life

## Warm-up

In all the following questions you are expected to have an “elegant” solution, not a brute force one. No if statements or loops. Unless where specifically noted, no MATLAB® functions are to be used.

1. Find out what the command diag does. (We already learned about ones, zeros, and sum, but if you are unsure, look them up as well.) Using sum and diag, find the sum of the diagonal of a matrix. (For example, A in the next question.)
2. Let A=magic(6). What expression will give you the $$2\times2$$ submatrix of elements in the upper left corner? How about lower right? Can you write an expression that will also work for any other matrix A, for example A=magic(10)?
3. Find the sub-matrix of elements of A whose both coordinates are odd.
4. With no MATLAB functions, write the matrix A “flipped” right to left. Up to down.
5. Get the sum of the “anti diagonal” of the magic square by a simple expression using sum, diag and the colon (:) notation.
6. Let x = [2 5 1 6]. Add 3 to just the odd-positioned elements (resulting in a 2-vector). Now write the expression that adds 3 to the odd-positioned elements and puts the result in the even positions of the original x vector.
7. Let y = [4 2 1 3]. Think of y as a specific reordering (permutation) of the numbers $$\{1, 2, 3, 4\}$$. “4 goes to 1, 2 remains, 1 goes to 3 and 3 goes to 4.” Use y to reorder the elements of x in the same manner. (The result should be [6 5 2 1].)
8. What is the vector that corresponds to the permutation of n elements that takes every element one position to the left, except for the first element, which goes to the end?
9. (Bonus) The inverse of a permutation y is a permutation z that, when combined with y (in either order) gives the original (non-permuted) elements. Given a permutation vector (as y is in the previous question), find the vector z which corresponds to the inverse of y.
10. Experiment with assignments such as b(1:3,1:2:4)=1. Make a “checkerboard” matrix: an 8-by-8 matrix whose cell $$a(i,j)$$ equals 1 if $$i+j$$ is odd and 0 if it is even. (Of course, do not use loops or if statements!) If you like, use the function spy or pcolor to “see” the checkerboard that you created. (Tricky. Do it in two commands, not one. If you want to do this with one command you may use ones. Also possible using mod and reshape.)
11. Recall that a matrix (such as A) can also be referenced using a single coordinate: A(3). Remind yourself how this coordinate is related to the original matrix.
12. Use the single index reference to a matrix in order to extract the diagonal of a 5-by-5 matrix. (Do not use the function diag.) Do the same to extract the “anti-diagonal”.