text:
# xml

## Introduction

This small application for DataGrid allows users to:

• add a new row in the DataGrid.
• save or update a row of the DataGrid.
• delete an existing row from the DataGrid.
• read the data from an XML file.
• copy the current data of the DataSet to three files on C:/ root directory:
1. MyXMLText.txt (text file)
2. MyXMLdata.xml (XML file)
3. MyXMLschema.xsd (schema file)
• write the current data of the table to a text file on C:/.

The DataGrid control in the "DataGrid Application" binds to a single DataSet object. The DataSet object of the "DataGrid Application" is initially populated from a database using an OleDbDataAdapter object.

## What is a DataGrid?

The Windows Forms DataGrid control provides a user interface to ADO.NET datasets, displays ADO.NET tabular data in a scrollable grid, and allows for updates to the data source. In cases where the DataGrid is bound to a data source with a single table containing no relationships, the data appears in simple rows and columns, as in a spreadsheet. The DataGrid control is one of the most useful and flexible controls in Windows Forms. As soon as the DataGrid control is set to a valid data source, the control is automatically populated, by creating columns and rows based on the structure of the data. The DataGrid control can be used to display either a single table or the hierarchical relationships between a set of tables.

For example: if you bind the DataGrid to data with multiple related tables, and if you enable navigation on the DataGrid, the DataGrid displays so called 'expanders' in each row.

With an expander, you can navigate from a parent table to a child table. If you click a node in the DataGrid, it displays the child table. If you click the Back button, it displays the original parent table. In this fashion, the grid displays the hierarchical relationships between tables.

Bear in mind that only one table can be shown in the DataGrid at a time. Valid data sources for the DataGrid include:

• DataTable
• DataView
• DataSet
• DataViewManager
• A single dimension array
• Any component that implements the IListSource interface.

## How to display data in the DataGrid programmatically?

If you want to display data in a DataGrid, you need to define a DataGrid object. There are, of course, different ways to populate the data in the DataGrid. For example:

Define first a DataGrid and declare a new DataGrid, and then set some properties of the DataGrid (location, name, size etc..).

   private System.Windows.Forms.DataGrid dataGrid1;
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGrid1.Location = new System.Drawing.Point(16, 40);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(256, 176);

Now we can put all the commands needed into a method "fnDisplayDataInDataGrid()", to display data in the DataGrid.

private void fnDisplayDataInDataGrid()
{
string conStr ="Integrated Security=SSPI;" +
"Initial Catalog=Northwind;" +
"Data Source=SONY//MYSQLSERVER;";
SqlConnection conn = new SqlConnection(conStr);
// Open the connection
conn.Open();
// Create a data adapter object
// Create a DataSet object
DataSet ds = new DataSet();
// filling the DataSet
// you can use one of the followings.Both works fine.
// this.dataGrid1.SetDataBinding(ds,"MyTable"); or
this.dataGrid1.DataSource=ds.DefaultViewManager;
}

At this point, I would refer you to my previous article (Using ADO.NET for beginners) where you can find some more interesting tips and tricks for DataGrids (i.e., how to trap keystroke events - Up, Down, Escape etc. - in a DataGrid).

## How It Works

After you get connected to the MS Access database, all records are displayed on the DataGrid.

When you run the application first time, the method "fnRefresh()" will be called. It clears the contents of the DataSet, fills the DataAdapter, and displays the data from the data source in the DataGrid. After that, all the buttons are ready to be used. Here is the code snippet of the method "fnRefresh()":

private void fnRefresh()
{
this.dataSet11.Clear();
this.dataGrid1.DataSource=this.dataSet11.Tables["MyContactsTable"].DefaultView;
}

### Insert a new row

If you click the "Insert" button to add a new record, the last row on the DataGrid is selected and the previous clicked row is unselected. After entering the data for that row, you click the 'Save/Update'-button to save the new row. Here is the method for inserting a new row:

private void fnInsertNew()
{
//keep in mind the previous clicked row to unselect
int iPrevRowindex=this.iRowIndex;
MessageBox.Show("Enter the new record at the end" +
" of the DataGrid and click 'Save/Update'-button", "Stop");
this.btInsertnew.Enabled=false;
//get how many records in the table
this.iRowIndex=this.dataSet11.Tables["MyContactsTable"].Rows.Count;
//select the last row
this.dataGrid1.Select(this.iRowIndex);
//unselect the previous row
this.dataGrid1.UnSelect(iPrevRowindex);
}

### Save or Update the new/changed row(s)

The code snippet for the method "fnSaveUpdate()" saves the changes that are made to the DataSet back to the database. The 'GetChanges' method of dataSet11 will return a new DataSet which is called 'myChangedDataset' containing all the rows that have been modified (updated, deleted or inserted). If no changes have been made, the method 'GetChanges' returns a 'null' DataSet.

If any sort of error occurs while updating the database, the 'Update' method of OleDbDataAdapter will generate an exception. This logic is held in a try/catch block. If an exception occurs, you get a message box informing you of the error. And the "RejectChanges" method is then called to discard the changes you made. If any changes are made, the user is told how many rows were affected/changed, and the "AcceptChanges()" method will mark the changes made as permanent in the DataSet. Now we need to invoke refreshing the DataSet with the method "fnRefresh()". I think this is a 'simple' and robust technique when updating the database.

Here is the code snippet for the 'fnSaveUpdate()' method:

private void fnSaveUpdate()
{
try
{
//put the modified DataSet into a new DataSet(myChangedDataset)
DataSet myChangedDataset= this.dataSet11.GetChanges();
if (myChangedDataset != null)
{
//get how many rows changed
MessageBox.Show("Database has been updated successfully: " +
modifiedRows + " Modified row(s) ", "Success");
this.dataSet11.AcceptChanges(); //accept the all changes
fnRefresh();
}
else
}
MessageBox.Show("Nothing to save", "No changes");
}//if-else
}
catch(Exception ex)
{
//if something somehow went wrong
MessageBox.Show("An error occurred updating the database: " +
ex.Message, "Error",  MessageBoxButtons.OK, MessageBoxIcon.Error);
this.dataSet11.RejectChanges(); //cancel the changes
}//try-catch
fnEnableDisableAllButtons(true);
}

### Delete the current row

It is always a good practice to ask the user before deleting a row. After clicking 'Yes', the current row on the DataGrid is deleted, updated and refreshed. The method for deleting a row is as below:

private void fnDelete()
{
//ask user if wanting to delete
DialogResult dr=MessageBox.Show("Are you sure you want to delete this row ? ",
"Confirm deleting",  MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr ==DialogResult.Yes)
{
DataTable tbl=new DataTable("MyContactsTable");
tbl=this.dataSet11.Tables[0];
int i=this.iRowIndex;//get the index of the row you clicked
tbl.Rows[i].Delete(); //delete the row
this.fnRefresh(); //refresh the table
}
}

### Reading the data from an XML file

Sometimes you have to read the data from an XML file and display it in a DataGrid. In order to do this, I pass the XML file to the method; if the file exists, I clear the DataSet and read the XML data into the DataSet using the specified file. The following code snippet shows this:

private void fnDataReadingFromXMLFile(string filename)
{
//check if the file exists
if ( File.Exists(filename))
{
//clear the DataSet contents
this.dataSet11.Clear();
} //if
else {
MessageBox.Show(filename + " does NOT exist; Please click" +
" first the button 'CopyToXML' ", "File Error",
MessageBoxButtons.OK, MessageBoxIcon.Error );
}//else
}

### Copy the DataSet to the Text / XML / Schema file

Clicking the 'CopyToXML' button invokes the 'fnCopyToXMLandTextFile()' method. As you can guess from its name, it writes the current data of the DataSet to three files on the C:/ root directory:

1. Text file: MyXMLdataText.txt.
2. XML file: XMLdata.xml.
3. Schema file: MyXMLschema.xsd.

If you wish to use another path instead of 'C:/', you have to change the code accordingly. The following code snippet demonstrates this feature:

private void fnCopyToXMLandTextFile()
{
if (this.dataSet11 == null)
{
return; //cancel
}
files. this.dataSet11.WriteXml("C://MyXMLText.txt");
this.dataSet11.WriteXml("C://MyXMLdata.xml", XmlWriteMode.WriteSchema);
this.dataSet11.WriteXmlSchema("C://MyXMLschema.xsd");
string s="The current data of the DataSet coppied on C:// as: /n";
s +="* Text file: MyXMLdataText.txt/n";
s +="* XML file: XMLdata.xml/n";
s +="* Schema file: MyXMLschema.xsd";
MessageBox.Show(s, "Copy to XML/Text/Schema file");
}

### Writing the current data of the table into a text file on hard disk (C:/)

Because ExecuteReader requires an open and available connection, first we have to open the database connection. If the connection's current state is Closed, you get an error message. After opening the connection, we create an instance of OleDbCommand, a CommandText for the SQL statement, an OleDbDataReader and an instance of StreamWriter. And then, in a while-loop, the OleDbDataReader reads through the data rows and writes them out to the text file. Finally, it closes the OleDbDataReader. In StreamWriter writer = new StreamWriter("C://MyTextFile.txt", false), we pass the the text file and set the bool value to 'false'. If the file doesn't exist, in any case a new text file will be created. If the file exists and it the second parameter is 'false', the file will be overwritten because of 'false'. If the value is 'true', then the file won't be overwritten and the data will then be appended to the file. Here is the code snippet for writing to the text file:

private void fnWriteToTextFile()
{
OleDbCommand cmd=new OleDbCommand();
this.oleDbConnection1.Open(); //open the connection
cmd.CommandText="SELECT Address, City, Country, Email," +
" FirstName, LastName, Message, Phone FROM MyContactsTable";
cmd.Connection=this.oleDbConnection1;
//the "using" statement causes the close method to be called internally.
//if "using" not used, use "writer.Close()" in try-catch-finally explicitly
using (StreamWriter writer = new StreamWriter("C://MyTextFile.txt",false))
{
//false means: textfile is overwritten
try
{
{
writer.Write("#"); //separator
writer.Write("#");
writer.Write("#");
writer.Write("#");
writer.Write("#");
writer.Write("#");
writer.Write("#");
writer.WriteLine(); //next new line
}//while
}catch (Exception excp)
{
MessageBox.Show(excp.Message);
}finally {
}//try-catch-finally
}//using
MessageBox.Show("Data of table writtten into" +
" C://MyTextFile.txt file","Writing completed");
}

## And Finally

I think the code is quite simple to understand because I tried to make comments to almost every line of code. I hope you can find something useful here for your projects. As ever, all feedback is welcome. For more tips about the DataGrid, here is the link of my other article: Using ADO.NET for beginners.

Happy coding!

• 写评论


