text:
Now showing items 24430-24449 of 64556

• #### INTERPRETING ELECTRON TEMPERATURE CHANGES IN THE LOWER IONOSPHERE

(1981)
The electron temperature changes due to 3, 5 and 430 MHz radio wave heating in the lower ionosphere are measured using incoherent scatter diagnostic techniques and are also calculated from heating/cooling theory. The ...
• #### Interpreting Multiple Linear Regression: A Guidebook of Variable Importance

(2012-04)
Multiple regression (MR) analyses are commonly employed in social science fields. It is also common for interpretation of results to typically reflect overreliance on beta weights (cf. Courville & Thompson, 2001; Nimon, ...
• #### Interpreting T-Cell Cross-reactivity through Structure: Implications for TCR-Based Cancer Immunotherapy

(2017)
Immunotherapy has become one of the most promising avenues for cancer treatment, making use of the patient’s own immune system to eliminate cancer cells. Clinical trials with T-cell-based immunotherapies have shown dramatic ...
• #### Interprocedural array side effect analysis

(1994)
In the absence of better information worst case assumptions must be made for the side effects of calls on arrays. Interprocedural array side effect analysis computes the side effects of calls on array variables. The results ...
• #### Interprocedural constant propagation: A study of jump function implementations

(1993)
Procedure calls have long been recognized as an impediment to performance in compiled code. This happens because procedure calls hide information from the compiler. Interprocedural constant propagation attempts to discover ...
• #### INTERPROCEDURAL DATA FLOW ANALYSIS IN A PROGRAMMING ENVIRONMENT

(1983)
This thesis examines three problems arising in the construction of an ambitious optimizing compiler based in a programming environment. The specific problems discussed are the analysis of aliasing patterns, computation of ...
• #### Interprocedural Pointer Analysis for C

(1998-05-20)
Many powerful code optimization techniques rely on accurate information connecting the definitions and uses of values in a program. This information is difficult to produce for programs written with pointer-based languages ...
• #### Interprocedural pointer analysis for C

(1998)
Many powerful code optimization techniques rely on accurate information connecting the definitions and uses of values in a program. This information is difficult to produce for programs written with pointer-based languages ...
• #### Interprocedural Strength Reduction of Critical Sections in Explicitly-Parallel Programs

(2013-05-01)
In this paper, we introduce novel compiler optimization techniques to reduce the number of operations performed in critical sections that occur in explicitly-parallel programs. Specifically, we focus on three code ...
• #### Interprocedural Symbolic Analysis

(1994-05)
Compiling for efficient execution on advanced computer architectures requires extensive program analysis and transformation. Most compilers limit their analysis to simple phenomena within single procedures, limiting effective ...
• #### Interprocedural symbolic analysis

(1995)
Compiling for efficient execution on advanced computer architectures requires extensive program analysis and transformation. Most compilers limit their analysis to simple phenomena within single procedures, limiting effective ...
• #### Interracial Friendships in the US: A Better Understanding of Presence and Variation

(2015-01-23)
Objective. Previous studies have examined interracial friendships, typically within educational settings, in relation to racial prejudice without taking in to account the formation of interracial friendship. I address the ...
• #### Interrogating the topological robustness of gene regulatory circuits by randomization

(2017)
One of the most important roles of cells is performing their cellular tasks properly for survival. Cells usually achieve robust functionality, for example, cell-fate decision-making and signal transduction, through multiple ...
• #### Interrogative particles in Nakh-Daghestanian languages

(2013-11)
This paper offers an analysis of interrogative particles in Nakh-Daghestanian languages, covering form, function and position of these particles in a wide range of languages. I show which particles occur in various question ...
• #### Interruptions

(2007)
The meaning of the title Interruptions derives from a procedure in which musical ideas are interrupted throughout the work. The piece begins with a drone in the lower strings. Over this drone interruptions occur, first in ...
• #### Interspecies characterization and tissue engineering of the temporomandibular joint disc

(2010)
Disorders of the temporomandibular joint (TMJ) are widespread, afflicting millions of people. The majority of these cases involve displacement or injury to the TMJ disc. Current treatments do not fully address severe cases ...
• #### Intersubband transitions in narrow indium arsenide/aluminum antimide quantum wells

(2004)
Intersubband resonances in InAs/AlSb are an ideal tool for optically pumped terahertz (THz) generation because of their enormous tunability and their strength at room temperature. We have carried out a systematic ...
• #### Intersymbol interference equalization by universal likelihood

(1997)
Codelength based inference is used to decode binary symbols distorted by an inter-symbol interference (ISI) channel with additive noise. The transmitted signals are antipodal waveforms constructed from $\pm$1 valued signature ...
• #### Intertemporal arbitrage, speculative balances, and the liquidity effect

(1998)
This thesis explores money manager intertemporal arbitrage as an explanation of the liquidity effect. We develop a theoretical model of optimal portfolio adjustment by professional money managers, and show that they engage ...
• #### Interval exchange transformations: Applications of Keane's construction and disjointness

(2010)
This thesis is divided into two parts. The first part uses a family of Interval Exchange Transformations constructed by Michael Keane to show that IETs can have some particular behavior including: (1) IETs can be topologically ...


text:
# Trigonometry, Random Numbers and More With Built-in PHP Math Functions

Basic maths is used a lot during programming. We need to frequently compare, add, multiply, subtract and divide different values when writing code.

Sometimes, the maths required in a program can be more involved. You might need to work with logarithmic, trigonometric or exponential functions. In this tutorial, I'll discuss how to use each of these functions in PHP, with examples.

This tutorial will introduce you to the built-in math functions in PHP for doing trigonometry, exponentiation, and logarithm calculations. We'll also look at rounding and generating random numbers.

## Trigonometric Functions in PHP

### Minimum and Maximum

PHP also has two functions called min($values) and max($values) to help you determine the lowest and highest values in a set or array of numbers. These functions can accept different kinds of parameters like two arrays and a string. You should take a look at the documentation to see how they would be compared.

### Integer Division

You can also perform integer division in PHP using the intdiv($dividend,$divisor) function. In this case, only the integral part of the quotient is returned after a division. Similarly, you can also get the remainder or modulo after the division of two arguments using the fmod($dividend,$divisor) function. The returned value will always be less than the $divisor in magnitude. There are some other useful functions like is_nan($value), is_finite($value) and is_infinite($val) which can be used to determine if the value is a number and, if it is a number, whether it is finite or infinite. Remember that PHP considers any value that is too big to fit in a float to be infinite. So is_finite() will return true for 100 factorial but false for 1000 factorial.

## Generating Random Numbers in PHP

Random numbers prove to be quite useful in a number of situations. You can use them to generate "random" data for your application or to spawn enemy instances in games, etc. It is very important to remember that none of the functions we discuss in this section generate cryptographically secure random numbers. These functions are only meant to be used in situations where security is not an issue, like showing random greeting texts to repeat visitors or for generating random statistical data.

The functions rand($min,$max) and mt_rand($min,$max) can generate positive random integers between given values including the $min and $max value. When the functions are called without any parameters, they generate random numbers between 0 and getrandmax(). You can echo the value of getrandmax() to see the maximum possible random number that these functions can generate on your platform.

The function mt_rand() is 4 times faster than rand() and returns false if $max is less than $min. Starting from PHP 7.1.0, rand() has actually been made an alias of mt_rand(). The only difference is that rand() still doesn't give an error if $max is less than $min to maintain backward compatibility.

Here is a loop to generate random values between 0 and 100 a million times. As you can see, the values 0, 50 and 100 are generated approximately 10,000 times with slight fluctuations.

Both these functions also have their own seeder functions called srand() and mt_srand() to provide a seed for the random number generators. You should just keep in mind that you only call srand() and mt_srand() once in your program. Calling them before every call to rand() and mt_rand() will give you the same "random" numbers every time.

## Final Thoughts

PHP comes with a lot of built-in functions that should meet all your day-to-day computation needs. You can use these functions to do slightly more complicated calculations like GCD, LCM and factorials yourself.

There are just a couple of things you should remember when using these functions. For example, the value returned by functions like floor() and ceil() is an integer, but it is still a float. Similarly, all trigonometric functions expect their angles to be given in radians. You will get incorrect results if you pass them an angle value that you wanted to be treated as a degree measure. So make sure you check the return value and expected arguments of all these functions in the documentation.

format: plain


text:
# Storage of Network Data and Topology#

[1]:

import openpnm as op
%config InlineBackend.figure_formats = ['svg']
import numpy as np
np.random.seed(0)

The best analogy for explaining data storage in OpenPNM is the humble spreadsheet. According to this analogy, each pore (or throat) corresponds to a row and each property corresponds to a column.

Consider the following network with 4 pores, 3 throats:

[2]:

pn = op.network.Cubic(shape=[4, 1, 1])
geo = op.geometry.SpheresAndCylinders(network=pn, pores=pn.Ps, throats=pn.Ts)

Let’s use pandas to express the geometric properties as a ‘spreadsheet’:

[3]:

import pandas as pd
# Let's pull out only the pore properties from the geometry
pore_data_sheet = pd.DataFrame({i: geo[i] for i in geo.props(element='pore')})

We can now view this ‘spreadsheet’:

[4]:

pore_data_sheet

[4]:

pore.diameter pore.seed pore.max_size pore.volume
0 0.474407 0.474407 1.0 0.055905
1 0.557595 0.557595 1.0 0.090773
2 0.501382 0.501382 1.0 0.065994
3 0.472442 0.472442 1.0 0.055213

The properties are the ‘column’ names, such as ‘pore.area’, and the rows correspond to the pore index, so ‘pore 0’ has an area of 0.176763.

One could also extract an entire column using:

[5]:

pore_area_column = pore_data_sheet['pore.cross_sectional_area']
print(pore_area_column)

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File /usr/share/miniconda3/envs/test/lib/python3.8/site-packages/pandas/core/indexes/base.py:3621, in Index.get_loc(self, key, method, tolerance)
3620 try:
-> 3621     return self._engine.get_loc(casted_key)
3622 except KeyError as err:

File /usr/share/miniconda3/envs/test/lib/python3.8/site-packages/pandas/_libs/index.pyx:136, in pandas._libs.index.IndexEngine.get_loc()

File /usr/share/miniconda3/envs/test/lib/python3.8/site-packages/pandas/_libs/index.pyx:163, in pandas._libs.index.IndexEngine.get_loc()

File pandas/_libs/hashtable_class_helper.pxi:5198, in pandas._libs.hashtable.PyObjectHashTable.get_item()

File pandas/_libs/hashtable_class_helper.pxi:5206, in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'pore.cross_sectional_area'

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 pore_area_column = pore_data_sheet['pore.cross_sectional_area']
2 print(pore_area_column)

File /usr/share/miniconda3/envs/test/lib/python3.8/site-packages/pandas/core/frame.py:3505, in DataFrame.__getitem__(self, key)
3503 if self.columns.nlevels > 1:
3504     return self._getitem_multilevel(key)
-> 3505 indexer = self.columns.get_loc(key)
3506 if is_integer(indexer):
3507     indexer = [indexer]

File /usr/share/miniconda3/envs/test/lib/python3.8/site-packages/pandas/core/indexes/base.py:3623, in Index.get_loc(self, key, method, tolerance)
3621     return self._engine.get_loc(casted_key)
3622 except KeyError as err:
-> 3623     raise KeyError(key) from err
3624 except TypeError:
3625     # If we have a listlike key, _check_indexing_error will raise
3626     #  InvalidIndexError. Otherwise we fall through and re-raise
3627     #  the TypeError.
3628     self._check_indexing_error(key)

KeyError: 'pore.cross_sectional_area'

And then access individual elements:

[6]:

print(pore_area_column[0])

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Input In [6], in <cell line: 1>()
----> 1 print(pore_area_column[0])

NameError: name 'pore_area_column' is not defined

## Numpy Arrays Stored in Dictionaries#

Although the spreadsheet analogy described above is very close to reality, OpenPNM does not actually use pandas DataFrames, or any other spreadsheet data structure. Instead, it uses the basic Python dictionary, filled with Numpy arrays to accomplish a nearly identical behavior, but with a bit more flexibility.

Each OpenPNM object (e.g. networks, algorithms, etc) is actually a customized (a.k.a. subclassed) Python dictionary which allows data to be stored and accessed by name, with a syntax like network['pore.diameter']. This is analogous (actually indistinguishable) to extracting a column from a spreadsheet as outlined above. Once the data array is retrieved from the dictionary, it is then a simple matter of working with a Numpy array, which use familiar array indexing, so the diameter of pore 0 is found be accessing element 0 of the array stored under the ‘pore.diameter’ key. This is elaborated upon below.

### Quick Overview of Dictionaries#

The internet contains many tutorials on Python “dicts”. To summarize, they are general purpose data contains where items can be stored by name, as follows:

[7]:

a = {}  # Create an empty dict
a['item 1'] = 'a string'
a['item 2'] = 4  # a number
a['another item'] = {}  # Even other dicts!
print(a)

{'item 1': 'a string', 'item 2': 4, 'another item': {}}

Data can be accessed by name, which is called a “key”:

[8]:

print(a['item 2'])

4

And all keys on a given dictionary can be retrieved as a list:

[9]:

print(a.keys())

dict_keys(['item 1', 'item 2', 'another item'])

Following the spreadsheet analogy, the dictionary is the sheet and the keys are the column names.

### Quick Overview of Numpy Arrays#

OpenPNM uses dictionaries or dict’s to store an assortment of Numpy arrays that each contain a specific type of pore or throat data.

There are many tutorials on the internet explaining the various features and benefits of Numpy arrays. To summarize, they are familiar to numerical arrays in any other language.

Let’s extract a Numpy array from the geo object and play with it:

[10]:

a = geo['pore.diameter']
print(a)

[0.47440675 0.55759468 0.50138169 0.47244159]

It’s possible to extract several elements at once:

[11]:

a[1:3]

[11]:

array([0.55759468, 0.50138169])

And easy to multiply all values in the array by a scalar or by another array of the same size, which defaults to element-wise multiplication:

[12]:

print(a*2)

[0.9488135  1.11518937 1.00276338 0.94488318]

[13]:

print(a*a)

[0.22506177 0.31091183 0.2513836  0.22320106]

Referring back to the spreadsheet analogy, the Numpy arrays represent the actual cells of the sheet, with the array index corresponding to the row number.

### Rules to Maintain Data Integrity#

Several rules have been implemented to control the integrity of the data:

#### All Values are Converted to Numpy Arrays#

Only Numpy arrays can be stored in an OpenPNM object, and any data that is written into one of the OpenPNM object dicionaries will be converted to a Numpy array. This is done to ensure that all mathematically operations throughout the code can be consistently done using vectorization. Note that any subclasses of Numpy arrays, such as Dask arrays or Unyt arrays are also acceptable.

[14]:

pn['throat.list'] = [1, 2, 3]
print(type(pn['throat.list']))

<class 'numpy.ndarray'>

This illustrates that the basic python list-type has been converted to a Numpy array when stored in the dictionary

#### Any Scalars are Expanded to a Full-Length Vector#

For the sake of consistency only arrays of length Np or Nt are allowed in the dictionary. Assigning a scalar value to a dictionary results in the creation of a full length vector, either Np or Nt long, depending on the name of the array.. This effectively applies the scalar value to all locations in the network.**

[15]:

pn['pore.test'] = 0
print(pn['pore.test'])

[0 0 0 0]

Note how the scalar value has been cast to an array of 4 elements long, one for each pore in the network.

All array names must begin with either ‘pore.’ or ‘throat.’ which serves to identify the type of information they contain.

[16]:

try:
pn['foo.bar'] = 0
except:
print('This will throw an exception since the dict name cannot start with foo')

This will throw an exception since the dict name cannot start with foo

#### Nesting Dictionary Names are Allowed#

It’s possible to create nested properties by assigning a dictionary containing numpy arrays

[17]:

pn['pore.concentration'] = {'species_A': 0, 'species_B': 1}
print(pn['pore.concentration'])

{'pore.concentration.species_A': array([0, 0, 0, 0]), 'pore.concentration.species_B': array([1, 1, 1, 1])}

The above rule about expanding the scalar values to a numpy array have been applied.

Requesting the top level of dictionary key returns both concentrations, but they can accessed directly too:

[18]:

print(pn['pore.concentration.species_A'])

[0 0 0 0]

Unfortunately, the following does not work:

[19]:

try:
pn['pore.concentration']['species_A']
except:
print('The request for pore.concentration returns a dictionary with both arrays, '
+ 'but the entire property name is still used as the key. ')

The request for pore.concentration returns a dictionary with both arrays, but the entire property name is still used as the key.

#### Boolean Arrays are Treated as Labels#

Any Boolean data will be treated as a label while all other numerical data is treated as a property.

[20]:

pn['pore.label'] = False
print(pn.labels(element='pore'))

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
1     : pore.all
2     : pore.geo_01
3     : pore.internal
4     : pore.label
5     : pore.left
6     : pore.right
7     : pore.surface
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

You can see that 'pore.label' shows up in this list automatically since it is of Boolean type. For more information on using labels see the tutorial on Using and Creating Labels.

#### Dictionary Keys with a Leading Underscore are Hidden#

Following the Python convention, if a piece of data is not really meant to be seen or used by the user, it can be pre-pended with an underscore and it will no appear in any output.

[21]:

pn['pore._hidden'] = 1
print(pn.props())

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
1     : pore.concentration.species_A
2     : pore.concentration.species_B
3     : pore.coords
4     : pore.test
5     : throat.conns
6     : throat.list
7     : throat.spacing
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

The 'pore._hidden' key does not show up in this list.

## Representing Topology#

Consider the following simple random network:

[22]:

np.random.seed(10)
pts = np.random.rand(5, 2)*1.5
pn = op.network.Delaunay(points=pts, shape=[1, 1, 0])

[23]:

op.topotools.plot_tutorial(pn)

[23]:

<matplotlib.collections.PathCollection at 0x7f1b24a59a90>

The basic premise of how OpenPNM stores topology can be stated in 1 sentence:

The pores on either end of a throat are just another property to be stored, along with diameter, length, etc.

In other words, referring to the above diagram, throat No. 5 has pores 3 and 4 on it’s ends. Using the spreadsheet analogy, this implies a new colunm that stores the pair of pores connected by each throat. OpenPNM calls this property 'throat.conns':

[24]:

print(pn['throat.conns'])

[[0 2]
[0 4]
[1 2]
[2 3]
[2 4]
[3 4]]

Inspection of this Nt-by-2 array shows that each row contains the pore indices corresponding to that throat.

The topology storage scheme described above is actually an adjacency matrix, in a sparse storage format known as IJV or COO.

An adjacency matrix is a Np-by-Np matrix with non-zero values at location (i, j) indicating that pores i and j are connected.

An important feature of the adjacency matrix is that it is highly sparse (mostly zeros) and can be stored with a variety of sparse storage schemes offered by Scipy. OpenPNM stores the adjacency matrix in the ‘COO’ format, which essentially stores the coordinates (I,J) of the nonzero elements in an two-colume wide array.

Thus the throat property called 'throat.conns' is an Nt-by-2 array that gives the index of the two pores on either end of a given throat.

#### Additional Thoughts on Sparse Storage#

• In pore networks there is (usually) no difference between traversing from pore i to pore j or from pore j to pore i, so a 1 is also found at location (j, i) and the matrix is symmetrical.

• Since the adjacency matrix is symmetric, it is redundant to store the entire matrix when only the upper triangular part is necessary. The 'throat.conns' array only stores the upper triangular information, and i is always less than j.

• Although this storage scheme is widely known as IJV, the scipy.sparse module calls this the Coordinate or COO storage scheme.

• Some tasks are best performed on other types of storages scheme, such as CSR or LIL. OpenPNM converts between these internally as necessary, but users can generate a desired format using the create_adjacency_matrix method which accepts the storage type as an argument (i.e. 'csr', 'lil', etc). For a discussion of sparse storage schemes and the respective merits, see this Wikipedia article.

### Topology Rules#

The only topology definitions required by OpenPNM are:

1. A throat connects exactly two pores, no more and no less

2. Throats are non-directional, meaning that flow in either direction is equal

Other general, but non-essential rules are:

1. Pores can have an arbitrary number of throats, including zero; however, pores with zero throats lead to singular matrices and other problems so should be avoided.

2. Two pores are generally connected by no more than one throat. It is technically possible in OpenPNM to have multiple throats between a pair of pores, but it is not rigorosly supported so unintended results may arise.

### Historical Aside#

During the development of OpenPNM, it was debated whether existing Python graph theory packages (such as graph-tool or NetworkX) should be used to store the network topology. It was decided that network property data should be simply stored as Numpy ND-arrays as discussed above for the primary reason that this format makes the data storage very transparent and familiar since all engineers are used to working with arrays (i.e. vectors), and also very efficiently since this allows code vectorization. Fortuitously, around the same time as this discussion, Scipy introduced the compressed sparse graph library, which contains numerous graph theory algorithms that take Numpy arrays as arguments. Therefore, OpenPNM’s topology model is implemented using Numpy arrays, leveraging the scipy.sparse.csgraph library. Most importantly, this approach is perfectly in tune with the ‘spreadsheet’ model of data storage.


text:
Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

# Aerobic fitness associates with mnemonic discrimination as a mediator of physical activity effects: evidence for memory flexibility in young adults

## Abstract

A physically active lifestyle has beneficial effects on hippocampal memory function. A potential mechanism for this effect is exercise-enhanced hippocampal plasticity, particularly in the dentate gyrus (DG). Within hippocampal memory formation, the DG plays a crucial role in pattern separation, which is the ability to discriminate among similar experiences. Computational models propose a theoretical hypothesis that enhanced DG-mediated pattern separation leads to “memory flexibility”–a selective improvement in the ability to overcome moderate levels of mnemonic interference. Thus, in the current cross-sectional study of healthy young adults, we tested the working hypothesis that aerobic fitness, as a physiological indicator of endurance capacity associated with physical activity, is strongly associated with mnemonic discrimination at moderate interference levels. When divided the sample (n = 75) based on a median split of aerobic fitness, the higher fitness group had better discrimination performance for moderate interference levels compared to the lower fitness group, namely, exhibited memory flexibility. Moreover, aerobic fitness levels were positively associated with discrimination performance for moderate interference levels, as a mediator of physical activity effects. This evidence suggests that aerobic fitness levels are associated with hippocampal DG-related memory, which is consistent with literature showing positive effect of physical exercise on hippocampal memory.

## Introduction

A physically active lifestyle has beneficial effects not only on physical fitness, but also on brain and cognitive health. Indeed, abundant evidence has demonstrated that aerobic fitness level, which is a physiological indicator of endurance capacity associated with physical activity, is positively associated with various aspects of cognitive functioning across all ages1, 2. Several recent studies have demonstrated that higher levels of aerobic fitness are associated with superior hippocampal memory performance and that this relationship is partially mediated by hippocampal volume in children and older adults3, 4.

A potential mechanism for this association is exercise-enhanced neural plasticity, particularly in the dentate gyrus (DG) of the hippocampus. A number of animal studies, including ours, have revealed that long-term exercise intervention has a positive impact on cell proliferation and survival in the DG and improves learning and memory5,6,7,8,9. One human study indirectly supports these findings: aerobic exercise training increased cerebral blood volume in the DG, which is related to neurogenesis, and this effect was positively correlated with aerobic fitness enhancement10. This evidence led us to directly test the hypothesis that aerobic fitness, as a physiological landmark of habitual physical activity, may be strongly associated with DG-related memory function.

It has been demonstrated that DG granule cells are sensitive to mnemonically similar experience and are able to generate different representations even with minimal changes in sensory input11. In computational models, this process is known as pattern separation; it plays a crucial role in overcoming mnemonic interference and is a fundamental component of episodic memory12. Pattern separation allows for similar experiences to be stored using distinct representations depending on the extent to which they generate interference. Interestingly, along with a reduction of DG-mediated pattern separation with aging, the relationship between mnemonic interference levels and discrimination performance becomes increasingly nonlinear, following an exponential curve (“memory rigidity”) and discrimination performance is more impaired at moderate interference levels (for review, see Leal and Yassa13). Conversely, computational models propose a counterpart theoretical concept of “memory flexibility”–that is, enhanced DG-mediated pattern separation leads to a curvilinear the natural logarithmic relationship between discrimination performance and an enhanced ability to overcome moderate levels of interference.

We hypothesized that if physical-activity-enhanced aerobic fitness is related to DG-mediated pattern separation, then aerobic fitness should mediate the relationship between physical activity and discrimination performance, and be selectively associated with discrimination performance for moderate level of interference, thereby leading to a more natural logarithmic curve input/output transformation. To test this hypothesis, we first examined differences in discrimination performance between higher and lower fitness young adults. Moreover, we examined the mediation effect of aerobic fitness on the association of physical activity levels with discrimination performance. Although, we assessed aerobic fitness and physical fitness in a cross-sectional manner, we focused on aerobic fitness, which is often considered an objective landmark of habitual physical activity14, as a mediator of the association between physical fitness and discrimination performance. To assess mnemonic discrimination performance, we adopted a mnemonic discrimination task which uses lures that vary in similarity, thereby parametrically manipulating interference15, 16. The lure discrimination score, which is the proportion of correct rejection of lure items, for the task is strongly tied to age-related changes in discrimination performance15,16,17 and functional signals in the DG/CA318. Thus, the task and its corresponding lure discrimination measure are appropriate for assessing an individual capacity for DG-related memory function.

## Materials and Methods

### Participants

Seventy-five healthy young adults aged 18–24 years (mean age 20.2 ± 1.6 years, 30 females) participated in this study. All participants were recruited from student population of the university of Tsukuba using ethics board approved flyers that were posted across the campus. No subject reported a history of neurological or psychiatric disorders, or had a disease requiring medical care. All participants had normal or corrected-to-normal vision at least 20/40, and normal color vision. Participants’ demographic and physiological characteristics are presented in Table 1.

All experimental protocols were approved by the Institutional Ethics Committee of the University of Tsukuba. The experiment was carried out in accordance with those protocols and guidelines of the latest version of the Helsinki Declaration. Written informed consent was obtained from all participants.

### Experimental procedure

The participants visited our laboratory twice. On the first day, they completed health/demographic questionnaires, and performed a graded exercise test to assess their maximal aerobic fitness level. On the second day, at least 48 hours after the fitness assessment, all participants underwent a mnemonic discrimination task. On both experimental days, they were asked to refrain from exercise and the consumption of alcohol and caffeine for at least 24 hours prior to the experiment so as to control for outside factors that could affect cardiovascular and cognitive function.

### Physical activity assessment

The Japanese language version of the International Physical Activities Questionnaire (IPAQ)-long form was used as a measure of self-reported physical activity19. Participants were asked to report the amount of walking, and the number of times they performed moderate and vigorous activities over the previous seven days. Total physical activity (TPA) was calculated as metabolic equivalent of task (MET)-hours/week by summing weekly hours of each reported physical activity weighted by MET values20.

### Cardiorespiratory aerobic fitness assessment

Individual aerobic fitness level was assessed using a graded exercise test with a recumbent ergometer (Strength-ergo 240, Mitsubishi Electric Corporation, Japan). Peak oxygen uptake ($$\dot{{\rm{V}}}$$O2peak), the gold-standard measurement of aerobic fitness, was determined by measuring oxygen uptake continuously during an incremental test to exhaustion. After warming up for 3 minutes at 30 W, the work rate increased by 20 W (females: 15 W) per minute in a constant and continuous manner to exhaustion. The pedaling rate was kept at 60 rpm. Exhaled gas was analyzed using a gas analyzer (Aeromonitor AE280S, Minato Medical Science, Japan). Heart rate (HR) and rating of perceived exertion (RPE) were recorded every minute. The RPE was assessed verbally on which participant are asked to rate their perceived exertion ranging from 6 (no exertion at all) to 20 (maximal exertion). $$\dot{{\rm{V}}}$$O2peak was determined when at least two of the following criteria were satisfied: (1) the respiratory exchange ratio (R) exceeded 1.05, (2) achievement of 90% of age-predicted peak HR (220–age), and (3) an RPE of 19 or 20.

### Mnemonic discrimination task

The task used in this study consisted of an encoding phase and a retrieval phase (Fig. 1). During the encoding phase, participants were shown a series of 196 color photographs of everyday objects on a white background on a computer screen. They were required to judge whether the presented picture was an indoor or outdoor object. After the encoding phase, the participants rested for 45 minutes while they watched a movie (low arousal stimulus) without sound to avoid sleeping. After rest, the participants underwent the retrieval phase, during which a series of 256 items were randomly displayed on a monitor and participants identified each item as “old”, “similar”, or “new” by pressing buttons. One-fourth of the stimuli in the retrieval phase were “old”, or exact repetitions of stimuli presented in the encoding phase (64 targets); half of the stimuli were “similar” to those seen during the encoding phase, but not identical (128 lures); and one-fourth of the stimuli were “new” stimuli not previously seen (64 foils). In both phases, each picture was presented for 2 s with an inter-stimulus interval (ISI) of 0.5 s. All participants underwent a practice session (4 encoding items; 8 retrieval items) to ascertain their understanding of task instructions and procedures.

This task measures discrimination performance as a function of interference levels. The lure stimuli were sorted into three bins based on the degree of mnemonic similarity to the targets, with high-, middle- and low-similarity lures16. To assess discrimination performance across all trial types and each similarity lure, we calculated the discrimination score (DS) as the inverse of the probability of responding with “old”, representing “similar” or “new” responses (1−p (“old”|Type)). We adopted this measure to factor out response bias of using “similar” or “new” for lure bins across participants. It should be noted that the DS for target trials represents the propensity for incorrect rejection since the correct response for this trial is “old”. In addition, we calculated target recognition score as the probability of correctly responding “old” to targets minus the probability of incorrectly responding “old” to novel foils (p (“old”|target)−p (“old”|foil)). This target recognition metric relies more on familiarity-based memory, typically thought to not require hippocampal (or at least DG) mediated processing21, 22.

### Depression scale (BDI-2)

The Beck Depression Inventory (BDI) -2, one of the most commonly used self-reported measure of depression was adopted to assess depressive mood of participants23. We assessed depression because depressive mood was previously shown to be associated with discrimination performance24, 25.

### Statistical analysis

Before conducting the study, we checked the sample size needed using a priori power analysis with the statistical software G-Power26. An optimal total sample size of N = 60, with a small effect size of η2 = 0.02 and a power of 0.8 and alpha = 0.05 was calculated.

For group analysis, we divided participants into two groups based on a median split of $$\dot{{\rm{V}}}$$O2peak. Grouping was conducted separately for each sex because $$\dot{{\rm{V}}}$$O2peak is significantly higher in males. Participants with scores above the median were classified as the higher fitness group (High-Fit), and participants with scores below the median were classified as the lower fitness group (Low-Fit). We compared demographic variables, TPA, $$\dot{{\rm{V}}}$$O2peak and mnemonic discrimination task performance between High-Fit and Low-Fit groups using unpaired t-tests. Then, we ran a repeated measures two-way ANOVA on 1−p (“old”|Type) with group (High-Fit, Low-Fit) × trial type (Target, High-Sim, Mid-Sim, Low-Sim, Foil) followed by Bonferroni’s post hoc test.

Next, we investigated the association of aerobic fitness and physical activity with mnemonic discrimination task performance across all participants. First, in order to determine covariates, Pearson correlation analysis was conducted to assess bivariate relationships of potential confounding variables (sex, age, BMI, BDI-2) to $$\dot{{\rm{V}}}$$O2peak, TPA, and mnemonic discrimination task performance (target recognition, and DS for high, middle, and low similarity lures). When there were meaningful correlations (r > 0.2027), these confounding variables were controlled as covariates for the next partial correlation analysis between $$\dot{{\rm{V}}}$$O2peak, TPA, and mnemonic discrimination task performance.

Then, we conducted mediation analyses for examining the mediation effect of $$\dot{{\rm{V}}}$$O2peak (mediator variable) on the relationship between TPA (independent variable) and memory performance (dependent variable) using a multiple regression approach28 and the nonparametric bootstrapping procedure29. Any confounding variable exhibiting a meaningful correlation in the bivariate correlation analysis was controlled as a covariate. According to the moderation model by Baron and Kenny (1986), analysis should be conducted in four steps in order to examine the mediation effect. In the current study, the following analyses were conducted. We examined (1) whether TPA (independent variable) was associated with memory performance (dependent variable), (2) whether TPA (independent variable) was associated with $$\dot{{\rm{V}}}$$O2peak (mediator variable), (3) whether $$\dot{{\rm{V}}}$$O2peak (mediator variable) was associated with memory performance (dependent variable), and (4) whether the prospective mediation effect was significant when the relationship between TPA and memory performance became significantly weaker (partial mediation) or insignificant (full mediation) after the inclusion of $$\dot{{\rm{V}}}$$O2peak.

To test the significance of the mediation effect, we used the bootstrapping method recommended for relatively small sample sizes because bootstrapping is a nonparametric test that does not require the assumption of normality. In the bootstrapping method, thousands of samples are taken from a given data set and the indirect effects in each resample are estimated. These estimations are used to directly test mediation. Indirect effects can be estimated by subtracting the direct effects of the independent variable on the dependent variable after controlling for the role of the proposed mediators from the total effect of the independent variable on the dependent variable without controlling for the proposed mediators. Therefore, statistically significant mediation can be defined if zero is not included within 95% bias-corrected and accelerated confidence intervals for indirect effects. In our analyses, we used 5000 bootstrap resamples of the data with replacement.

Statistical significance was set a priori at p < 0.05. Statistical analyses were performed using SPSS Statistical Package version 19 (SPSS, Inc., USA). For mediation analysis, we used PROCESS macro for SPSS29.

## Results

### Group analysis (High-Fit vs. Low-Fit)

First, we tested for group differences in mnemonic discrimination task performance. The median $$\dot{{\rm{V}}}$$O2peak of males and females was 46.6 and 36.2, respectively. One male subject with a median $$\dot{{\rm{V}}}$$O2peak was excluded, hence each High-Fit and Low-Fit group consisted of 37 subjects (15 females). (Note: $$\dot{{\rm{V}}}$$O2peak range for male: Low-Fit 30.7–46.1, High-Fit 46.6–57.8; female: Low-Fit 27.3–35.6, High-Fit 36.9–45.1). Comparison and statistical testing of group differences between High-Fit and Low-Fit groups in demographic variables, physical activity, aerobic fitness and mnemonic discrimination task performance are reported in Table 1. $$\dot{{\rm{V}}}$$O2peak and TPA were significantly higher in the High-Fit group (t(72) > 6.85, p < 0.01; t(72) > 3.54, p < 0.01) and BMI was significantly lower in the High-Fit group (t(72) = 2.08, p < 0.05). Group differences in response proportions for each similarity of lures are shown in Fig. 2a. In middle-similarity lures, the occurrence of lures identified as “similar” (correct rejections) was significantly higher in the High-Fit group (t(72) = 2.41, p = 0.02), while the occurrence of lures identified as “old” (false alarms) was significantly lower in the High-Fit group (t(72) = 2.35, p = 0.02). There is a clear trade-off between correct rejections and false alarms, that is, the High-Fit group discriminated more lures as “similar”.

Mnemonic discrimination performance differences between the High-Fit and Low-Fit groups as a function of interference levels are presented in Fig. 2b. A repeated measures two-way ANOVA for group and trial type exhibited a significant main effect of trial type (F(4, 288) = 597.67, p < 0.001), no main effect of group (F(1, 72) = 2.41, p = 0.12), and a significant interaction (F(4, 288) = 2.87, p = 0.03). Bonferroni-corrected post hoc comparisons revealed that the High-Fit group significantly outperformed the Low-Fit group on DS for Mid-Sim (F(1, 288) = 5.82, p = 0.02). Meanwhile, the High-Fit group did not differ from the Low-Fit group on DS for Target (F(1, 288) = 0.02, p = 0.88), High-Sim (F(1, 288) = 2.40, p = 0.12), Low-Sim (F(1, 288) = 0.81, p = 0.37) or Foil trials (F(1, 288) = 0.84, p = 0.36). Together, these results suggest that the better discrimination performance by the High-Fit group relative to the Low-Fit group is specific to trials with moderate mnemonic interference.

### Correlation analysis

The results of bivariate and partial correlation analysis are shown in Table 2. Sex was significantly related to $$\dot{{\rm{V}}}$$O2peak and TPA. Age, BMI and BDI-2 were not correlated with $$\dot{{\rm{V}}}$$O2peak, TPA or mnemonic discrimination task performance (all r < 0.2). Therefore, sex was controlled as a covariate for $$\dot{{\rm{V}}}$$O2peak and TPA in the next partial correlation and regression analysis. Partial correlation analysis revealed positive correlations of $$\dot{{\rm{V}}}$$O2peak and TPA to DS for middle-similarity bins (DS_Mid) after controlling for sex (Fig. 3b,c). DS for the other similarity bins (High-Sim and Low-Sim) and target recognition scores were not associated with $$\dot{{\rm{V}}}$$O2peak and TPA. In addition, TPA was positively correlated with $$\dot{{\rm{V}}}$$O2peak (Fig. 3a).

### Mediation analysis

Figure 4 and Table 3 show results of mediation analyses with sex as a covariate. TPA was significantly associated with DS_Mid (Fig. 4 and Table 3 path c) and $$\dot{{\rm{V}}}$$O2peak (Fig. 4 and Table 3 path a). When $$\dot{{\rm{V}}}$$O2peak was added as the predictor, it was significantly associated with DS_Mid (Fig. 4 and Table 3 path b) and the significant association between TPA and DS_Mid diminished and became not significant (Fig. 4 and Table 3 path c’). This mediation effect was further examined using non-parametric bootstrapping procedures. The 95% bootstrap confidence intervals of the indirect effect (path a*b) did not contain zero (standardized indirect effect: 0.13, 95% CI: 0.023 to 0.278), indicating significant mediation. These results further confirm the mediation effect of $$\dot{{\rm{V}}}$$O2peak on the relationship of TPA to DS_Mid. Thus, this mediation model suggests that the relationship between physical activity and discrimination performance is mediated by aerobic fitness levels.

## Discussion

The goal of the present study was to clarify whether aerobic fitness, a physiological marker reflecting habitual physical activity, is associated with discrimination performance, especially when mnemonic interference levels are moderate, in healthy young adults. In group comparisons, the High-Fit group outperformed the Low-Fit group selectively in DS_Mid. This relationship was confirmed by correlational analyses across all participants, in which aerobic fitness ($$\dot{{\rm{V}}}$$O2peak) and physical activity levels measured with IPAQ were positively correlated with DS_Mid, but not with target recognition and DS for other similarity conditions. In addition, mediation analysis clearly showed that $$\dot{{\rm{V}}}$$O2peak and TPA predicted DS_Mid and that the effects of TPA were mediated by $$\dot{{\rm{V}}}$$O2peak. These results support the hypothesis that aerobic fitness, as a mediator of physical activity effects, is associated with discrimination performance when interference is moderate, which is consistent with predictions from computational models and suggests that aerobic fitness is associated with memory flexibility.

Examining performance as a function of interference shows a linear relationship between interference and performance in the Low-Fit group, and curvilinear relationship in the High-Fit group approximated by the natural logarithmic function (Fig. 5: memory flexibility). The opposite result has been obtained with age-related mnemonic discrimination deficits, where older adults underperform young adults in mnemonic discrimination score for middle-similarity lures, namely exhibit a function approximated by an exponential curve15, 17 (Fig. 5: memory rigidity; note that the term “rigidity” was first used by Gallagher and colleagues30). A recent high-resolution fMRI study revealed that the exponential relationship of mnemonic interference and discrimination performance is linked to reduced DG/CA3 ability to generate different representations for moderate interference stimuli in older adults18. This evidence strongly suggests that memory rigidity is attributed to the deficit of DG-mediated pattern separation. Taken together, the association observed in the present study can be attributed to exercise-enhanced modulation of DG-mediated pattern separation.

Subsequent correlation analysis supported the above results that aerobic fitness and physical activity were associated with DS_Mid. Previous cross-sectional studies have demonstrated the positive association of aerobic fitness levels3, 4, 31,32,33 and physical activity levels33 with hippocampal memory function using a relational memory paradigm. Only one previous study indicated that discrimination performance changes after exercise training were positively correlated with improved aerobic fitness in a small sample of young adults24. However, this study did not examine discrimination performance as a function of interference level, and thus could not directly examine input/output transformations that are necessary to test hypotheses about pattern separation. Our results confirm and extend prior work, while testing a hypothesis that better discrimination performance in individuals with higher aerobic fitness manifests as memory flexibility, which has never been demonstrated.

Moreover, in a correlation analysis, we found a positive relationship between physical activity and aerobic fitness, and confirmed the validity of aerobic fitness as a physiological landmark of physical activity14. Mediation analysis further indicated that aerobic fitness mediated the relationship between physical activity and discrimination performance for moderate mnemonic interference levels. These results are in line with the cardiovascular fitness hypothesis, which states that cardiovascular fitness is a physiological mediator that predicts various aspects of cognitive functioning and that enhancements in aerobic fitness are necessary for the cognitive benefits of physical activity34, 35.

As expected, target recognition in the mnemonic discrimination task was not associated with aerobic fitness and physical activity. Previous studies have shown that the target recognition metric of the mnemonic discrimination task relies more on extrahippocampal cortices15, 21. Supporting this, amnesic patients with hippocampal damage demonstrate intact target recognition performance, but an impairment in lure discrimination performance using a mnemonic discrimination task22. Taken together with these previous findings, the current data suggest that the impact of physical activity and aerobic fitness on episodic memory is linked specifically to DG computations, and have little or no relationship with extrahippocampal cortices. These results are consistent with previous studies showing that aerobic fitness is associated with hippocampal-related relational memory, but not with hippocampal non-related item memory performance in healthy young adults and children3, 32.

Regarding the neurobiological mechanisms underlying the association of higher physical activity levels with better hippocampal memory function through the mediation of higher aerobic fitness levels, physical-exercise-enhanced neural plasticity of the DG may provide some insight. Previous animal studies, including our own works, have revealed a beneficial effect of exercise, especially on neurogenesis in the DG5,6,7,8,9. Moreover, an exercise-induced increase in the number of newborn neurons was correlated with enhanced fine spatial, suggesting that neurogenesis may play a role in better discrimination performance36. To explore this point, developing novel approaches to measure neurogenesis in the human brain in vivo will be necessary. Some progress has been made in this arena using MR spectroscopy techniques37 but the method remains in its infancy and is not without its critics38,39,40,41,42. Measuring related biomarkers such as, DG/CA3 functional activity18 or perforant path integrity18, 43, as a modifiable neurobiological basis for the effect of exercise, can also be informative. In addition to its impact on hippocampal plasticity and neurogenesis, exercise clearly has more diverse effects on the brain and can also positively impact other cognitive capacities such as executive function, mediated by the prefrontal cortex (PFC). Several studies, including our own, have shown that aerobic fitness and physical activity are associated with dorsolateral-PFC (DLPFC) function44,45,46. Interestingly, recent work has also suggested that cortical regions including the DLPFC may contribute to pattern separation47. While this is certainly a possibility that cannot be excluded, the selectivity of the exercise findings in this study to the middle-similarity lures suggest that the effect is at least principally driven by DG computations. To explore this in detail, however, BOLD signal changes in the DG as well as PFC regions, including the DLPFC, should be examined using high-resolution fMRI.

We should note that the mediation model, while consistent with a causal effect of exercise on DG structure and function, is not sufficient to infer such causality. Since the current study has a cross-sectional design, we are unable to draw a causal conclusion. However, many animal studies have revealed that exercise has beneficial effects on the structure and function of the DG36. In addition, our recent work in humans has revealed that acute physical exercise of moderate intensity improves discrimination performance when interference level is moderate, which is consistent with a theoretical hypothesis of memory flexibility48. Collectively, the extant data are consistent with a causal effect of exercise on brain structure and function. In other words, we would suggest that aerobic fitness improved with physical activity enhances DG-related memory function. Testing this hypothesis more directly using neurobiological approaches including high-resolution imaging is a logical next step. Moreover, further studies should clarify whether the relationships observed in the non-athlete, healthy young adults in this study can also be observed in other populations, such as children and older adults, and in psychiatric disorders, such as depression and mild cognitive impairment (MCI). It would also be interesting to consider discrimination performance in endurance athletes with superior aerobic fitness.

In conclusion, the present study reveals that aerobic fitness levels, as a mediator of physical activity effects, are selectively associated with enhanced mnemonic discrimination performance for moderate interference levels in young adults. While several studies have found a positive association between physical activity and aerobic fitness for hippocampal memory function, the current study points to involvement of improved DG function in this association. Although future research is required to confirm the causal relationship between aerobic exercise and DG-mediated pattern separation and to explore the underlying mechanism of this association, the present study sheds light on how physical activity and related improvements of aerobic fitness impact on hippocampal memory.

## References

1. 1.

Hillman, C. H., Erickson, K. I. & Kramer, A. F. Be smart, exercise your heart: exercise effects on brain and cognition. Nat. Rev. Neurosci. 9, 58–65 (2008).

2. 2.

Voss, M. W., Vivar, C., Kramer, A. F. & van Praag, H. Bridging animal and human models of exercise-induced brain plasticity. Trends Cogn. Sci. 17, 525–544 (2013).

3. 3.

Chaddock, L. et al. A neuroimaging investigation of the association between aerobic fitness, hippocampal volume, and memory performance in preadolescent children. Brain Res. 1358, 172–183 (2010).

4. 4.

Erickson, K. I. et al. Aerobic fitness is associated with hippocampal volume in elderly humans. Hippocampus 19, 1030–1039 (2009).

5. 5.

van Praag, H., Kempermann, G. & Gage, F. H. Running increases cell proliferation and neurogenesis in the adult mouse dentate gyrus. Nat. Neurosci. 2, 266–270 (1999).

6. 6.

van Praag, H., Shubert, T., Zhao, C. & Gage, F. H. Exercise enhances learning and hippocampal neurogenesis in aged mice. J. Neurosci. 25, 8680–8685 (2005).

7. 7.

Lee, M. C. et al. Voluntary resistance running induces increased hippocampal neurogenesis in rats comparable to load-free running. Neurosci. Lett. 537, 6–10 (2013).

8. 8.

Okamoto, M. et al. Mild exercise increases dihydrotestosterone in hippocampus providing evidence for androgenic mediation of neurogenesis. Proc. Natl. Acad. Sci. USA 109, 13100–13105 (2012).

9. 9.

Inoue, K. et al. Long-term mild, rather than intense, exercise enhances adult hippocampal neurogenesis and greatly changes the transcriptomic profile of the hippocampus. PLoS One 10, e0128720 (2015).

10. 10.

Pereira, A. C. et al. An in vivo correlate of exercise-induced neurogenesis in the adult dentate gyrus. Proc. Natl. Acad. Sci. USA 104, 5638–5643 (2007).

11. 11.

Leutgeb, J. K., Leutgeb, S., Moser, M.-B. & Moser, E. I. Pattern separation in the dentate gyrus and CA3 of the hippocampus. Science 315, 961–966 (2007).

12. 12.

Yassa, M. A. & Stark, C. E. L. Pattern separation in the hippocampus. Trends Neurosci. 34, 515–525 (2011).

13. 13.

Leal, S. L. & Yassa, M. A. Neurocognitive aging and the hippocampus across species. Trends Neurosci. 38, 800–812 (2015).

14. 14.

Fogelholm, M. et al. International physical activity questionnaire: Validity against fitness. Med. Sci. Sports Exerc. 38, 753–760 (2006).

15. 15.

Stark, S. M., Yassa, M. A., Lacy, J. W. & Stark, C. E. L. A task to assess behavioral pattern separation (BPS) in humans: Data from healthy aging and mild cognitive impairment. Neuropsychologia 51, 2442–2449 (2013).

16. 16.

Yassa, M. A. et al. Pattern separation deficits associated with increased hippocampal CA3 and dentate gyrus activity in nondemented older adults. Hippocampus 21, 968–979 (2011).

17. 17.

Reagh, Z. M. et al. Spatial discrimination deficits as a function of mnemonic interference in aged adults with and without memory impairment. Hippocampus 24, 303–314 (2014).

18. 18.

Yassa, M. A., Mattfeld, A. T., Stark, S. M. & Stark, C. E. L. Age-related memory deficits linked to circuit-specific disruptions in the hippocampus. Proc. Natl. Acad. Sci. USA 108, 8873–8878 (2011).

19. 19.

Craig, C. L. et al. International physical activity questionnaire: 12-Country reliability and validity. Med. Sci. Sports Exerc. 35, 1381–1395 (2003).

20. 20.

Van Holle, V., De Bourdeaudhuij, I., Deforche, B., Van Cauwenberg, J. & Van Dyck, D. Assessment of physical activity in older Belgian adults: validity and reliability of an adapted interview version of the long International Physical Activity Questionnaire (IPAQ-L). BMC Public Health 15(433), doi:10.1186/s12889-015-1785-3 (2015).

21. 21.

Skinner, E. I. & Fernandes, M. A. Neural correlates of recollection and familiarity: A review of neuroimaging and patient data. Neuropsychologia 45, 2163–2179 (2007).

22. 22.

Kirwan, B. et al. Pattern separation deficits following damage to the hippocampus. Neuropsychologia 50, 2408–2414 (2012).

23. 23.

Beck, A., Steer, R. & Brown, G. Manual for the Beck Depression Inventory-II. Psychological Corporation (1996).

24. 24.

Déry, N. et al. Adult hippocampal neurogenesis reduces memory interference in humans: Opposing effects of aerobic exercise and depression. Front. Neurosci. 7(66), doi:10.3389/fnins.2013.00066 (2013).

25. 25.

Leal, S. L., Tighe, S. K. & Yassa, M. A. Asymmetric effects of emotion on mnemonic interference. Neurobiol. Learn. Mem. 111, 41–48 (2014).

26. 26.

Faul, F., Erdfelder, E., Lang, A.-G. & Buchner, A. G*Power 3: a flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behav. Res. Methods 39, 175–191 (2007).

27. 27.

Cohen, J. A power primer. Psychol. Psychol. Bull. 112, 155–159 (1992).

28. 28.

Baron, R. M. & Kenny, D. A. The moderator-mediator variable distinction in social psychological research: conceptual, strategic, and statistical considerations. J. Pers. Soc. Psychol. 51, 1173–1182 (1986).

29. 29.

Hayes, A. F. Introduction to Mediation, Moderation, and Conditional Process Analysis A Regression-Based Approach (Guilford Press, 2013).

30. 30.

Wilson, I. A., Gallagher, M., Eichenbaum, H. & Tanila, H. Neurocognitive aging: prior memories hinder new hippocampal encoding. Trends Neurosci. 29, 662–670 (2006).

31. 31.

Chaddock, L., Hillman, C. H., Buck, S. M. & Cohen, N. J. Aerobic fitness and executive control of relational memory in preadolescent children. Med Sci Sport. Exerc 43, 344–349 (2010).

32. 32.

Baym, C. L. et al. Aerobic fitness predicts relational memory but not item memory performance in healthy young adults. J. Cogn. Neurosci. 26, 2645–2652 (2014).

33. 33.

Hayes, S. M. et al. Physical Activity Is Positively Associated with Episodic Memory in Aging. J. Int. Neuropsychol. Soc. 21, 780–790 (2015).

34. 34.

Aberg, M. A. I. et al. Cardiovascular fitness is associated with cognition in young adulthood. Proc. Natl. Acad. Sci. USA 106, 20906–20911 (2009).

35. 35.

Etnier, J. L. et al. The influence of physical fitness and exercise upon cognitive functioning: A meta-analysis. Journal of Sport and Exercise Psychology 19, 249–277 (1997).

36. 36.

Creer, D. J., Romberg, C., Saksida, L. M., van Praag, H. & Bussey, T. J. Running enhances spatial pattern separation in mice. Proc. Natl. Acad. Sci. USA 107, 2367–2372 (2010).

37. 37.

Manganas, L. N. et al. Magnetic resonance spectroscopy identifies neural progenitor cells in the live human brain. Science 318, 980–985 (2007).

38. 38.

Friedman, S. D. Comment on “Magnetic resonance spectroscopy identifies neural progenitor cells in the live human brain”. Science 321, 640c (2008).

39. 39.

Hoch, J. C., Maciejewski, M. W. & Gryk, M. R. Comment on “Magnetic resonance spectroscopy identifies neural progenitor cells in the live human brain”. Science 321, 640b (2008).

40. 40.

Jansen, J. F. A., Gearhart, J. D. & Bulte, J. W. M. Comment on “Magnetic resonance spectroscopy identifies neural progenitor cells in the live human brain”. Science 321, 640d (2008).

41. 41.

Dong, Z., Dreher, W., Leibfritz, D. & Peterson, B. S. Challenges of Using MR Spectroscopy to Detect Neural Progenitor Cells In Vivo. Am. J. Neuroradiol. 30, 1096–1101 (2009).

42. 42.

Ramm, P. et al. A nuclear magnetic resonance biomarker for neural progenitor cells: is it all neurogenesis? Stem Cells 27, 420–423 (2009).

43. 43.

Yassa, M. A., Muftuler, L. T. & Stark, C. E. L. Ultrahigh-resolution microstructural diffusion tensor imaging reveals perforant path degradation in aged humans in vivo. Proc. Natl. Acad. Sci. USA 107, 12687–12691 (2010).

44. 44.

Hyodo, K. et al. The association between aerobic fitness and cognitive function in older men mediated by frontal lateralization. Neuroimage 125, 291–300 (2016).

45. 45.

Prakash, R. S. et al. Cardiorespiratory fitness and attentional control in the aging brain. Front. Hum. Neurosci. 4(229), doi:10.3389/fnhum.2010.00229 (2011).

46. 46.

Voelcker-Rehage, C., Godde, B. & Staudinger, U. M. Physical and motor fitness are both related to cognition in old age. Eur. J. Neurosci. 31, 167–176 (2010).

47. 47.

Pidgeon, L. M. & Morcom, A. M. Cortical pattern separation and item-specific memory encoding. Neuropsychologia 85, 256–271 (2016).

48. 48.

Suwabe, K. et al. Acute moderate exercise improves mnemonic discrimination in young adults. Hippocampus 27, 229–234 (2017).

## Acknowledgements

This work was supported in part by the Education and Research of the Ministry of Education, Culture, Sports, Science and Technology (MEXT) Special Funds 1111501004 (H.S.), the Japan Society for Promotion of Science (JSPS) Grant HFH27016 (H.S.), 23240091 (H.S.), and the US National Institutes of Health Grants R01 MH102392, R21 AG049220, P50 AG16573 (M.A.Y.). We thank members of the Laboratory of Exercise Biochemistry and Neuroendocrinology for their assistance during data collection.

## Author information

Authors

### Contributions

K.S., M.A.Y. and H.S. designed the study. M.A.Y. and H.S. developed the methodology. K.S., G.O. and T. F. collected the data. K.S., K.H. and T.S. performed the analysis. K.S., K.H., K.B., M.K., M.A.Y. and H.S. wrote the manuscript.

### Corresponding author

Correspondence to Hideaki Soya.

## Ethics declarations

### Competing Interests

The authors declare that they have no competing interests.

Publisher's note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Suwabe, K., Hyodo, K., Byun, K. et al. Aerobic fitness associates with mnemonic discrimination as a mediator of physical activity effects: evidence for memory flexibility in young adults. Sci Rep 7, 5140 (2017). https://doi.org/10.1038/s41598-017-04850-y

• Accepted:

• Published:

• ### The Impact of Acute Exercise Timing on Memory Interference

• Lindsay K. Crawford
• , Jeremy B. Caplan
•  & Paul D. Loprinzi

Perceptual and Motor Skills (2021)

• ### Cardiorespiratory fitness, hippocampal subfield volumes, and mnemonic discrimination task performance in aging

• Kathryn L. Kern
• , Thomas W. Storer
•  & Karin Schon

Human Brain Mapping (2021)

• ### Active video games in fully immersive virtual reality elicit moderate-to-vigorous physical activity and improve cognitive performance in sedentary college students

• Caio Victor Sousa
• , Jungyun Hwang
• , Romina Cabrera-Perez
• , Austin Fernandez
• , Aika Misawa
• , Kelsey Newhook
•  & Amy Shirong Lu

Journal of Sport and Health Science (2021)

• ### Acute Sprint Interval Exercise Increases Both Cognitive Functions and Peripheral Neurotrophic Factors in Humans: The Possible Involvement of Lactate

• Sylwester Kujach
• , Robert Antoni Olek
• , Kyeongho Byun
• , Kazuya Suwabe
• , Emilia J. Sitek
• , Ewa Ziemann
•  & Hideaki Soya

Frontiers in Neuroscience (2020)

• ### Cardiorespiratory fitness and mnemonic discrimination across the adult lifespan

• Rachel K. Nauer
• , Karin Schon
•  & Chantal E. Stern

Learning & Memory (2020)


text:
# Find $(x+1)^6 + (x – 1)^6$. Hence, evaluate $( \sqrt2 + 1)^6+(\sqrt 2 –1)^6$.
$\begin{array}{1 1}198 \\ 150 \\ 200 \\ 308 \end{array}$


text:
# colorful background of the chapters in ToC without ''tocloft'' package

I would like to create a table of contents where the chapters appear with a colorful background just like attached Image, and i hope to do this without tocloft ( without packages or with titletoc )

an attempt by Beginner

\documentclass{book}
\usepackage{fancyhdr}
\usepackage{titletoc}
\usepackage[svgnames]{xcolor}

\renewcommand\thesection{\arabic{section}.}
\renewcommand\thesubsection{\arabic{subsection}.\arabic{section}}

\pagestyle{fancy}
\cfoot{\thepage}

\titlecontents*{chapter}
[0pt]
{\colorbox{MidnightBlue}{\textcolor{white}%
{\chaptername\ \thecontentslabel}}}
{}
{\colorbox{MidnightBlue}{\textcolor{white}%
{\hspace{7.5cm}\contentspage}}}

\makeatletter
\let\stdl@chapter\l@chapter
\renewcommand*{\l@chapter}[2]{%
\stdl@chapter{\colorbox{MidnightBlue}{\textcolor{white}{#1}}}{\textcolor{MidnightBlue}{#2}}}
\makeatother

\begin{document}

\tableofcontents

\chapter{Chapter One}
\section{Section Two}
\subsection{Subsection Two}

\end{document}

-
Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Christian Hupfer Aug 15 '14 at 10:33
Please explain why you wish to accomplish your objective without using a specialized LaTeX package. – Mico Aug 15 '14 at 11:32

The easiest way apart from deep hacks, is to put a tighttcolorbox around the \l@chapter command, which is redefined and called internally with the standard values. However, this introduces some vertical spacing above and below the chapter toc entries.

The colours are hardcoded at the moment.

\documentclass{book}%
\usepackage{blindtext}%
\usepackage[svgnames]{xcolor}%

\usepackage{fancyhdr}%
\usepackage{tcolorbox}

\makeatletter
\let\standardlistchapter\l@chapter%

\renewcommand*{\l@chapter}[2]{%
\begin{tcolorbox}[colback={MidnightBlue},
coltext={white},
boxrule=0pt,
boxsep=0pt,%
left=0pt,top=-10pt,
right=0pt,
bottom=0pt,
arc=0pt,
auto outer arc]
\standardlistchapter{\textcolor{white}{#1}}{\textcolor{white}{#2}}%
\end{tcolorbox}%
}%

\renewcommand\thesection{\arabic{section}.}
\renewcommand\thesubsection{\arabic{subsection}.\arabic{section}}

\pagestyle{fancy}
\cfoot{\thepage}

\makeatother

\begin{document}
\tableofcontents%

\chapter{Chapter one}

\section{First}

\blindtext[5]

\chapter{Chapter two}

\section{First}

\blindtext[5]

\end{document}

-


text:
# Finding coordinates of a polynomial with respect to a given basis

Given a basis $B=\{1,\,x+r,\,(x+r)^2\}$ for $\Bbb R[x]_2$, where $r\in\Bbb R$, I'm trying to find the coordinates of the polynomial $p(x)=a_0+a_1x+a_2x^2$ with respect to that basis.

I've got a few ideas as to how to approach this but I'm a little confused. The coordinates of $p(x)$ w.r.t. the standard basis, $S$, are $$[p(x)]_S=\begin{bmatrix}a_0\\a_1\\a_2\end{bmatrix}$$ and let's say we are trying to find: $$[p(x)]_B=\lambda=\begin{bmatrix}\lambda_0\\\lambda_1\\\lambda_2\end{bmatrix}$$

I think I'm right in saying that the basis, $B$, can be expressed as a matrix: $$B_M=\begin{bmatrix}0&0&1\\0&1&r\\1&2r&r^2\end{bmatrix}$$

Now I know the general formula saying that to find the coordinates of a vector w.r.t. a new basis, you multiply the coordinates of the vector w.r.t. to the standard basis by the inverse of the matrix formulated from the new, given basis, so I'll do this below:

$${B_M}^{-1}=\begin{bmatrix}r^2&-2r&1\\-r&1&0\\1&0&0\end{bmatrix}$$

$$\therefore \quad \begin{bmatrix}\lambda_0\\\lambda_1\\\lambda_2\end{bmatrix}=\begin{bmatrix}r^2&-2r&1\\-r&1&0\\1&0&0\end{bmatrix}\begin{bmatrix}a_0\\a_1\\a_2\end{bmatrix}$$

$$\implies \quad \begin{bmatrix}\lambda_0\\\lambda_1\\\lambda_2\end{bmatrix}=\begin{bmatrix}a_0r^2-2ra_1+a_2\\-a_0r+a_1\\a_0\end{bmatrix}$$

But I'm not sure where to go from here - are these simply my new coordinates or is there something else I must do?

Any help is very much appreciated. Thank you.

• Your base matrix looks weird. Why not $$B_M = \begin{pmatrix} 1 & r & r^2 \\ 0 & 1 & 2r \\ 0 & 0 & 1 \end{pmatrix}$$? We should have $B_M \to \text{I}$ for $r \to 0$, or? – mvw Dec 24 '15 at 21:33
• Yeah I've just realised that this is probably the key to why I'm going wrong. Could you please tell me what the procedure for forming the change of basis matrix is and why my way makes it go wrong? – mathphys Dec 24 '15 at 21:36
• If $a_0$ is the first coordinate, and $b_1 = B_m e_1$ etc, where $e_i$ is the $i$-th canonical base vector, it must be sorted like I did. – mvw Dec 24 '15 at 21:38
• I see, that makes more sense now. So what you're saying is that the change of basis matrix $B_M$ applied to each standard basis vector gives each respective non-standard basis vector, and if we apply this matrix to a given coordinate (w.r.t. the standard basis) we get the coordinate but this time in its new basis form, correct? – mathphys Dec 24 '15 at 21:45
• The above $B_M$ just contains the $b_i$ in coordinates regarding to the standard base. The coordinate transformation $T$ should map $T b_i = e_i$, because $b_i$ has coordinates $e_i$ regarding base $B$. So $I = T (b_1, b_2, b_3) = T\, B_M \iff T = I \, B_M^{-1} = B_M^{-1}$. – mvw Dec 24 '15 at 22:31

The change of basis matrix from $B$ to $S$ is

$$P = \begin{pmatrix} 1 & r & r^2 \\ 0 & 1 & 2r \\ 0 & 0 & 1\end{pmatrix},$$

so the change of basis matrix from $S$ to $B$ is

$$P^{-1} = \begin{pmatrix} 1 & -r & r^2 \\ 0 & 1 & -2r \\ 0 & 0 & 1\end{pmatrix}.$$

Hence the $B$-coordinates of $p(x) = a_0 + a_1 x + a_2x^2$ are

$$P^{-1}\begin{pmatrix} a_0 \\ a_1 \\ a_2 \end{pmatrix} = \begin{pmatrix} a_0 - a_1r + a_2 r^2 \\ a_1 - 2a_2 r \\ a_2 \end{pmatrix}.$$

• Thank you for your answer - how did you form your change of basis matrix from $B$ to $S$? I seem to have formed mine row-wise with regards to the basis and you've formed yours column wise. Why is doing it your way correct? – mathphys Dec 24 '15 at 21:31
• I guess what I'm trying to ask is: why is the change of basis matrix, $P$, a matrix made up of columns (of the coordinates of the basis elements) arranged in the order that the elements are given in the original basis, $B$? – mathphys Dec 24 '15 at 21:40
• @mathphys That's the definition of a change of basis matrix. The matrix $P$ represents the identity linear transformation from the basis $B$ to the basis $S$. To represent linear maps as matrices, one writes the components of the transformed old basis vectors in terms of the new basis vectors as columns of a matrix. – Alex Provost Dec 24 '15 at 23:14

Hint:

You just have to use Taylor's formula for polynomials, which is a exact formula. For a polynomial of degree $2$, you have (in function of the powers of $x\color{red}{\boldsymbol-} r$, which is the usual form of this formula): \begin{align*} P(x)&=P(r)+P'(r)(x-r)+\frac{P''(r)}{2!}(x-r)^2,\\ \text{whence}\qquad P(x)&=P(r)+P'(-r)(x+r)+\frac{P''(-r)}{2!}(x+r)^2. \end{align*}


text:
1. ## Partial Fractions

$\frac{2x-3}{x(x^2+1)} \Rightarrow 2x-3 = \frac{A}{x} + \frac{Bx+C}{x^2+1}$ The question is, how does the numerator on $x^2 + 1$ equal $Bx + C$ ?

2. Because $x^2+1$ is irreducible over $\Bbb R$.

3. Originally Posted by lilaziz1
$\frac{2x-3}{x(x^2+1)} \Rightarrow 2x-3 = \frac{A}{x} + \frac{Bx+C}{x^2+1}$ The question is, how does the numerator on $x^2 + 1$ equal $Bx + C$ ?
If the denominator of the rational expression has an irreducible quadratic factor, then you have to account for the possible "size" of the numerator. If the denominator contains a degree-two factor, then the numerator might not be just a constant; it might be of degree one. So you would deal with a quadratic factor in the denominator by including a linear expression in the numerator.

quoted from this site ...

Partial-Fraction Decomposition: Repeated and Irreducible Factors

4. Originally Posted by lilaziz1
$\frac{2x-3}{x(x^2+1)} \Rightarrow 2x-3 = \frac{A}{x} + \frac{Bx+C}{x^2+1}$ The question is, how does the numerator on $x^2 + 1$ equal $Bx + C$ ?
You need to combine the two fractions such that there will be no $x^2$ term in the resulting numerator

$\frac{A}{x}+\frac{Bx+C}{x^2+1}=\frac{x^2+1}{x^2+1} \ \frac{A}{x}+\frac{x}{x}\ \frac{Bx+C}{x^2+1}$

$=\frac{Ax^2+A+Bx^2+Cx}{x\left(x^2+1\right)}$

This allows the $x^2$ terms to cancel as $B=-A,$

Also $C=2,\ A=-3$


text:
## Recommended Posts

##### Share on other sites
It's very difficult to read your code. Try editing your post, using [source]code()[/source] tags. That will preserve tabs etc. and put the code in a text-box, like this:
int code() {	return 1;}

##### Share on other sites
Hi, In main loop for first : I visualize all objects and for second : use SHADOW_FOR_OBJECT() for all objects.
my depth pass stencil shadow algorithm for shadow cast is here :

void SHADOW_FOR_OBJECT(object obj, float lp[4]) //lp = light position{ unsigned int	i, j, k, jj; unsigned int	p1=0, p2=0; vertex		v1, v2, v3, v4; float		side; for (i=0; i < obj.number_of_faces; i++) {		// chech to see if light is in front or behind the plane (face plane)  side = obj.faces[i].ro_no.a*lp[0] + obj.faces[i].ro_no.b*lp[1] + obj.faces[i].ro_no.c*lp[2] + obj.faces[i].ro_no.d*lp[3];  if (side > 0.0) obj.faces[i].light_visible = 1; else obj.faces[i].light_visible = 0; } glEnable(GL_BLEND); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glDepthMask(GL_FALSE); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glEnable(GL_STENCIL_TEST); glColorMask(0, 0, 0, 0); glStencilFunc(GL_ALWAYS, 1, 0xffffffff); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); for (i=0; i < obj.number_of_faces; i++) {  if (obj.faces[i].light_visible)  {   for (j=0; j<3; j++)   {	k = obj.faces[i].conectivity[j];	if ((!k) || (!obj.faces[k-1].light_visible))    {      v1.x = obj.vertex[obj.faces[i].vertex_index[j]].x;      v1.y = obj.vertex[obj.faces[i].vertex_index[j]].y;      v1.z = obj.vertex[obj.faces[i].vertex_index[j]].z; 	  v2.x = obj.vertex[obj.faces[i].vertex_index[(j+1)%3]].x;      v2.y = obj.vertex[obj.faces[i].vertex_index[(j+1)%3]].y;      v2.z = obj.vertex[obj.faces[i].vertex_index[(j+1)%3]].z;      v3.x = (v1.x - lp[0]);	  v3.y = (v1.y - lp[1]);	  v3.z = (v1.z - lp[2]);	  v4.x = (v2.x - lp[0]);	  v4.y = (v2.y - lp[1]);	  v4.z = (v2.z - lp[2]);      glBegin(GL_TRIANGLE_STRIP);	  glVertex3f(v1.x, v1.y, v1.z);      glVertex4f(v3.x, v3.y, v3.z, 0.0);      glVertex3f(v2.x, v2.y, v2.z);	  glVertex4f(v4.x, v4.y, v4.z, 0.0);	  glEnd();    }   }  } }	// second pass, stencil operation increases stencil value glCullFace(GL_FRONT); glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);for (i=0; i < obj.number_of_faces; i++) {  if (obj.faces[i].light_visible)  {   for (j=0; j<3; j++)   {	k = obj.faces[i].conectivity[j];	if ((!k) || (!obj.faces[k-1].light_visible))    {      v1.x = obj.vertex[obj.faces[i].vertex_index[j]].x;      v1.y = obj.vertex[obj.faces[i].vertex_index[j]].y;      v1.z = obj.vertex[obj.faces[i].vertex_index[j]].z; 	  v2.x = obj.vertex[obj.faces[i].vertex_index[(j+1)%3]].x;      v2.y = obj.vertex[obj.faces[i].vertex_index[(j+1)%3]].y;      v2.z = obj.vertex[obj.faces[i].vertex_index[(j+1)%3]].z;	  /// Projecting this edge to "infinity"      v3.x = (v1.x - lp[0]);	  v3.y = (v1.y - lp[1]);	  v3.z = (v1.z - lp[2]);	  v4.x = (v2.x - lp[0]);	  v4.y = (v2.y - lp[1]);	  v4.z = (v2.z - lp[2]);      glBegin(GL_TRIANGLE_STRIP);	  glVertex3f(v1.x, v1.y, v1.z);      glVertex4f(v3.x, v3.y, v3.z, 0.0);      glVertex3f(v2.x, v2.y, v2.z);	  glVertex4f(v4.x, v4.y, v4.z, 0.0);	  glEnd();    }   }  } }}

At the finish in main loop apply two rectangle :
glCullFace(GL_BACK);  glColorMask(1, 1, 1, 1);  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);  glStencilFunc(GL_NOTEQUAL, 0, 0xffffffff);  glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);  glPushMatrix();  glLoadIdentity();  glColor4f(0.0, 0.0, 0.0, 0.1);  //first  glBegin(GL_TRIANGLE_STRIP);  glVertex3f(-0.1, 0.1,-0.1);  glVertex3f(-0.1,-0.1,-0.1);  glVertex3f( 0.1, 0.1,-0.1);  glVertex3f( 0.1,-0.1,-0.1);  glEnd();  glPopMatrix();  glDisable(GL_BLEND);  glDepthMask(GL_TRUE);  glDisable(GL_STENCIL_TEST);  glEnable(GL_TEXTURE_2D);  glPushMatrix();  glLoadIdentity();  glColor4f(0.7, 0.6, 0.95, 1.0);  //second    glBegin(GL_TRIANGLE_STRIP);   glVertex3f(-1000.0, 1000.0,-1000.0);  glVertex3f(-1000.0,-1000.0,-1000.0);  glVertex3f( 1000.0, 1000.0,-1000.0);  glVertex3f( 1000.0,-1000.0,-1000.0);  glEnd();  glPopMatrix();  glEnable(GL_LIGHTING);

Here is set up for conectivity function :
void SETUP_CONECTIVITY(object *obj){ unsigned int p1i, p2i, p1j, p2j; unsigned int P1i, P2i, P1j, P2j; unsigned int i,j,ki,kj; for(i=0; i<obj->number_of_faces-1; i++)  for(j=i+1; j<obj->number_of_faces; j++)   for(ki=0; ki<3; ki++)	if( !obj->plochy[i].conectivity[ki])    {	 for( kj=0; kj<3; kj++)     {	  p1i=ki;	  p1j=kj;	  p2i=(ki+1)%3;	  p2j=(kj+1)%3;	  p1i=obj->faces[i].vertex_index[p1i];	  p2i=obj->faces[i].vertex_index[p2i];	  p1j=obj->faces[j].vertex_index[p1j];	  p2j=obj->faces[j].vertex_index[p2j];      P1i=((p1i+p2i)-abs(p1i-p2i))/2;	  P2i=((p1i+p2i)+abs(p1i-p2i))/2;      P1j=((p1j+p2j)-abs(p1j-p2j))/2;	  P2j=((p1j+p2j)+abs(p1j-p2j))/2;	  if ((P1i==P1j) && (P2i==P2j))      {  //they are neighbours	   obj->faces[i].conectivity[ki] = j+1;	   obj->faces[j].conectivity[kj] = i+1;	  } 	 }    }}

And plane for all faces in obect :
void PLANE_OF_FACE(object *obj){ vertex v1, v2, v3; int p; for (p=0; p<obj->number_of_faces; p++) {  v1.x = obj->vertex[obj->faces[p].vertex_index[0]].x;  v1.y = obj->vertex[obj->faces[p].vertex_index[0]].y;  v1.z = obj->vertex[obj->faces[p].vertex_index[0]].z;  v2.x = obj->vertex[obj->faces[p].vertex_index[1]].x;  v2.y = obj->vertex[obj->faces[p].vertex_index[1]].y;  v2.z = obj->vertex[obj->faces[p].vertex_index[1]].z;  v3.x = obj->vertex[obj->faces[p].vertex_index[2]].x;  v3.y = obj->vertex[obj->faces[p].vertex_index[2]].y;  v3.z = obj->vertex[obj->faces[p].vertex_index[2]].z;  obj->faces[p].ro_no.a = v1.y*(v2.z-v3.z) + v2.y*(v3.z-v1.z) + v3.y*(v1.z-v2.z);  obj->faces[p].ro_no.b = v1.z*(v2.x-v3.x) + v2.z*(v3.x-v1.x) + v3.z*(v1.x-v2.x);  obj->faces[p].ro_no.c = v1.x*(v2.y-v3.y) + v2.x*(v3.y-v1.y) + v3.x*(v1.y-v2.y);  obj->faces[p].ro_no.d = - (v1.x*(v2.y*v3.z-v3.y*v2.z)   		                   + v2.x*(v3.y*v1.z-v1.y*v3.z)    		               + v3.x*(v1.y*v2.z-v2.y*v1.z)); }}

Maybe it will help.

[Edited by - Christobal_de_M on February 24, 2010 1:22:02 PM]

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627762
• Total Posts
2978971
• ### Similar Content

• Hello! As an exercise for delving into modern OpenGL, I'm creating a simple .obj renderer. I want to support things like varying degrees of specularity, geometry opacity, things like that, on a per-material basis. Different materials can also have different textures. Basic .obj necessities. I've done this in old school OpenGL, but modern OpenGL has its own thing going on, and I'd like to conform as closely to the standards as possible so as to keep the program running correctly, and I'm hoping to avoid picking up bad habits this early on.
Reading around on the OpenGL Wiki, one tip in particular really stands out to me on this page:
For something like a renderer for .obj files, this sort of thing seems almost ideal, but according to the wiki, it's a bad idea. Interesting to note!
So, here's what the plan is so far as far as loading goes:
Set up a type for materials so that materials can be created and destroyed. They will contain things like diffuse color, diffuse texture, geometry opacity, and so on, for each material in the .mtl file. Since .obj files are conveniently split up by material, I can load different groups of vertices/normals/UVs and triangles into different blocks of data for different models. When it comes to the rendering, I get a bit lost. I can either:
Between drawing triangle groups, call glUseProgram to use a different shader for that particular geometry (so a unique shader just for the material that is shared by this triangle group). or
Between drawing triangle groups, call glUniform a few times to adjust different parameters within the "master shader", such as specularity, diffuse color, and geometry opacity. In both cases, I still have to call glBindTexture between drawing triangle groups in order to bind the diffuse texture used by the material, so there doesn't seem to be a way around having the CPU do *something* during the rendering process instead of letting the GPU do everything all at once.
The second option here seems less cluttered, however. There are less shaders to keep up with while one "master shader" handles it all. I don't have to duplicate any code or compile multiple shaders. Arguably, I could always have the shader program for each material be embedded in the material itself, and be auto-generated upon loading the material from the .mtl file. But this still leads to constantly calling glUseProgram, much more than is probably necessary in order to properly render the .obj. There seem to be a number of differing opinions on if it's okay to use hundreds of shaders or if it's best to just use tens of shaders.
So, ultimately, what is the "right" way to do this? Does using a "master shader" (or a few variants of one) bog down the system compared to using hundreds of shader programs each dedicated to their own corresponding materials? Keeping in mind that the "master shaders" would have to track these additional uniforms and potentially have numerous branches of ifs, it may be possible that the ifs will lead to additional and unnecessary processing. But would that more expensive than constantly calling glUseProgram to switch shaders, or storing the shaders to begin with?
With all these angles to consider, it's difficult to come to a conclusion. Both possible methods work, and both seem rather convenient for their own reasons, but which is the most performant? Please help this beginner/dummy understand. Thank you!

• I want to make professional java 3d game with server program and database,packet handling for multiplayer and client-server communicating,maps rendering,models,and stuffs Which aspect of java can I learn and where can I learn java Lwjgl OpenGL rendering Like minecraft and world of tanks

• A friend of mine and I are making a 2D game engine as a learning experience and to hopefully build upon the experience in the long run.

-What I'm using:
C++;. Since im learning this language while in college and its one of the popular language to make games with why not.     Visual Studios; Im using a windows so yea.     SDL or GLFW; was thinking about SDL since i do some research on it where it is catching my interest but i hear SDL is a huge package compared to GLFW, so i may do GLFW to start with as learning since i may get overwhelmed with SDL.
-Questions
Knowing what we want in the engine what should our main focus be in terms of learning. File managements, with headers, functions ect. How can i properly manage files with out confusing myself and my friend when sharing code. Alternative to Visual studios: My friend has a mac and cant properly use Vis studios, is there another alternative to it?

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.

• 11
• 10
• 10
• 23
• 14