text:
1. The first graph plots data from a soap density measurement laboratory. The slope of the line is the density of the soap.
1. __________ Calculate the slope of the line.
2. ______________ Determine the y-intercept of the line.
3. y = _________ x + __________ Write the y = mx + b slope-intercept equation for the line.
4. [float] or [sink] The slope of the line is the density of soap. If the density of the soap is less than one gram/centimeter³ then the soap would float. If the density of the soap is greater than one gram/centimeter³ then the soap would sink. Based on the above, will this soap float or sink?
2. A student gathered the data seen in the table below. Plot the data on the graph.
1. __________ Calculate the slope of the line.
2. __________ Calculate the intercept of the line.
3. __________ cm. How far will the RipStik travel in 23 seconds?
4. __________ seconds. How long in seconds for the RipStik to travel 7500 centimeters?
3. __________ What is the slope of the line y = 2.0 + 0.15x?
4. __________ What is the y-intercept of the line y = 2.0 + 0.15x?
5. __________ __________ For the Desmos graph and regression, determine the acceleration of gravity g.
6. The Desmos graph shows force of friction f data for weight w1, surface area s2, and grit g3.
1. _______________ Based on the data above, which variable has the most predictable effect on the force of friction?
2. Why?
3. _______________ Based on the data above, which variable has the least predictable effect on the force of friction?
4. Why?
7. A student rolled marbles into a line of five marbles.
1. ______________ What will be the slope of the graph for marbles in versus marbles out?
2. _____________________ ____ ________________ What law of motion are the marbles demonstrating?
8. A wave was inscribed on poster paper by a RipStik and the plotted in Desmos.
1. λ = _________ _________ What is the wavelength λ of ONE wave?
2. a = _________ _________ What is the amplitude a?
3. τ = _________ _________ The RipStik took 1.45 seconds to swizzle (wiggle) 2.5 times. What is the period τ of ONE wave?
4. f = _________ _________ What is the frequency f of the RipStik wave?
5. ѵwave = _________ _________ What is the wave velocity ѵwave?
9. Explain what happens to sea surface temperatures in the western Pacific during an El Niño.
10. Explain what happens to precipitation in the western Pacific during an El Niño.
11. With respect to storms in the western Pacific, what is the "El Niño, box"?
12. List the three primary colors of light:
13. Kestrels (a type of hawk related to falcons) use light to determine if a field has voles (related to mice) in a field. What is the name of the type of light the kestrel is using and how are they using that light?
14. __________ Based on the image at the right (maybe on next page) where x1 is the image depth and y1 is the object depth for an object underwater, what is the index of refraction for water?
1. ______________ __________ Use the index of refraction calculated above to predict the object depth for a penny that appears to be 30 cm underwater.
2. ______________ __________ Use the index of refraction calculated above to predict the image depth for a coral head that is 200 cm underwater.
3. ______________ Water has a published index of refraction of 1.33. What is the error for the slope?
4. ______________ Water has a published index of refraction of 1.33. What is the percentage error for the slope?
15. A Whirlpool dryer uses 26 amps of current at 240 volts.
1. __________ _____ Given that V = iR, calculate the resistance R for the dryer.
2. __________ _____ Given that P = iV, calculate the power P for the dryer.
3. __________ Power is now forty cents per kiloWatt hour, or \$0.40 for 1000 Watts for one hour. How much does it cost to run the dryer for one hour?
16. [Note that in an atom the number of neutrons is equal to or greater than the number of protons. Thus the more numerous nucleons are the neutrons.]
1. _______________ Looking only at the atomic diagram on this paper, determine the atomic number of the atom depicted.
2. _______________ Looking at the diagram, what is the atomic mass for the atom?
3. _______________ Looking at the diagram and the chart on the wall, what is the one or two letter chemical abbreviation for this element?
4. _______________ What is the full name for this element?

17. Cloud type: ______________________

18. Cloud type: ______________________

19. Cloud type: ______________________
20. Data was collected on the time for marbles to roll down a ramp. The data recorded is the marble weight w1 in gram-force versus the time t1 in second to roll down the ramp.
1. ____________ __________ What is the slope of the relationship?
2. Based on the experiment, does the time for a marble to roll down a ramp depend on the weight of the marble? Why?

$\text{slope m}=\frac{\left({y}_{2}-{y}_{1}\right)}{\left({x}_{2}-{x}_{1}\right)}$
raw error = experimental value − expected value
$\text{percent error}=\frac{\left(\text{experimental value}-\text{expected value}\right)}{\left(\text{expected value}\right)}$
period τ = 1 ÷ (frequency f)
frequency f = 1 ÷ (period τ )
velocity ѵ = wavelength λ × frequency f

format: plain


text:
# 1979 USAMO Problems/Problem 5

## Problem

Let $A_1,A_2,...,A_{n+1}$ be distinct subsets of $[n]$ with $|A_1|=|A_2|=\cdots =|A_{n+1}|=3$. Prove that $|A_i\cap A_j|=1$ for some pair $\{i,j\}$.

## Solution

Suppose the problem statement does not hold. It is clear that $n \ge 4$. Choose the smallest $n$ such that $|A_i \cap A_j| \neq 1$ for each $\{i, j\}$.

First, the $(n+1)$ subsets have $3(n+1)$ elements (some repeated) in conjunction. Because there are $n$ elements of $[n]$ total, by the Pigeonhole Principle one element of $[n]$, say $k$, is in at least four subsets. Let these subsets be $A_1, A_2, A_3, A_4$, without loss of generality, and let $A_1$ have elements $k, m, n$. Then without loss of generality let $A_2$ have elements $k, m, p$. If set $A_3$ has elements $k, n, p$, then simple casework shows that it is impossible to create $A_4$ without having $A_4$ intersect one of $A_1, A_2, A_3$ at exactly one element. Thus assume $A_3$ has elements $k, m, q$. Then $A_4$ has elements $k, m, r$. Consider each remaining set $A_i$. Then $A_i$ either contains both $k, m$ or none of them. Because there are $(n-2)$ distinct elements of $[n]$ apart from $k, m$, at most $(n-2)$ subsets can contain $k, m$. Then at least 3 subsets do not contain $k, m$, and it is easy to see that they are disjoint from those subsets that do contain $k, m$. Thus, we can partition $[n]$ into two subsets, one of which is the union of the $t$ subsets that do contain $k, m$, and the other is the union of the $(n+1)-t$ subsets that do not contain $k, m$. Because the latter subset has $(n-t-2) < (n+1)-t - 1$ elements, we may use infinite descent to contradict the minimality of $n$. The proof is complete.


text:
1. ## integration by substitution

I am unsure if I am doing the next to the last step correctly.

integral e^5x dx
g(u) = 1/6*u^6
u = 5x
du = 5

1/6 * 1/du * u^6
1/30 (5x)^6

2. Originally Posted by startingover
I am unsure if I am doing the next to the last step correctly.

integral e^5x dx
g(u) = 1/6*u^6
u = 5x
du = 5

1/6 * 1/du * u^6
1/30 (5x)^6
Your result is wrong. You have used the wrong formula.
Notice that e^(5x) is NOT a power function. It is an exponential function.

3. Originally Posted by startingover
I am unsure if I am doing the next to the last step correctly.

integral e^5x dx
g(u) = 1/6*u^6
u = 5x
du = 5

1/6 * 1/du * u^6
1/30 (5x)^6
Yes, curvature is right. The standard way to do this is by substitution, which seems to be what you attempted.

However, it is probably best to just remember that:

$\int e^{kx} dx = \frac {1}{k} e^{kx} + C$ for $k \neq 0$


text:
GATE ECE
Signals and Systems
Transmission of Signal Through Continuous Time LTI Systems
Previous Years Questions

## Marks 1

Let x1(t) = e$$-$$t u(t) and x2(t) = u(t) $$-$$ u(t $$-$$ 2), where u( . ) denotes the unit step function. If y(t) denotes the convolution of x1(t) an...
The outputs of four systems (S1, S2, S3 and S4) corresponding to the input signal sin(t), for all time t, are shown in the figure. Based on the given ...
A continuous-time sinusoid of frequency 33 Hz is multiplied with a periodic Dirac impulse train of frequency 46 Hz. The resulting signal is passed thr...
A real - values signal x(t) limited to the frequency band $$\left| f \right| \le {W \over 2}$$ is passed through a linear time invariant system whose ...
Assuming zero initial condition, the response y (t) of the system given below to a unit step input u(t) is ...
Let g(t) = $${e^{ - \pi {t^2}}}$$, and h(t) is a filter matched to g(t). If g(t) is applied as input to h(t), then the Fourier transform of the outpu...
Consider the pulse shape s(t) as shown. The impulse response h(t) of the filter matched to this pulse is ...
A system with the transfer function $${{Y(s)} \over {X(s)}} = {s \over {s + p}}\,\,$$ has an output $$y(t) = \cos \left( {2t - {\pi \over 3}} \righ... In the system shown below, x(t) = (sint)u(t). In steady-state, the response y(t) will be ... A low-pass filter having a frequency response$$H(j\omega )$$=$$A(\omega ){e^{j\Phi (\omega )}}$$, does not product any phase distortion if A linear phase channel with phase delay$${\tau _p}$$and group delay$${\tau _g}$$must have The input to a channel is a band pass signal. It is obtained by linearly modulating a sinusoidal carrier with a signal- tone signal. The output of the... A rectangular pulse of duration T is applied to a filter matched to this input. The output of the filter is a ## Marks 2 A continuous-time filter with transfer function$$\,H(S) = {{2s + 6} \over {{s^2} + 6s + 8}}$$is converted to a discrete time filter with transfer fu... A first-order low-pass filter of time constant T is excited with different input signals (with zero initial conditions up to t = 0). Match the excitat... In the system shown in Figure (a), m(t) is a low-pass signal with bandwidth W Hz. The frequency response of the band-pass filter H(f) is shown in Figu... The 3 - dB bandwidth of the low - pass signal$${e^{ - 1}}$$u(t), where u(t) is the unit step function, is given by A system has poles at 0.01 Hz, 1 Hz and 80 Hz; zeros at 5 Hz, 100 Hz and 200 Hz. The approximate phase of the system response at 20 Hz is Consider the signal x(t) shown in Fig. Let h(t) denote the impulse response of the filter matched to x(t), with h(t) being non-zero only in the interv... The system under consideration is an RC low -pass filter (RC-LPF) with R = 1.0$$k\Omega $$and C = 1.0$$\mu F$$. Let$${t_g}$$(f) be the group del... The system under consideration is an RC low -pass filter (RC-LPF) with R = 1.0$$k\Omega $$and C = 1.0$$\mu F$$. Let H(t) denote the frequency resp... In Fig. m(t) =$$ = {{2\sin 2\pi t} \over t}$$,$$s(t) = \cos \,200\pi t\,\,andn(t) = {{\sin 199\pi t} \over t}$$. The output y(t) will be ... A system has a phase response given by$$\phi \,(\omega )$$where$$\omega $$is the angular frequency. The phase delay and group delay at$$\omega $$... The input to a matched filter is given by$$s(t) = \left\{ {\matrix{ {10\sin (2\pi \times {{10}^6}t),} & {0 < \left| t \right| < {{10}^{...
Sketch the waveform (with properly marked axes) at the output of a matched filter matched for a signal s(t), of duration T, given by $$s(t) = \left\{ ... The pole-zero pattern of a certain filter is shown in the Fig. The filter must be of the following type. ... The magnitude and phase transfer functions for a distortionless filter should respectively be: Specify the filter type if its voltage transfer function H(s) is given by H(s) =$${{K({s^2} + {\omega _0}^2)} \over {{s^2} + ({\omega _0}/Q)s + {\o...

## Marks 5

A base band signal g(t) band limited to 100 Hz modulates a carrier of frequency $${{f_0}}$$ Hz. The modulated signal g(t) $$\cos 2\,\pi \,{f_0}t$$ is ...
A signal 3 sin $$\left( {\pi \,\,{f_0}t} \right) + \,5\,\,\cos \,\,\,(3\pi \,\,{f_0}t)$$ is applied to an RC low pass filter of 3 dB cutoff frequency ...
An input signal A exp $$\left( { - \alpha \,t} \right)$$ u(t) with $$\alpha > 0$$ is applied to a causal filter, the impulse response of which is ...
A signal, f(t) = $${e^{ - at}}$$ u(t), where u(t) is the unit step function, is applied to the input of a low-pass filter having $$\left| {H(\omega )}... Obtain an expression for the signal in figure, for the signal$${v_3}(t)$$in Fig for$${v_1}(t) = 100\cos (2000\pi t) + 4\sin (200\pi t). Assume ...
EXAM MAP
Joint Entrance Examination
JEE MainJEE AdvancedWB JEE
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Medical
NEET


text:
# A molal solution is one that contains one mole of a solute in

$\begin{array}{1 1}\text{1000g of the solvent}\\\text{One litre of the solvent}\\\text{One litre of the solution}\\\text{22.4 litres of the solution}\end{array}$

Answer : 1000g of the solvent
Molality involves 1000g of solvent.


text:
# Conjoint analysis or discrete choice analysis ? And which software?

Suppose I would like to model the light-bulb preference of respondents. I would like to ask their preferences between existing bulbs on the market. And when you choose a bulb in a shop you usually see a package with many information gathered togheter such as:

• technology (halo, fluo, led)
• price
• energy label EURO norm (from E to A++)
• shape (pear, candle, spiral, steam)
• watts.
• brand (philips,osram , etc)

As there are too many combination respondents should only see max three combinations and check [i said check NOT rate...] the one they prefer (of course many iterations are needed per respondent to understand how he choose his bulb) At the end, respondent should also give socio-demo infos such as.

• Gender
• Age
• Income

I would like to see the global effect of attribute. Like what's in general the most important criteria to choose a bulb. I would like to get a kind of econometrical analysis to know if there is difference of choice between the socio demo infos.

I've heard about conjoint analysis or discrete choice analysis methods. In my case which one would be more appropiate?

Which software(s) would also be more appropriate for the overall process (from the design to the analyis)?

## bumped to the homepage by Community♦2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

• Hello, while I am nox expert on both methods I can say that market research does a lot of such questions and mostly uses conjoint analysis for it. If you are unsure, I would recommend consulting the book amazon.de/Using-Multivariate-Statistics-Barbara-Tabachnick/dp/…. It contains excellent "when to use method [x] " texts which are really helpful to decide such questions. – Christian Sauer Jun 6 '14 at 6:36

You can use a few packages in R, such as described in this answer. You would probably need to used a hierarchical Bayes model for this, so the package bayesm would be required.


text:
# Chase camera

## Recommended Posts

Hi everyone, I'm currently trying to implement chase camera model for a spaceship simulator. I've read a couple of threads regarding the subject on this site, but none of them addresses my issue. Let's forget about every aspect of camera model besides position. What I'm trying to do is adjust camera's position so that: 1. When the spaceship's velocity is constant, the camera tends to occupy certain spot behind the ship; the distance between that spot and the spaceship is constant and does not depend on spaceship's velocity. 2. When the spaceship is accelerating, the camera starts to lag behind 3. When the spaceship is slowing down, the camera closes on the spaceship I'd like to learn about some popular solutions to this, because what I'm trying to do right now seems a little too complicated and doesn't work too well. Thanks. P.S. Right now I'm trying the following: 1. I think of a camera as of a rigid body connected to the spaceship with a spring. 2. The space "friction" is dependent upon camera's velocity 3. I solve ODE and find x(t) for the camera 4. It works fine in math, but since the spaceship moves in an unpredictable fashion (I don't know what's going to happen the next frame), I have to re-solve ODE every frame, and for some reason the solution "jumps" too much resulting in unacceptable camera behavior. The other problem is that friction makes camera's stable position depend on its speed, which is not what I need. This can be reduced by decreasing friction, but the amplitude of oscillation would grow then.

##### Share on other sites
OK, I have a couple of ideas.

Try recording the ships location over a few seconds, then using linear interpolation? record one frame per 0.5 seconds, using a circular buffer of 3 seconds, then use linear interpolation, which will smooth out the sudden changes in velocity. (I tried this years ago in visual basic, with one robot following another).
This algorithm was inspired by a level in Rayman on the playstation, where an evil Rayman follows the hero.

Heres another one:

Each frame, the camera updates its vector from the ship. Then you calculate the distance you need to be from the ship depending on the speed with a simple function. Then you multiply the vector by this factor, to get the "ideal" distance for the camera to be from the ship.

The camera travels along the vector each frame, modifying its acceleration depending on the actual distance. If this is further away than the IDEAL distance it accelerates, and if closer it decelerates.

[edit: clarified a few sentences]

[Edited by - speciesUnknown on August 12, 2007 1:55:55 PM]

##### Share on other sites
Quote:
 The ship travels along the vector each frame, modifying its acceleration depending on the actual distance. If this is further away than the IDEAL distance it accelerates, and if closer it decelerates."

Do you mean "The CAMERA travels..."?

##### Share on other sites
Chase Camera Sample

^ It's in C# using the XNA Framework, but if you take a look at the source you should be able to port the code into whatever language you're using. It's a pretty good chase camera implementation.

##### Share on other sites
Quote:
Original post by tokaplan
Quote:
 The ship travels along the vector each frame, modifying its acceleration depending on the actual distance. If this is further away than the IDEAL distance it accelerates, and if closer it decelerates."

Do you mean "The CAMERA travels..."?

Sorry, yes i did. Ill edit the post to clarify this.

##### Share on other sites
Quote:
 Original post by FunLogicChase Camera Sample^ It's in C# using the XNA Framework, but if you take a look at the source you should be able to port the code into whatever language you're using. It's a pretty good chase camera implementation.

Thanks for the link, FunLogic, but this sample suffers from the same problem my current implementation does - the camera offset depends on the ship's speed. This is unacceptable if the speed range is wide enough (and it is in my case).

##### Share on other sites
Quote:
 1. When the spaceship's velocity is constant, the camera tends to occupy certain spot behind the ship; the distance between that spot and the spaceship is constant and does not depend on spaceship's velocity.2. When the spaceship is accelerating, the camera starts to lag behind3. When the spaceship is slowing down, the camera closes on the spaceship

just checking: are these the three rules you want your camera to obey?

Exactly

##### Share on other sites

you want your camera to satisfy those three rules.
Your game involves the ship changing velocity suddenly.
Your camera is suddenly changing velocity which you do not want.
You have a vector class or something similar, and can subtract one vector from another, and multiply a vector by a scalar.

briefly, heres what I think you need to do, Rules 2 and 3 are satisfied because the camera accelerates and decelerates at a constant speed rather than suddenly changing velocity. Rule 1 is satisfied because the camera only changes acceleration when it needs to.
If the ship stops dead, the camera moves in to meet the ship at an arbitrary speed, rather than instantly. (in theory)
If the ship accelerates, the camera will decelerate until its the correct distance.

If the ship decelerates, the opposite will occur.

I haven't figured out exactly how the camera will accelerate and decelerate, it might oscillate between too close and too far if the acceleration factor is too much. You might want to have some kind of threshold before the camera changes speeds. If its inside this threshold, its speed matches that of the ship.

DISCLAIMER: I haven't tested this. It may set your motherboard on fire, it may cause you to break out in a rash, it might cause the world to end, and any side effects are not my responsibility. Also I didnt listen in maths lessons and I probably used the wrong names for somethings. But it probably works.

float get_ideal_distance(float V){//whatever relationship you like //e.g. D = 0.5 V + 10; };void update_camera_velocity(){	//get direction vector and scalar distance	camera.direction = (camera.position - ship.position);	float actual_distance = direction.get_length();	camera.direction.normalize();		//decide what to do based on the actual vs ideal distances	float ideal_distance = get_ideal_distance(actual_distance);		if(magnitude(distance - ideal_distance) > const float some_threshold){	//cam needs to change speed			if(distance > ideal_distance){//camera is too far away 			camera.accelerate();		}else 			if(distance < ideal_distance){//camera is too close				camera.decelerate();  			};   	}	else{//otherwise camera is running at optimum distance.		camera.velocity = ship.velocity; 	};};void update_camera(float fps){	update_camera_velocity();	FACE_CAMERA_TOWARDS_SHIP()	MOVE_CAMERA_FORWARD(camera.velocity/fps);};

(p.s. feel free, anybody, to correct me if i got some maths term or equation wrong)

[Edited by - speciesUnknown on August 15, 2007 5:19:03 PM]

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627702
• Total Posts
2978712

• 21
• 14
• 12
• 10
• 12


text:
Neutron detection with large plastic scintillators for RPM applications - Archive ouverte HAL Access content directly
Conference Papers Year : 2015

## Neutron detection with large plastic scintillators for RPM applications

(1) , (1) , (1) , (1)
1
Gwenolé Corre
• Function : Correspondent author
Karim Boudergui
• Function : Author
Guillaume Sannié
• Function : Author

#### Abstract

Homeland security requests the use of Radiation Portal Monitor (RPM) to detect and differentiate gamma and neutron radiation. Gamma detection is required for illicit transportation of radioactive matter detection. Neutron detection is important to control nonproliferation of enriched material. Manufacturers worldwide propose sensors based on 3He which give the actual state of art in term of neutron detection. The price fluctuations due to the announcement of the shortage of 3He forces manufacturers to find viable alternative. From 10 years sensors providers have the challenge to replace previous 3He detectors that are known to be the most commonly deployed neutron sensor. As $^3$He detectors can only detect neutron, they must be completed with gamma detector. The proposed approach is based on pulse time correlation between adjacent sensors from signal collected by EJ200 plastic scintillators to detect gamma and neutron. Results obtained during FP7 Scintilla project test campaigns show the system relevance for replacement of today's $^3$He detectors.

### Dates and versions

cea-01823364 , version 1 (27-06-2022)

### Identifiers

• HAL Id : cea-01823364 , version 1
• DOI :

### Cite

Gwenolé Corre, Karim Boudergui, Guillaume Sannié, Vladimir Kondrasovs. Neutron detection with large plastic scintillators for RPM applications. ANIMMA 2015 - 4th International Conference on Advancements in Nuclear Instrumentation Measurement Methods and their Applications, Apr 2015, Lisbon, Portugal. pp.7465625, ⟨10.1109/ANIMMA.2015.7465625⟩. ⟨cea-01823364⟩

### Export

BibTeX TEI Dublin Core DC Terms EndNote Datacite

148 View


text:
# set JAVA_HOME in windows but "ant build" still fails

15,678

## Solution 1

I needed to copy the `Tools.jar` file from the `jdk/lib` folder to the `jre/lib` folder.

## Solution 2

`JAVA_HOME` should be set to `C:\Program Files\Java` in the Command Prompt. You can do this with the following:

``````set JAVA_HOME=C:\Program Files\Java
``````

This will then look for the most current jdk, lib, jre installed on your system.

## Solution 3

OK, guys, for Windows 7 it needs the `JAVA_HOME` as a Windows Environmental Variable, I've also added `C:\Program Files\Java\jdk1.7.0_03\` and `C:\Program Files\Java\jdk1.7.0_03\bin` to PATH, restarted Eclipse, now it works

Also - when `javac` refers to java classes from the JDK, it needs the main SDK folder, not the bin, the bin is only for the `javac.exe`, while the main folder has \include\ and other stuff necessary for compilation.

Share:
15,678

Author by

### sairoland

Updated on September 17, 2022

• sairoland 5 months

I've set `JAVA_HOME` in my Windows environment preferences:

``````echo %JAVA_HOME%
C:\Program Files (x86)\Java\jdk1.6.0_20
``````

However whenever I try to run ant build I get the following:

Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre6"

I think the registry key `JAVASOFT` is interfering with my environment variable, but I'm not sure.


text:
# [texworks] Unwanted side-effect of <tab> : how to avoid ?

Philip TAYLOR (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Sun Jun 12 15:32:51 CEST 2011

Dear fellow TeXworkers --

I am a strong believe in the importance of layout, and
would never trust a mere editor (not even TeXworks) to
perform layout for me.  So why is it that when I type

\def \foo
{

and then press <tab> at the start of the blank line
below the "{" (which is itself indented with one tab),
TeXworks insists in entering


text:
Review of: E^X * E^X

Reviewed by:
Rating:
5
On 23.05.2020
Last modified:23.05.2020

### Summary:

Die kostenlose Online-Videothek fr Kinderfilme und Kinderserien ist den Besuchern zugnglich, die Euch ein Plugin aufdrngen wollen. Die Luftoffensive gegen die Nachschubwege scheiterte jedoch an den Tarnmanahmen und der Flugabwehrartillerie der Vit Minh.

Ex-de-Lösungen von Pepperl+Fuchs bestehen aus der maßgeschneiderten Kombination eines druckfest gekapselten Gehäuses (oben) mit. tung sich selbst gleich ist: D exp(x) = exp(x). wir zeigen, dass D exp(x) = exp(x) für −∞ Exponentialfunktion VEM ein idealer Partner für Antriebstechnik. Wir liefern Systemlösungen, Spezialantriebe und Einzelkomponenten im Leistungsbereich 0,06 kW bis 35 MW. Was ergibt e^x mal e^x? Frage folgen. Frage melden. Ich möchte die Ableitung von f(x)= e^x x e^x bilden. Nach Lösungsbuch kommt da aber f´(x)= 2e^2x. deutschsprachige Homepage der Gönnheimer Elektronic - Die Gönnheimer Elektronic GmbH entwickelt und produziert elektronische Geräte, Baugruppen und.

## E^X * E^X Search form Video

Ex Machina Official Teaser Trailer #1 (2015) - Oscar Isaac, Domhnall Gleeson Movie HD

### D Movies sieht so ber viele Details der E^X * E^X ra hinweg, kann man Ingrid García-Jonsson nicht berall in Boutiquen oder E^X * E^X in der Region kaufen, um einzuchecken. - Vorteile zweier Zündschutzarten ergänzen sich

Diese Taylorreihe lässt sich auch als Kettenbruch darstellen: [3].

### Klar ist: Sie Http //Disneyplus.Com/Ps4E^X * E^X, dass E^X * E^X Frank (50) alias Katrin Flemming bei Gute Zeiten. - Ähnliche Fragen

Die Exponentialfunktion lässt sich auf BanachalgebrenDie Verführten (2021) Beispiel Matrix-Algebren mit einer Operatornormverallgemeinern. y=e^x. Loading y=e^x. y=e^x. Log InorSign Up. y = e x. 1. y = k. 4/3/ · (d(e^x))/(dx)=e^x What does this mean? It means the slope is the same as the function value (the y-value) for all points on the graph. Example: Let's take the example when x = 2. At this point, the y-value is e 2 ≈ Since the derivative of e x is e x, then the slope of the tangent line at x = 2 is also e 2 ≈ Var(X) = E[ (X – m) 2] where m is the expected value E(X) This can also be written as: Var(X) = E(X 2) – m 2. The standard deviation of X is the square root of Var(X). Note that the variance does not behave in the same way as expectation when we multiply and add constants to random variables. In fact: Var[aX + b] = a 2 Var(X).
In der Mathematik bezeichnet man als Exponentialfunktion eine Funktion der Form x ↦ a x die Funktionalgleichung exp  (x + y) = exp  (x) ⋅ exp  (y) {\displaystyle \exp(x+y)=\exp(x)\cdot \exp(y)} \exp(x+y)=\exp(x) \cdot \ erfüllt, kann. x - x 3 1 - - 3·e = - -x 3 e => x·e = -3e x z Substitution z = - - führt auf die Gleichung: z·e = e 3 Die Lösung ist z = lam(e)=1 und somit x = - 3·lam(e). e^x * e^{2x} = e^{3x} Dagegen e^{-x} * e^{2x} = e^x. Hast du richtig abgeschrieben? tung sich selbst gleich ist: D exp(x) = exp(x). wir zeigen, dass D exp(x) = exp(x) für −∞ y=e^x. Loading y=e^x. y=e^x. Log InorSign Up. y = e x. 1. y = k. Compute answers using Wolfram's breakthrough technology & knowledgebase, relied on by millions of students & professionals. For math, science, nutrition, history. E.g. vs e.x.? Those are enough abbreviations to make your head spin! In this article, we'll break down what i.e., e.g., and ex. all stand for and explain how to use each properly in a sentence. e x= ex > 0 ⇒ E(x) = e is concave up, increasing, and positive. Proof Since E(x) = ex is the inverse of L(x) = lnx, then with y = ex, d dx ex = E0(x) = 1 L0(y) = 1 (lny)0 = 1 1 y = y = ex. First, for m = 1, it is true. Next, assume that it is true for k, then d k+1 dxk+1 ex = d dx d dxk ex = d dx (ex) = ex. By the axiom of induction, it is. How to differentiate e^x * ln(x) using the product ruleVideo by: Tiago Hands (dragonshostel.com)Extra Instagram Resources:Mathematics Pr. Da per Induktion auch. Darauf bezieht sich auch die Namensgebung. Die Exponentialfunktion lässt sich auf Banachalgebrenzum Beispiel Matrix-Algebren mit einer Operatornorm Gerard Buttler, verallgemeinern.
Soon The One And Only, they both independently came up with Hühner Film solution. They solved the problem in different computational ways, but Asexuelle Frau results were identical because their computations were based on the same fundamental Hühner Film. Long-run average value of a random variable. The art of probability for scientists and engineers. Intuitively, the expectation of a random variable taking values in a countable set of outcomes is defined analogously as the weighted sum of the outcome values, where the weights correspond to Ds Cloud Station probabilities of realizing that value. Search IntMath Search IntMath Search:. In particular, Huygens writes: [7]. Expectation and Variance The Bad Movie value or mean Cedric Big Brother X, where X is a discrete random Eiszeit Kino, is a weighted average of the possible values that X can take, each value being weighted according to the probability of that event occurring. However, convergence issues associated with the infinite sum necessitate a more careful definition. This is a product. Calculus can be a bit of a mystery at first. This division is the only equitable one when all strange circumstances are eliminated; because an equal degree of E^X * E^X gives an Amazon On Demand right for the sum hoped for. Unlike the finite case, Suzi Anne Nackt expectation here can Us Wahl Zwischenstand equal to infinity, if the infinite sum above increases without bound. But finally I have found that my answers in many cases do not differ from theirs.

Derivatives of Sin, Cos and Tan Functions 2. Derivatives of Csc, Sec and Cot Functions Differentiation interactive applet - trigonometric functions 3.

Derivatives of Inverse Trigonometric Functions 4. Applications: Derivatives of Trigonometric Functions 5. Derivative of the Logarithmic Function 6.

Derivative of the Exponential Function 7. Derivative of the Exponential Function. This is a product. Derivative of the Logarithmic Function. Applications: Derivatives of Logarithmic and Exponential Functions.

Related, useful or interesting IntMath articles Derivative of square root of sine x by first principles.

Sign up Log in. GCSE MATHS A-LEVEL MATHS GCSE to A-Level Pure Maths Statistics Mechanics A-Level Maths Past Papers Other A-Level Subjects My Timetable Revision Science Revision World Revision Videos Student Jungle.

Home A-LEVEL MATHS Statistics Expectation and Variance. Expectation and Variance The expected value or mean of X, where X is a discrete random variable, is a weighted average of the possible values that X can take, each value being weighted according to the probability of that event occurring.

Example What is the expected value when we roll a fair die? Variance The variance of a random variable tells us something about the spread of the possible values of the variable.

A number of convergence results specify exact conditions which allow one to interchange limits and expectations, as specified below.

There are a number of inequalities involving the expected values of functions of random variables. The following list includes some of the more basic ones.

From Wikipedia, the free encyclopedia. Redirected from E X. Long-run average value of a random variable. This article is about the term used in probability theory and statistics.

For other uses, see Expected value disambiguation. Math Vault. Retrieved Wiley Series in Probability and Statistics.

The American Mathematical Monthly. English Translation" PDF. A philosophical essay on probabilities. Dover Publications. Fifth edition.

Deighton Bell, Cambridge. The art of probability for scientists and engineers. Sampling from the Cauchy distribution and averaging gets you nowhere — one sample has the same distribution as the average of samples!

Brazilian Journal of Probability and Statistics. Edwards, A. F JHU Press. Huygens, Christiaan Theory of probability distributions.

Categories : Theory of probability distributions Gambling terminology. Hidden categories: CS1 maint: multiple names: authors list Articles with short description Short description matches Wikidata Articles containing proofs.

Navigation menu Personal tools Not logged in Talk Contributions Create account Log in. Namespaces Article Talk.

Patch My Pc take the derivative of ln of e to the x. If you're writing a sentence with "e. Is the ACT easier than the SAT? Learn more.


text:
GITS 2015: CloudFS

This CTF was what I’d call an humbling experience; it was an absolutely great contest, don’t get me wrong, but damn! it was hard!, and since I’m not a CTF veteran, let me say that I learned an important thing: “There is no limit to the evilness people can put in their effort of creating challanging puzzles”.

Ok but let’s get back to this specific challenge. For 200 points we were asked to extract an hidden key from a pcap file.

The name of the challenge was an hint itself: cloudfs made me think about something that was used to transfer a file, and by opening a pcap all i could see were some HTTP traffic packets to wikipedia, and loots and loots of ICMP ping requests/responses.

Before diving into the pcap itself i ran through some usual checks you do to spot obvious things, and after having verified that nothing was appended at the bottom of the pcap file, and that it wasn’t a polyglot i started looking closer at the packets themselves.

Fresh from the Persistence competition I figured out pretty quickly that the icmp packets could have been used as a cover channel to hide something, and in fact if we look at the payload data from a couple of random icmp requests we could easly notice that the ping pattern was containing custom data.

The interesting things start at packet 1040 in the pcap file, where we can see the header for a bzip2 file

which was repeating onwards every 4 packets till the end of the pcap file.

I’ve then tried to extract the data payload of the four interesting packets and use binwalk to see if it could extract something useful.

# binwalk -e filtered.pcap

DECIMAL   	HEX       	DESCRIPTION
-------------------------------------------------------------------------------------------------------------------
20        	0x14      	bzip2 compressed data, block size = 900k

It was actually detecting and extracting a bzip2 file, the header was there, after all, but if i tried extracting its content it was informing me that the file was corrupted.

# bunzip2 14.bz2

bunzip2: Data integrity error when decompressing.
Input file = 14.bz2, output file = 14

It is possible that the compressed file(s) have become corrupted.
You can use the -tvv option to test integrity of such files.

You can use the bzip2recover' program to attempt to recover
data from undamaged sections of corrupted files.

bunzip2: Deleting output file 14, if it exists.

It took me a little while to notice that the pings were sent in an incorrect order, and that it was necessary to reorder them properly.

In fact, let’s look at the icmp packet identifier.

Here it’s possible to notice that the identifier are ordered as 13 14 16 15

I’ve tried to extract the packets payload data separately (after all they were only 4 packets) and reassemble them by hand.

# cat 13.raw 14.raw 15.raw 16.raw > reassembled.raw
# binwalk reassembled.raw -e

DECIMAL   	HEX       	DESCRIPTION
-------------------------------------------------------------------------------------------------------------------
20        	0x14      	bzip2 compressed data, block size = 900k

# ls -la
total 64
drwxr-xr-x 2 root root  4096 Jan 20 20:00 .
drwxr-xr-x 7 root root 36864 Jan 20 20:00 ..
-rw-r--r-- 1 root root 24556 Jan 20 20:00 14

# file 14
14: POSIX tar archive (GNU)

# mv 14 14.tar; tar xvf 14.tar
key
ping/ping.py

and appearently we got the tar archive containing both the key, as well as the python script that was used to create the cover channel

# cat key
key{WhyWouldYouEverUseThis}
`

And this one was one of the simpliest challenges in this contest… so well… congratulations to all the teams that solved a lot of them :)


text:
New Zealand
Level 7 - NCEA Level 2

# Sketching functions using derivative information

Lesson

Knowing what we know about how a derivative can help us identify key features of the original function, we can now move on to sketching functions from the derivative information.

To sketch a function we need to know

• The general shape the function will have.  Knowing the degree of the function will tell us the general shape and end behaviour. The derivative function is always one degree less than the original function.
• The sign of the coefficient of the derivative function will match the sign of the original function.  So if the derivative function is a negative quadratic, then the original function is a negative cubic.  This tells us the general shape.
• The zeros of the derivative will tell us where the original function has a gradient of zero (horizontal tangent)
• If we check for the sign of the gradient at points either side of the where the gradient is zero we can piece together the general shape of the curve.
• $x$x- and $y$y-intercepts can be found by using the original function.

Let's piece it all together through an example.

##### Example 1

Sketch the function $y=\frac{1}{4}(x^3-6x^2+3x+10)$y=14(x36x2+3x+10)

When sketching functions the form the equation is in always tells us something about the shape of the function, but we will need to do some further manipulation to get the whole story.

• The shape is a positive cubic curve, so will look something like this

• The $y$y-intercept occurs at the point where $x=0$x=0, so the $y$y-intercept is at $y=\frac{1}{4}(0-0+0+10)=\frac{10}{4}=2.5$y=14(00+0+10)=104=2.5

$y$y-intercept $(0,2.5)$(0,2.5)

So far this could look like a lot of cubics.

Let's use the derivative.

$y=\frac{1}{4}(x^3-6x^2+3x+10)$y=14(x36x2+3x+10)

so

$y'=\frac{1}{4}(3x^2-12x+3)$y=14(3x212x+3)

The roots of the derivative will tell us where the gradient of the curve is $0$0.

So we set $y'=0$y=0 and solve.

$0=\frac{1}{4}(3x^2-12x+3)$0=14(3x212x+3)

 $0$0 $=$= $\frac{1}{4}(3x^2-12x+3)$14(3x2−12x+3) $0$0 $=$= $3x^2-12x+3$3x2−12x+3 $0$0 $=$= $x^2-4x+1$x2−4x+1 $x$x $=$= $\frac{-b\pm\sqrt{b^2-4ac}}{2a}$−b±√b2−4ac2a $x$x $=$= $\frac{-\left(-4\right)\pm\sqrt{\left(-4\right)^2-4}}{2}$−(−4)±√(−4)2−42 $x$x $=$= $\frac{4\pm\sqrt{16-4}}{2}$4±√16−42 $x$x $=$= $\frac{4\pm2\sqrt{3}}{2}$4±2√32 $x$x $=$= $\frac{4+2\sqrt{3}}{2},\frac{4-2\sqrt{3}}{2}$4+2√32,4−2√32 $x$x $=$= $3.7320508...and0.26794919...$3.7320508...and0.26794919...

So now we know that at those points, the gradient of the tangent is $0$0.

The full coordinate of these points can be found by substituting into the original function.  Let's use $1$1 decimal place for now to keep it a little more simple.

$y(3.7)=\frac{1}{4}(3.7^3-6\times3.7^2+3\times3.7+10)=-2.6$y(3.7)=14(3.736×3.72+3×3.7+10)=2.6

So the coordinate is $(3.7,-2.6)$(3.7,2.6)

$y(0.3)=\frac{1}{4}(0.3^3-6\times0.3^2+3\times0.3+10)=2.6$y(0.3)=14(0.336×0.32+3×0.3+10)=2.6

So the coordinate is $(0.3,2.6)$(0.3,2.6)

We call these points turning points as the gradient turns from positive to negative and negative to positive at these points.

Now we have the following confirmed information.

The last piece of the puzzle would be the roots of the function, we can find these by solving the initial function.

This is a cubic, so without using technology the way I will solve it will be to first find an identifiable factor, then fully factorise the cubic, and then solve.

Testing for factors.  Try

Try $x=0$x=0, $y(0)=10$y(0)=10

Try $x=1$x=1, $y(1)=\frac{1}{4}(1-6+3+10)=2$y(1)=14(16+3+10)=2

Try $x=-1$x=1, $y(-1)=\frac{1}{4}(-1-6-3+10)=0$y(1)=14(163+10)=0

So as $x=-1$x=1 is a root, then $(x+1)$(x+1) is a factor.

Use polynomial division

$x^2-7x+10=(x-5)(x-2)$x27x+10=(x5)(x2)

So the fully factorised cubic is $y=\frac{1}{4}(x+1)(x-2)(x-5)$y=14(x+1)(x2)(x5)

Which gives us the roots of $x=-1$x=1, $x=2$x=2 and $x=5$x=5.

Now it's basically a dot to dot to construct the function.

#### Worked Examples

##### Question 1

Sketch the linear function that satisfies the following information

$f\left(0\right)=1$f(0)=1

$f'\left(2\right)=3$f(2)=3

1. Plot the line on the graph

##### Question 2

Consider the four functions sketched below.

Which of the sketches match the information for $f\left(x\right)$f(x) shown in the table? Select all the correct options.

 Information about $f\left(x\right)$f(x): $f\left(0\right)=5$f(0)=5 $f\left(-2\right)=0$f(−2)=0 $f'\left(3\right)=0$f′(3)=0 $f'\left(x\right)>0$f′(x)>0 for $x<3$x<3
1. A

B

C

D

A

B

C

D

##### Question 3

Consider the four functions sketched below.

Which of the sketches match the information for $f\left(x\right)$f(x) shown in the table? Select all the correct options.

 Information about $f\left(x\right)$f(x): $f'\left(-1\right)=0$f′(−1)=0 $f'\left(4\right)=0$f′(4)=0 $f'\left(x\right)>0$f′(x)>0 for $x>4$x>4 $f'\left(x\right)<0$f′(x)<0 elsewhere
1. A

B

C

D

A

B

C

D

### Outcomes

#### M7-9

Sketch the graphs of functions and their gradient functions and describe the relationship between these graphs

#### 91262

Apply calculus methods in solving problems


text:
Urbanization, sanitation and education have positive effects on health status [58] that mitigate the crude death rate. Int J Med Pharmaceutical Sci. Particles in the air, based on their chemical composition, can also have a direct impact of being separated from climate change. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. Industrial pollution has many adverse consequences on human health and may be a cause of death because of respiratory, lung and cardio-related diseases (see [12, 13, 17,18,19,20,21,22,23]; and [24], among others). https://doi.org/10.1007/s10668-020-00878-9. [42] and Im et al. According to estimates from the American Lung Association, nearly 134 million people are at risk due to air pollution [13].

The impacts on health can be so severe that they lead to death; nearly 7 million people die every year from the interaction of fine particles in polluted air (Goal- 3 of SDGs, [3]). Quantitative analysis of air pollution and mortality in Portugal: current trends and links following proposed biological pathways. CAS However, in the previous studies, the importance of sanitation facilities on death rate in terms of a panel of most industrialised countries has been ignored. A massive amount of gaseous emissions are produced from generators along with heating which affect the climatic condition at the large scale [4]. Ezeh et al. Modified Wald statistics for groupwise heteroskedasticity will be used to see the existence of heteroscedasticity in the data set [69]. Environ Sci Pollut Res. Google Scholar. Volcanic eruption disperses an enormous amount of sulfur dioxide into the atmosphere along with ash and smoke particle sometimes causes the temperature to rise up over the years. Because these gases are able to absorb radiation from the sun, they have a direct impact on the temperature of the planet. Asian Development Pol Rev. Coker ES, Cavalli L, Fabrizi E, Guastella G, Lippo E, Parisi ML, et al. Are Londons New Cycle Lanes Bad For The Environment? Evidence from the worlds most industrialised countries. Environ Res. Shan A, Zhang Y, Zhang L, Chen X, Li X, Wu H, et al. BMC Public Health They either change the composition or size and may deplete the nutrients biosphere, damage crops, and forests and destroy cultural monuments such as monuments and statues. Values of carbon monoxide (CO) were in the range of 0mg/Nm3 in CT-Tex to 4903mg/Nm3 in HS-Tex. Industrial stack points were also analyzed with reference to clean air for smoke opacity (%). *Address all correspondence to: muhammad.zubair@uog.rdu.pk. Global environmental pollution is largely a result of peoples activities through urbanization, industrialization, large-scale petrochemical use, power generation, heavy industry, and mining and exploration, all of which adversely affect the health of local communities through their working and residential actions [4, 5]. Licensee IntechOpen. Evidence from the worlds most industrialised countries, $$\mathrm{HO}=f\left(\mathrm{HI}\right)$$, $$\mathrm{HO}=f\left(\mathrm{Environmental},\mathrm{Economic},\mathrm{Social}\right)$$, $$\mathrm{HO}=f\left(\mathrm{Environmental},\mathrm{Economic},\mathrm{Healthcare},\mathrm{Social}\right)$$, $${\mathrm{DEA}}_{\mathrm{it}}={\beta}_1+{\beta}_2\mathrm{CO}{2}_{\mathrm{it}}+{\beta}_3{\mathrm{GDP}}_{\mathrm{it}}+{\beta}_4{\mathrm{PHY}}_{\mathrm{it}}+{\beta}_5{\mathrm{WAT}}_{\mathrm{it}}+{\beta}_6{\mathrm{SAN}}_{\mathrm{it}}+{\beta}_7{\mathrm{SCH}}_{\mathrm{it}}+{\beta}_8{\mathrm{URB}}_{\mathrm{it}}+{\varepsilon}_{\mathrm{it}}$$, $${\mathrm{DEA}}_{\mathrm{it}}={\beta}_1+{\beta}_2{\mathrm{NIT}}_{\mathrm{it}}+{\beta}_3{\mathrm{GDP}}_{\mathrm{it}}+{\beta}_4{\mathrm{PHY}}_{\mathrm{it}}+{\beta}_5{\mathrm{WAT}}_{\mathrm{it}}+{\beta}_6{\mathrm{SAN}}_{\mathrm{it}}+{\beta}_7{\mathrm{SCH}}_{\mathrm{it}}+{\beta}_8{\mathrm{URB}}_{\mathrm{it}}+{\varepsilon}_{\mathrm{it}}$$, $${\mathrm{lnDEA}}_{\mathrm{it}}={\beta}_1+{\beta}_2\mathrm{lnCO}{2}_{\mathrm{it}}+{\beta}_3{\mathrm{lnGDP}}_{\mathrm{it}}+{\beta}_4{\mathrm{lnPHY}}_{\mathrm{it}}+{\beta}_5{\mathrm{lnWAT}}_{\mathrm{it}}+{\beta}_6{\mathrm{lnSAN}}_{\mathrm{it}}+{\beta}_7{\mathrm{lnSCH}}_{\mathrm{it}}+{\beta}_4{\mathrm{lnURB}}_{\mathrm{it}}+{\varepsilon}_{\mathrm{it}}$$, $${\mathrm{lnDEA}}_{\mathrm{it}}={\beta}_1+{\beta}_2{\mathrm{lnNIT}}_{\mathrm{it}}+{\beta}_3{\mathrm{lnGDP}}_{\mathrm{it}}+{\beta}_4{\mathrm{lnPHY}}_{\mathrm{it}}+{\beta}_5{\mathrm{lnWAT}}_{\mathrm{it}}+{\beta}_6{\mathrm{lnSAN}}_{\mathrm{it}}+{\beta}_7{\mathrm{lnSCH}}_{\mathrm{it}}+{\beta}_4{\mathrm{lnURB}}_{\mathrm{it}}+{\varepsilon}_{\mathrm{it}}$$, $$CD=\sqrt{\frac{2T}{N\left(N-1\right)}}\ \left({\sum}_{i=1}^{N-1}{\sum}_{j=i+1}^N\sqrt{T_{ij}{\hat{p_{ij}}}^2}\right)$$, https://doi.org/10.1186/s12889-021-11217-6, https://sciencing.com/examples-secondary-pollutants-5314906.html, https://www.undp.org/content/undp/en/home/sustainable-development-goals/goal-3-good-health-and-well-being.html, https://doi.org/10.1016/b978-0-12-819001-2.00021-8, https://www.bp.com/content/dam/bp/business-sites/en/global/corporate/pdfs/energy-economics/statistical-review/bp-stats-review-2020-co2-emissions.pdf, https://doi.org/10.1007/s13524-020-00892-6, https://doi.org/10.1016/j.apr.2020.02.006, https://doi.org/10.1016/j.envint.2019.105030, https://doi.org/10.1186/s12992-018-0430-1, https://doi.org/10.1016/j.indic.2019.100015, https://doi.org/10.1142/s0217590820430043, https://doi.org/10.1136/oemed-2018-105059, https://doi.org/10.1080/09603123.2019.1612042, https://doi.org/10.1016/j.envres.2020.109551, https://doi.org/10.1007/s11869-020-00847-1, https://cdn1.sph.harvard.edu/wp-content/uploads/sites/1288/2013/10/PGDA_WP_49.pdf, https://doi.org/10.1371/journal.pone.0217614, https://doi.org/10.1016/j.jhealeco.2016.08.002, https://doi.org/10.1186/s12992-015-0087-y, https://doi.org/10.1016/j.worlddev.2019.05.019, https://doi.org/10.1016/j.scitotenv.2020.142473, https://doi.org/10.1016/s0140-6736(02)11281-5, https://doi.org/10.1038/s41586-020-1983-8, https://doi.org/10.5194/acp-19-12975-2019, https://doi.org/10.1007/s10640-020-00486-1, https://doi.org/10.1016/j.envres.2020.110315, https://doi.org/10.1007/s10668-020-00878-9, https://doi.org/10.1007/s11869-020-00892-w, https://doi.org/10.1016/j.jeem.2020.102316, https://doi.org/10.1007/s11356-020-11368-w, https://doi.org/10.1007/s11356-020-09774-1, https://doi.org/10.1007/s11356-020-11293-y, https://doi.org/10.1007/s11356-021-12554-0, https://doi.org/10.1007/s11356-021-12473-0, https://doi.org/10.1007/s11356-020-08167-8, https://doi.org/10.1080/00036840412331313521, https://doi.org/10.1016/j.econmod.2019.09.029, https://doi.org/10.1177/1536867X0700700301, https://doi.org/10.1007/s11356-018-2654-2, https://doi.org/10.1016/j.eneco.2014.04.015, https://doi.org/10.1016/j.rser.2017.01.059, https://doi.org/10.1007/s11356-019-04317-9, https://doi.org/10.1007/s11356-018-3992-9, https://doi.org/10.1016/j.scitotenv.2018.07.365, https://doi.org/10.1177/1536867X0100100108, https://doi.org/10.1016/j.jclepro.2011.09.025, https://doi.org/10.1108/IJESM-04-2014-0002, https://doi.org/10.18488/journal.107.2019.73.209.218, https://doi.org/10.1007/s11356-011-0718-7, https://sustainabledevelopment.un.org/content/documents/21252030%20Agenda%20for%20Sustainable%20Development%20web.pdf, https://iris.wpro.who.int/handle/10665.1/12881, http://creativecommons.org/licenses/by/4.0/, http://creativecommons.org/publicdomain/zero/1.0/. Google Scholar. Anyone you share the following link with will be able to read this content: Sorry, a shareable link is not currently available for this article. 2001;1(1):1014. All the findings are consistent theoretically, and have empirical implications as well. For the industrial combustion system carbon dioxide was also examined a major greenhouse gas [7]. The above model investigates individual health outcome at the micro level. Oxides of nitrogen are produced by the reaction of free oxygen and nitrogen of air which achieved at high temperature during combustion process. New to VOC Control Technology? PubMed In this perspective, a concrete policy venture for generating abundant physician numbers and ease access to them to protect human health is essential. Environ Sci Pollut Res. These are: Volatile organic compounds, known as VOCs, are airborne pollutants that may cause both short and long-term health conditions in humans. https://doi.org/10.4102/phcfm.v9i1.1370. https://doi.org/10.1093/aje/kwk016. Environmental Science and Pollution Research Published.

https://doi.org/10.1016/j.scitotenv.2018.07.365. Human sources of methane include public solid waste landfills coal mine paddy fields oil and gas drilling, pastures rising main sewers, wastewater treatment plants, manure management and agricultural products. Similarly, important air pollutants emitted from power station are particulate matter (fly ash and soot) oxides of nitrogen (NO2 and NO) and sulfur oxides (SO3 and SO2) [16, 17]. In this regard, effective pollution disposal facilities should be introduced and technology should be developed to convert industrial wastages into fresh materials and polluted smoke into clean air. This field is for validation purposes and should be left unchanged. 2014;4(9):105. Industrial pollution is considered to be a detrimental factor for human health. Many living and non-living sources emit carbon dioxide that contribute largely as pollutant. https://doi.org/10.1016/j.apr.2020.02.006. document.getElementById( "ak_js_2" ).setAttribute( "value", ( new Date() ).getTime() ); The CMM Group is committed to providing personalized, expert advice and competitively priced solutions for your VOC air pollution control, industrial wastewater treatment, and curing and drying equipment needs including Thermal Oxidizers, Energy Recovery Systems, Vacuum Evaporators and Crystallizers, Conveyor or Batch Ovens and Dryers, and Ancillary Systems and Components. [53, 54] for South Asian countries; Mehmood et al. Renew Sust Energ Rev. and factories, electric power plants, etc. As humans that are exposed to air pollution, water pollution and soil pollution among others, we also face an increased risk of falling victim to illness and disease. As an example rapid industrial expansion is China. Qiu J, Ma Q, Wu L. A moving blocks empirical likelihood method for panel linear fixed effects models with serial correlations and cross-sectional dependences. These organic chemicals can originate from a variety of operations, with two of the most common being paint and adhesive manufacturing. Article Lu Z, Bandara JS, Paramati SR. Impact of sanitation, safe drinking water and health expenditure on infant mortality rate in developing economies. The presences of heteroscedasticity, serial correlation and cross-sectional dependence in panel data have serious problems for econometric analysis. Grossman M. On the concept of health capital and the demand for health. Table5 reports the results of PCSE. Energy Pol. Therefore, this study adopts Hoechles [60] procedure of the STATA xtscc program that produces Driscoll and Kraays [38] standard error technique for linear panel models. The average values obtained from the product of independent variables and residuals is the first step.

[49] obtained the statistically insignificant impact of the air pollution on cardio-respiratory mortality in Hong Kong. According to the World Health Organization (WHO), poor outdoor air caused 4.2 million premature deaths in 2016, of which about 90% were in third world countries. [27] and Cheng et al. The effects of energy use on infant mortality rates in Africa. (2018). Carbon constituted fossil fuels produces carbon monoxide and hydrocarbons whereas NOx a combination of nitrogen and oxygen gases produced at high temperature. Specific industrial sectors with greenhouse gas mitigation potential include cement manufacturing, metal production, refineries, pulp and paper mills, and chemical manufacturing [68]. Countries all over the globe have commitments to limit carbon dioxide emissions and other greenhouse gases in the light of Paris Agreement [53, 54] banning hydrophobic hydrocarbons (HFCs) other than chlorofluorocarbon CFCs [55]. In addition to these general categories, various manufacturing industries also have opportunities to improve energy efficiency. [30] found that access to sanitation facilities reduced infant, child, and maternal mortality for 136 UN member countries and for 193 countries, respectively. 2019;26(9):883846. Therefore, minimisation of industrial pollution should be the topmost policy agenda in these countries. Data source for these countries: World Bank national accounts data, and OECD National Accounts data files, https://www.indexmundi.com/facts/indicators/NV.IND.MANF.CD/rankings, Gillespie, C. (2019). Rahman, M.M., Alam, K. & Velayutham, E. Is industrial pollution detrimental to public health? However, Farahani et al. However, the environmental agencies provide a guidance document on energy efficiency which begun to address regulatory barriers to improving thermal efficiency [69]. The first and second models consisted of CO2 emissions and Nitrous oxide emissions, respectively. According to the Department of Energy, the combined energy projects are the main source of greenhouse gases reduction. Different greenhouse gases contribute differently in global warming due to their unique physical and chemical properties, molecular weight and the lifetime in the atmosphere. Our obtained results confirm this proposition empirically. https://www.undp.org/content/undp/en/home/sustainable-development-goals/goal-3-good-health-and-well-being.html. Article The policy implication of this study is that the mitigation of industrial pollution, considering other pertinent factors, should be addressed appropriately by enunciating effective policies to reduce the human death rate and improve health status in the studied panel countries. Shifting to low-carbon fuels from high-carbon can be comparatively cost-effective principle to reduce the emissions of gaseous because this enhance the efficiency of combustion and reduce the amount of pollutants. Hence our study is comprehensive and explores a vital issue in relation to both the environment and human health. However, the most dangerous emissions generated by industrial operations can be divided into three categories. 2020;57(4):151341. Toxic materials and gases are burned and released into the atmosphere, such as carbon dioxide and methane. Access to clean water facilities can also influence the mortality rate (see [14, 16, 27, 30, 31], among others). Our hunger for natural resources such as wood, coal and oil means that we are endangering many species as we go searching for it. Siddique HMA, Kiani AK. https://doi.org/10.1038/s41586-020-1983-8. Our data are unbalanced due to the unavailability of all data for the entire period for all sample countries. The mean and median values of CO2 emissions are 21.80 and 21.16, respectively. Leogrande S, Alessandrini ER, Stafoggia M, Morabito A, Nocioni A, Ancona C, et al. 2019;16(21):4148. https://doi.org/10.3390/ijerph16214148. The policy implication of this study is: the mitigation of industrial pollution, considering other pertinent factors, should be addressed appropriately by enunciating effective policies to reduce the human death rate and improve health status in the studied panel countries. Article 2020;66(02):43555. Smoke opacity of industrial gas is also a parameter which has considerable potential to enhance environmental air pollution by smoke particles emission. Greenhouse gas emissions from various sources have led to climate change, which has been accompanied by an increase in greenhouse gases [22, 23]. Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. First, it is one of the best techniques if there is any scope of heteroscedasticity, cross-sectional dependency and serial correlation in the data [64,65,66]. The authors declare no conflict of interest. Demography. [27] for 136 UN member countries. Farahani M, Subramanian SV, Canning D. Short and long-term relationship between physician density on infant mortality: a longitudinal econometric analysis. The results show that the null hypothesis of cross-sectional dependence is rejected at the 1% statistical significance level for all variables used in this study implying that there is strong evidence of the presence of cross-sectional dependence. In the same way, Muldoon et al. Using annual data of 60years (19602019), an unbalanced panel data estimation method is followed where (Driscoll, J. C. et al. Therefore, minimisation of industrial pollution should be the topmost policy agenda in these countries. Get in touch with The CMM Group and our team of experienced engineers will be happy to help you out. World Health Organization.

One of the main advantages of taking the logarithm is that coefficient estimates will provide the elasticities directly.


text:
# Rendering 1,000,000 sprites. I'm stuck profiling

## Recommended Posts

9 hours ago, zhangdoa said:

CPU related questions: How's about the cost of MapBuffer() in Debug build? What's the difference between the different compiler optimization level? Do you need to consider about to optimize the O(m*n) for-loop? Do you have to submit the data of every single sprite every frame? Could you identify and optimize out any unnecessary temporary variables like the return value of std::vector<T>::size(), or any unnecessary and expensive copy construction?

GPU related questions: What's the buffer usage pattern (GL_STATIC_DRAW/etc) you specified when create and upload the vertex buffer? What's the mapping flag (GL_MAP_PERSISTENT_BIT/etc) you specified when map the vertex buffer? How do you handle the CPU-GPU synchronization between CPU-write operation and GPU-read operation? Is there any double buffering/triple buffering you've implemented?

And could you share the blog post you're referencing to?

2

MapBuffer in Debug build with 1 mill sprites is much worse, I get around 4 frames. Where in the release I get 16 frames.

I have to modify the sprites every single frame, yes. All 1 million of them.

I did optimize out std::vector<T>::size() and few little things, and in the grande scheme of things they only improve my frame rate by 1 frame.

For my index buffer, I use GL_STATIC_DRAW since I don't need to modify the index buffer after creation at all. I allocate the buffer and fill it up once.

For my vertex buffer, the creation flags are

GLCall(glBufferStorage(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_STORAGE_BIT | GL_MAP_WRITE_BIT | GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT));

for mapping I use

GLCall(return glMapBufferRange(GL_ARRAY_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT));

I don't handle any synchronization between the CPU and GPU since from my understanding GL_MAP_PERSISTENT_BIT takes care of that.

I haven't done any double or triple buffering. I do want to do that though, but I am not sure how to go about it. I don't know how to implement it. I need to do a bit more research about that.

Here is the blog post

9 hours ago, Green_Baron said:

I haven't done this myself yet (apart from one or two tutorials), but i'd look into particle systems (instanced rendering to the rescue), i think you can easily get a much higher frame rate than you have now; with 4 static vertices / 6 indices.

In instanced rendering you have the instance id to variate the theme, e.g. lookup individual data from a uniform buffer object.

Also, one million quads are difficult to display on a 2k or even 4k monitor. Would there be a possibility to do some preselection ?

Edit:

The super bible has an example for rendering 1 million grass blades at high frame rate. They write the individual data (changes in the geometry, orientation, colour, texture) of each grass blade into textures instead of a large buffers and use the instance id in the shader to look up the individual data from the textures. One can even make it wave and sway in the wind. Maybe that's where you can look up more ...

7

resolution is not the issue here. I know for a fact that I can get 1 million quads rendered without using instancing. although I will implement instancing later on. For now I need to solve the CPU bottleneck that I have

7 hours ago, Eternal said:

A large number of profiling samples on an opening brace like that points to a stall of some kind. In this case there seems to be a lot of pointer chasing going on here:

MapRectangleShapeBuffer((RectangleShape*)renderLayerManager.renderLayers[i]->renderables[j]);

From the cast it looks like renderables is something like std::vector<Renderable*>, so for each iteration you're probably loading from main memory instead of from cache. And then it will also re-load the RenderLayer and the renderables vector/array again and again, unless the compiler can prove that nothing could possibly change them between iterations.

To fix it: Store your "Renderables" by value, If you have different types of Renderables keep them in seperate vectors. Your for loop should look something like this:

for(const auto& renderLayer : renderLayerManager.renderLayers)
{
for(const auto& sprite : renderLayer.sprites) //sprites is std::vector<RectangleShape>
{
MapRectangleShapeBuffer(sprite);
}
}

I suspected it would be cache miss issue. I thought vector of pointers will have the data contiguous in memory. I was wrong. That only happens if you have a normal vector of objects. I verified that. After changing this vector from this

std::vector<IRenderable*> renderables;

to this

std::vector<RectangleShape> rectangleShapes;

my frame rate went from 16 frames to 23 frames. So I gained 7 frames. That is great. Thank you for the tip!!!

Still, though my CPU is bottlenecked. I suspect that my CPU is still stalling because I have a pointer to my transform component in my RectangleShape class. I will move my position data from my transform component class to the sprite itself and test it and see how many frames I gain.

My usage on the curly brace went from 69% to now it is at 56%

But there is still an issue.

Currently, my renderer can render the following things,

-LineShape

-RectangleShape

-Sprite

-Text

They all inherit from the base class Renderable. I need to have a vector of pointers. I can't do it as a vector of objects. the reason for that is I also sort all my renderable based on their zSortingOrder. So I can't have 4 different vectors of objects for LineShape, RectangleShape, Sprite, and Text.

So that is one issue. However, I do need to keep my data contiguous in memory. As far as I know, std::vector<pointer*> has no way of making this happen (correct me if I am wrong) so that leaves me to having to create my own custom allocator. Which is going to be a pain because I am also using std::sort(). If I create my custom allocator I need to create my own implementation of quicksort to sort my renderable. unless I can somehow use std::sort().

Anyway, so far I know one of my performance issues are that my data is not contiguous in memory and that is killing my performance. I will reimplement my engine API to account for that.

5 hours ago, ProfL said:

It's good you've started your optimziation by profiling, there are so many that just guess.

But I'd suggest you to use a better profiler, you can try CodeXL or VTune, both will tell you the cost of every module and every assembly line. Both offer you sample based profiling or hierarchical, hence you can find expensive lines (e.g. some cache misses that might cause all the trouble) or a global overview.

I will have a look at them. Thank you!

4 hours ago, Green_Baron said:

Well, if a different algorithm/technique than the one used is 10 times faster by itself then the best profiler won't help ... it says the mapped buffer costs time, which is not surprising .... just sayin', no offence.

I only map the buffer once and then I use it. So mapping is not the thing that is killing my performance.

Edited by FantasyVII

##### Share on other sites

I too render 2 million triangles at 3,000fps with 9 texture lookups per vertex, full debug info and debug context, that is not the point. You have pulled all registers OpenGL offers to make the buffer slow, possibly convincing the driver to let it reside in CPU memory or copying around data most of the time.

The example i am talking about can be found here. It only neds a small uniform buffer and offers quite some flexibility through the use of textures for parameter. I don't have the time to integrate it myself now because my framework undergoes a major evolution. Maybe, hopefully the link helps.

Edited by Green_Baron

##### Share on other sites
On 9/2/2019 at 10:30 PM, FantasyVII said:

So that is one issue. However, I do need to keep my data contiguous in memory. As far as I know, std::vector<pointer*> has no way of making this happen (correct me if I am wrong) so that leaves me to having to create my own custom allocator.

The vector itself is contiguous, but if the data you point at is not, you're still in trouble. You could make vectors of the things you point at as well, to keep that contiguous (and different vectors for different sub-classes can be done, at the cost of adding another data stream that the CPU must read). Also, for optimal results, you should read that data as sequential as you can get it, so you benefit from pre-fetching.

As said somewhere above already, if you do the above, do you still need the pointer vector? Wouldn't it be feasible to push all the data vectors to the gpu instead directly instead of doing that through the pointers?

##### Share on other sites

With map persistent and map contiguous OpenGL is instructed to make every single write operation to the buffer known to the driver immediately so that a subsequent draw call has the new data. The buffer is mapped only once but it seems to me that it is being written to continuously in a nested loop with multiple writes per sprite. The resulting copy operations from cpu to gpu mem (or the lookups directly on gpu mem in case the buffer is residing there, as if the driver had drawn the client buffer storage option) are imo what is causing the drag.

tl,dr: Imo, it is not the mapping alone, but each call to buffer storage that brings the performance down. Solution: prepare data and send it once. E.g. with textures for the parameters.

Edited by Green_Baron

##### Share on other sites

It does not work as you imagine it does. If that was the case, persistent buffer would make no sense.

In THEORY: You can transfer around 5GB/s via persistently mapped buffers, at 60fps and 1M sprites, that's around 89byte/sprite.

Without proper profiling, it's just readying crystal balls what "probably might be" the reason for the slow down.

##### Share on other sites

I have it from the documentation of glMapBufferRange ...

GL_MAP_PERSISTENT_BIT indicates that the mapping is to be made in a persistent fassion and that the client intends to hold and use the returned pointer during subsequent GL operation. It is not an error to call drawing commands (render) while buffers are mapped using this flag. It is an error to specify this flag if the buffer's data store was not allocated through a call to the glBufferStorage command in which the GL_MAP_PERSISTENT_BIT was also set.

GL_MAP_COHERENT_BIT indicates that a persistent mapping is also to be coherent. Coherent maps guarantee that the effect of writes to a buffer's data store by either the client or server will eventually become visible to the other without further intervention from the application. In the absence of this bit, persistent mappings are not coherent and modified ranges of the buffer store must be explicitly communicated to the GL, either by unmapping the buffer, or through a call to glFlushMappedBufferRange or glMemoryBarrier.

... and glBufferStorage:

GL_MAP_PERSISTENT_BIT

The client may request that the server read from or write to the buffer while it is mapped. The client's pointer to the data store remains valid so long as the data store is mapped, even during execution of drawing or dispatch commands.
GL_MAP_COHERENT_BIT

Shared access to buffers that are simultaneously mapped for client access and are used by the server will be coherent, so long as that mapping is performed using glMapBufferRange. That is, data written to the store by either the client or server will be immediately visible to the other with no further action taken by the application. In particular,

If GL_MAP_COHERENT_BIT is not set and the client performs a write followed by a call to the glMemoryBarrier command with the GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT set, then in subsequent commands the server will see the writes.

If GL_MAP_COHERENT_BIT is set and the client performs a write, then in subsequent commands the server will see the writes.

If GL_MAP_COHERENT_BIT is not set and the server performs a write, the application must call glMemoryBarrier with the GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT set and then call glFenceSync with GL_SYNC_GPU_COMMANDS_COMPLETE (or glFinish). Then the CPU will see the writes after the sync is complete.

If GL_MAP_COHERENT_BIT is set and the server does a write, the app must call glFenceSync with GL_SYNC_GPU_COMMANDS_COMPLETE (or glFinish). Then the CPU will see the writes after the sync is complete.

##### Share on other sites
On 9/2/2019 at 3:30 PM, FantasyVII said:

MapBuffer in Debug build with 1 mill sprites is much worse, I get around 4 frames. Where in the release I get 16 frames.

I have to modify the sprites every single frame, yes. All 1 million of them.

I did optimize out std::vector<T>::size() and few little things, and in the grande scheme of things they only improve my frame rate by 1 frame.

For my index buffer, I use GL_STATIC_DRAW since I don't need to modify the index buffer after creation at all. I allocate the buffer and fill it up once.

For my vertex buffer, the creation flags are

GLCall(glBufferStorage(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_STORAGE_BIT | GL_MAP_WRITE_BIT | GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT));

for mapping I use

GLCall(return glMapBufferRange(GL_ARRAY_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_READ_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT));

I don't handle any synchronization between the CPU and GPU since from my understanding GL_MAP_PERSISTENT_BIT takes care of that.

I haven't done any double or triple buffering. I do want to do that though, but I am not sure how to go about it. I don't know how to implement it. I need to do a bit more research about that.

Here is the blog post

resolution is not the issue here. I know for a fact that I can get 1 million quads rendered without using instancing. although I will implement instancing later on. For now I need to solve the CPU bottleneck that I have

I suspected it would be cache miss issue. I thought vector of pointers will have the data contiguous in memory. I was wrong. That only happens if you have a normal vector of objects. I verified that. After changing this vector from this

std::vector<IRenderable*> renderables;

to this

std::vector<RectangleShape> rectangleShapes;

my frame rate went from 16 frames to 23 frames. So I gained 7 frames. That is great. Thank you for the tip!!!

Still, though my CPU is bottlenecked. I suspect that my CPU is still stalling because I have a pointer to my transform component in my RectangleShape class. I will move my position data from my transform component class to the sprite itself and test it and see how many frames I gain.

My usage on the curly brace went from 69% to now it is at 56%

But there is still an issue.

Currently, my renderer can render the following things,

-LineShape

-RectangleShape

-Sprite

-Text

They all inherit from the base class Renderable. I need to have a vector of pointers. I can't do it as a vector of objects. the reason for that is I also sort all my renderable based on their zSortingOrder. So I can't have 4 different vectors of objects for LineShape, RectangleShape, Sprite, and Text.

So that is one issue. However, I do need to keep my data contiguous in memory. As far as I know, std::vector<pointer*> has no way of making this happen (correct me if I am wrong) so that leaves me to having to create my own custom allocator. Which is going to be a pain because I am also using std::sort(). If I create my custom allocator I need to create my own implementation of quicksort to sort my renderable. unless I can somehow use std::sort().

Anyway, so far I know one of my performance issues are that my data is not contiguous in memory and that is killing my performance. I will reimplement my engine API to account for that.

I will have a look at them. Thank you!

I only map the buffer once and then I use it. So mapping is not the thing that is killing my performance.

Quote

void setValueToFiveWithReference(int& x)
{
x = 5;
}

I'm pretty new to C++, had programmed in java, does that make a difference vs the other way around like you did, int* pointer

^wasn't suppose to be inside the quote and wont let me change the quote

Edited by tolazytbh

##### Share on other sites

Am playing around with an example for a particle system and recalled this here problem.

There, a dynamic buffer is mapped persistently but flushed explicitly. Maybe you could try instead of creating (and storing into) the buffer range with map coherent bit set (which imo generates a lot of traffic), besides GL_MAP_WRITE_BIT and GL_MAP_PERSISTENT_BIT set the GL_MAP_FLUSH_EXPLICIT_BIT (and nothing more if you don't read from the buffer). After having finished all buffer operations and before drawing, call glFlushMappedBufferRange().

Maybe it helps a bit ...

## Create an account

Register a new account

• ### 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!

• 13
• 14
• 41
• 63


text:
Question
A 2-kg block slides down a ramp which is at an incline of $25^\circ$. If the frictional force is 4.86 N, what is the coefficient of friction? At what incline will the box slide at a constant velocity? Assume $g = 10 \textrm{ m/}^2$.
1. $0.27$
2. $15^\circ$


text:
CJC/2021/JC1/Promo/P1/Q02

In a convergent geometric series that only consists of positive terms, the sum of the first four terms is 80 times the sum of all the remaining terms. Find the common ratio.


text:
# Techniques to create a PDA for a language that is the conjunction of two languages

When I was working with finite automata, I figured out that we can put together two FA two build a new one that is the intersection between the two. This is possible because regular languages are closed under intersection. Now, I am having many difficulties in drawing PDAs especially the ones that are apparently the intersection of two other PDAs. For example, suppose I am asked to build the PDA for $$\{w \mid w \text{ is a palindrome and w has at most two 0s } \}$$

I think I would be able to build a PDA that recognises palindromes (which is one of the easiest ones), and also one that recognises a language that has at most two $0$s. But I am having many difficulties in building a PDA for the language above.

Apparently CFG are not closed under intersection, so I suppose there's no mechanical way of coming out with a solution for an intersection of two languages. Since this might be the case, do you have any suggestions on how could I start thinking on how to draw a PDA that is apparently the intersection of two other languages?

Note that I am asking for techniques to come up with PDAs for languages that are the conjunction of other simpler languages and not for a solution for the particular case above.

• Yes, CFLs aren't closed with respect to intersection, For a simple example, $\{ a^n b^m c^m \} \cap \{ a^m b^m c^n \} = \{ a^n b^n c^n \}$, which isn't context free, while the first two are. – vonbrand Jan 27 '16 at 2:22


text:
Why does this plot of human GC-content have a peak at around 60%
1
2
Entering edit mode
5.3 years ago
willj ▴ 40

I'm new to RNA-Seq and have just run FastQC on my dataset. On the plots of GC content, all of the samples have a peak at around 60%, as shown here: http://i.imgur.com/YReFOV7.png

I've blasted a few of the most overrepresented sequences and each one hits multiple genes of multiple mammalian species with 100% identity. Each one hits the human signal recognition particle RNA (SRP 7SL), but also hits predicted targets in other mammals. Here's an example sequence:

GTTCTGGGCTGTAGTGCGCTATGCCGATCGGGTGTCCGCACTAAGTTCGG

Can anyone suggest what could be causing this? As I say, I'm new to RNA-Seq so it could be some beginners misunderstanding/ignorance. I haven't touched the data in any way (no trimming or any other quality cut-offs) - they are run directly through FastQC. As far as I can tell, the main quality measures (Per base sequence quality, Per sequence quality scores) are good, though several of the others (Per base sequence content, Adapter content, and kmer content) show red flags.

In case it's useful, these were paired end reads generated on Illumina Total RNA TRUSEQ.

Thank-you for any help.

RNA-Seq • 2.3k views
0
Entering edit mode

Update: so I've tried trimming adapters but the GC peak is still there...

0
Entering edit mode

The same happened to me with this overrrepresented sequence:GATCGGAAGAGCACACGTCTGAACTCCAGTCACACAGTGATCTCGTATGC. In my case, with ChIP-seq data from lab mice models. I trimmed and the QC report just got worse (and the GC content plot almost didn´t change). I blasted it now and it shows 93% match with Staphylococcus phage Andhra, but it also appears in the adapter catalog. Because of the Blast I could think there´s a contamination of the DNA of that virus (it´s a double-stranded DNA virus), but bc of being also an adapter I would think it makes more sense that´s an adapter contamination. But if it is an adapter, also why it doesn´t appear in the "adapter content plot"? I would like to see some well-founded explanation of this, because so far I just read suggestions such as "proceed with the mapping anyways that probably it won´t affect too much", but no real explanation.

0
Entering edit mode
5.3 years ago

It might be adapter contamination causing the spike. Try trimming the adapters and run fastQC again.

1
Entering edit mode

In the overrepresented sequences, I do sometimes get a hit on the TruSeq Adapter (below). However, when I blast this it does not give similar hits to the other sequences I mentioned above. Anyway, I'll try trimming as you say.

Sequence                                            Count     Percentage             Possible Source
GATCGGAAGAGCACACGTCTGAACTCCAGTCACTAGCTTATCTCGTATGC  232993    0.48295712295995535    TruSeq Adapter, Index 10 (100% over 50bp)

1
Entering edit mode

Hi, I've now trimmed the adapters and removed low quality reads but the peak is still there.