text:
# Integrated Applications¶

## Volt-var Optimization (VVO)¶

The sample VVO application is a Python implementation of a heuristic method that PNNL has investigated before [CIT3], [CIT4], [CIT5]. There are more advanced VVO methods that will be implemented in future work.

## Visualization¶

We have created a web-based visualization of the sample VVO application. The visualization displays the topology of the IEEE 8500-Node system as an interactive graph. Capacitors and regulators are highlighted in the graph and displayed alongside tables with current values for capacitor status (OPEN or CLOSED), regulator voltage, and feeder power.

## State Estimator Service¶

Given a perfect and complete set of voltage magnitude and angle measurements, along with a detailed and accurate power system model, one could calculate the real power, or any other electrical variable of interest, anywhere in the system. In practice, measurements have errors, time delays, and may even be missing. State estimation refers to the process of minimizing the errors and filling in gaps [1]. One state estimation method is called “weighted least squares”, and it’s analogous to drawing the best-fit line through a set of scattered points. Other methods may perform better [2]. Also, on distribution systems, it may be better to estimate branch currents instead of node voltages, but the principle is the same. In GridAPPS-D, the visualizations and applications ought to use the best available state estimator outputs, instead of raw SCADA values, for both accuracy and consistency. Therefore, the state estimator is not an application but a service in GridAPPS-D, sitting between emulated SCADA and the GOSS bus.

Figure 1: The state estimator processes noisy and incomplete measurements, then posting estimated voltage (V), current (I), real power (P), reactive power (Q) and switch status (S) values onto the GridAPPS-D message / data bus.

In Figure 1, the power system model (upper left) will include a limited number of sensors, corresponding to actual voltage and current transformers, line post sensors, wireless sensors, etc. In some scenarios, smart meters can also be sensors. Each such sensor will have different performance characteristics (e.g. precision, accuracy, sampling rate). Distribution systems typically do not have enough sensors to make the system observable, so there will be measurement gaps in the topology. The state estimator might fill these gaps with interpolation and graph-tracing methods on the power system model.

The supervisory control and data acquisition (SCADA) system in Figure 1 introduces more errors and failure points. Eventually, GridAPPS-D may simulate these impacts by federating ns-3 as a co-simulator. Until then, a placeholder module could be used to insert variable errors, time delays and dropouts in each measurement, whether due to sensor characteristics or the communication system. The output represents data as it would come into an operations center, and feeds the state estimator. Internally, the data flows between simulator, SCADA and state estimator might be implemented with FNCS, but this is an implementation detail. The state estimator will provide two outputs to the GOSS bus used by all GridAPPS-D applications:

1. At a time step configured by the platform, publish the best-estimate VIPQS values wherever sensors actually exist in the model, with quality attributes that still have to be established. Sensor locations delineate circuit segments, and note that all VIPQS values will be estimated at the boundaries, even if the sensor measures only V or I, for example.
2. Upon request by another application or service, publish the estimated VIPQS values for all nodes and components in the model, even at locations where no sensors exist. A variant is to publish the estimates only for selected nodes and components.

As indicated in Figure 1, other applications need to obtain estimated VIPQS values from the GOSS bus. Switch open/close states are a special case; they might be considered known values, but in practice the switch state is a measurement, which could lead to topology errors in the model. For GridAPPS-D, switch state estimates need to be a point of emphasis. Given that most distribution systems lack redundant measurements, It would be possible for an application to query these VIPQS values directly from the simulator or SCADA, bypassing the state estimator, but this is “cheating” in most situations. However, in the application development process, idealized VIPQS values could be obtained through a combination of two methods:

1. Add more sensors to the power system model
2. Set the sensor and channel errors to zero

Because the sensor outputs in GridAPPS-D come from a power flow solution that enforces Kirchhoff’s Laws, the state estimator will produce ideally accurate values whenever the sensor and channel errors have been specified to be zero. The state estimator may still exhibit interpolation errors between sensor locations, but that is readily mitigated for testing purposes by adding more sensors.

With reference to RC1, the visualization and VVO applications should now subscribe to VIPQS values from the state estimator, not from the distribution simulator. They may also use or display quality metrics on the estimated values.

### Design Objectives¶

State estimation is widely used in transmission system operations but is less common in distribution system operations due to a relatively limited value in traditional distribution systems, additional computational complexity, and a lack of sensors. Advanced distribution management platforms like GridAPPS-D provide access to model and sensor data that can be leveraged to overcome barriers to adoption and open the door to distribution system state estimators that are fast and accurate enough to be useful in utility operations.

A distribution system state estimator computes the most likely state given a set of present and/or past measurements. The full state of a distribution system consists of either the full set of complex bus voltages or the full set of complex branch currents; given the system model (admittance matrix), the remaining system parameters can be computed given the full system state.

### Use Cases¶

• Assist power factor optimization: Utility objective is unity power-factor at the substation.
• Assist voltage optimization (planning): Utility objective is 1 p.u. voltage at last house primary.
• Real-time state estimation for advanced applications: applications can access the state estimate at a sufficient resolution to capture e.g. insolation variation caused by clouds.

### Algorithms¶

State estimation uses system model information to produce an estimate of the state vector x given a measurement vector z. The measurement vector is related to the state vector and an error vector by the measurement function, which may be non-linear.

$z = h(x) + e$

Multiple formulations of the distribution system state estimation problem are possible:

1. Node Voltage State Estimation (NVSE): The state vector consists of node voltage magnitudes and angles for each node in the system (one reference angle can be eliminated from the state vector). This formulation of the state estimation problem is general to any topology and it is the standard for transmission system state estimation.
2. Branch Current State Estimation (BCSE): Radial topology and assumptions about shunt losses create a linear formulation of the state estimation problem. The state vector contains branch currents and, for a fully-constrained problem, requires one state per load, which can be less than the number of branches in the system.

Different algorithms provide different advantages for distribution system state estimation. A subset of the state estimation algorithms below will be used to achieve these goals.

1. Weighted Least Squares Estimation (WLSE): a concurrent set of measurements are used to find a state vector that minimizes the weighted least squares objective function. The algorithm is memoryless with respect to previous solutions and measurements should be synchronized.
2. Kalman Filter Estimation (KFE) and Extended Kalman Filter Estimation (EKFE): The Kalman filter provides a mechanism to consider past state estimates alongside present measurements. This provides additional noise rejection and allows asynchronous measurements can be considered individually. KFE is appropriate for linear BCSE and EKFE is compatible with nonlinear NVSE.
3. Unscented Kalman Filter Estimation (UKFE): The unscented transform estimates the expected value and variance of the system state by observing the system outputs for inputs spanning the full dimensionality of the measurement space. Again, the Kalman filter provides a mechanism to consider past estimates.

### TRL¶

The state estimator application will provide the capability to estimate the full system state using asynchronous measurement data. In addition a model order reduction technique will be implemented to greatly speed up the state estimation computation and to reduce the dependence on forecast-based pseudo-measurements. A paper (Reduced-Order State Estimation for Power Distribution Systems with Sparse Sensing) is targeted for IEEE Transactions on Power Systems.

### Architecture¶

The state estimation service is being developed in c++. A modern c++ implementation allows the application to adapt to an evolving interface. The program architecture is shown below.

Topology Processor: initializes the measurement function and its Jacobian and determines the size of the measurement vector, the measurement covariance matrix, and the state vector.

Meter Interface: updates the measurement vector and the measurement covariance matrix as new measurement data comes available.

State Estimator: performs the state estimation operation according to the specified algorithm.

Output Interface: formats the state vector and any implicit states as an output stream.

### Inputs¶

Upon initialization, the topology processor will receive the Y-bus from the GridLAB-D service and will query contextual information and sensor locations from the CIM database.

Periodic measurement data, including any forecasts to be used a pseudo-measurements will be required as inputs.

A “terminate” command from the platform will end the state estimation process.

### Outputs¶

The output will include the full system state (node voltages and/or branch currents TBD).

### Testing and Validation¶

Evaluation metrics

• State Error: compare state estimation output to “true” system state.
• Accuracy over baseline: compare state error of state estimator to state error of a QSTS load-flow model.
• Execution Time

Scenarios

• Full sensor deployment: verify that the true system state can be reproduced.
• Sparse sensor deployment: verify that the state estimator performs better than a QSTS load-flow model.
• Breaker trip: verify that switch state can be detected even when it is reported incorrectly.
• Bad sensor detection: verify that a sensor that is producing bad data can be identified.
• Dependent application support: verify that the state estimator can support e.g. the VVO application.
• Fault: for a radial system, determine the nearest common bus from multiple emulated customer calls.

### Operating/Running¶

The state estimator will execute the topology processor at initialization and will enter a stat estimation loop. The state estimation loop will exit and the process will end upon receiving a ‘terminate’ command from the platform.

At initialization, a configuration file will be read for:

• State estimation mode (state vector and algorithm) selection
• Normalized residual threshold for bad measurement / sensor detection

### References¶

[1] T. E. McDermott, “Grid Monitoring and State Estimation,” in Smart Grid Handbook, ed: John Wiley & Sons, Ltd, 2016.

[2] A. Abur and A. Gómez Expósito, Power system state estimation : theory and implementation. New York, NY: Marcel Dekker, 2004.

[3] M. E. Baran and A. W. Kelley, “A branch-current-based state estimation method for distribution systems,” in IEEE Transactions on Power Systems, vol. 10, no. 1, pp. 483-491, Feb 1995.

[4] Z. Jia, J. Chen and Y. Liao, “State estimation in distribution system considering effects of AMI data,” 2013 Proceedings of IEEE Southeastcon, Jacksonville, FL, 2013, pp. 1-6.

[5] S. C. Huang, C. N. Lu and Y. L. Lo, “Evaluation of AMI and SCADA Data Synergy for Distribution Feeder Modeling,” in IEEE Transactions on Smart Grid, vol. 6, no. 4, pp. 1639-1647, July 2015.

[6] M. Kettner; M. Paolone, “Sequential Discrete Kalman Filter for Real-Time State Estimation in Power Distribution Systems: Theory and Implementation,” in IEEE Transactions on Instrumentation and Measurement, vol.PP, no.99, pp. 1-13, Jun. 2017.

[7] G. Valverde and V. Terzija, “Unscented kalman filter for power system dynamic state estimation,” in IET Generation, Transmission & Distribution, vol. 5, no. 1, pp. 29-37, Jan.

## Model Validation Application¶

The state estimator basically attempts to fit measured data to a power flow model, usually assuming that the model is correct. However, a model attribute (e.g. line impedance) could also be estimated by minimizing its error residual in the state estimator’s power flow solution. This process works best when applied to just one or a few suspect attributes, and/or when an archive is available to provide enough redundant measurements. The Model Validation Application will use these state estimator features off-line to help identify and correct the following types of model errors:

1. Unknown or incorrect service transformer sizes
2. Unknown or incorrect secondary circuit lengths
3. Incorrect phase identification of single-phase components
4. Phase wiring errors in line segments and switches
5. Transformer connection errors, especially reversed primary and secondary
6. Primary conductor sizes that don’t decrease monotonically with distance from the source
7. Missing regulator and capacitor control settings (i.e. supply defaults from heuristic rules)
8. More than one of these on the same pole: recloser, line regulator, capacitor
9. Substation transformer impedance and turns ratio

These types of errors often appear upon the initial model import from a geographic information system (GIS), or in periodic model updates from GIS. Other error types may be added later. Many utilities do not have their secondary circuits modeled at all, but this has an important impact on AMI data. The service transformers and secondary circuits insert significant impedance between AMI meters and the primary circuit, where most of the other sensors are installed. Therefore, the first two items will require AMI data, and also enable its more effective use.

As shown in Figure 1, the Model Validator integrates with GridAPPS-D as a hosted application on the GOSS bus. Internally, it will use some of the same algorithms as the State Estimator and may share some code or binary files, but this is an implementation detail. It will need to access an archive of state-estimated VIPQS data, which may include AMI data. It will also use or incorporate an off-line power flow model, not the same one running in the GridAPPS-D distribution simulator. This may be EPRI’s OpenDSS simulator [1]; compared to GridLAB-D, it’s more tolerant of model errors and provides more diagnostic information about model errors.

Figure 1: The Model Validator works with an archive from the state estimator, and an off-line power flow model.

### Design Objectives¶

The model validator will detect and attempt to correct unreasonable component interconnections and network parameters. The model validation application will be implemented in Python.

### Use Cases¶

• Valid transformer size and orientation (Utility): orientation is not captured explicitly in their GIS system.
• Discover secondary line impedance parameters (Utility) conductor type and line length are currently based on generic assumptions.
• Sanity check or estimate transformer size and impedance.
• Verify that the nominal voltage of nodes matches the base voltage of the segment: generally the winding voltage of the upstream transformer or swing bus voltage.
• Sanity check conductor sizes and line current ratings.
• Validate and fill in regulator and capacitor control settings.
• Check phase continuity (GridLAB-D may not model phase discontinuities)

### Inputs¶

The model validator will have access to the CIM database and archived data from the state estimator.

### Outputs¶

The model validator will one or both of the following outputs:

• Model status: log file or GUI pipe for identified issues.
• Model correction: CIM updates to correct identified issues.

### Testing and Validation¶

Evaluation metrics

• Ability to detect known issues.

Scenarios

• Utility merger: models with different format may be interpreted differently, creating issues a CIM model.
• Data entry issue: model update does not match upgrade performed in the field

### Operating/Running¶

The model validator script will execute once when called by the platform.

At initialization, a configuration file will be read for:

• Mode (status, quiet, verbose; see outputs section)
• Selectable validation items (use cases)

### References¶

[1] R. C. Dugan and T. E. McDermott, “An open source platform for collaborating on smart grid research,” in Power and Energy Society General Meeting, 2011 IEEE, 2011, pp. 1-7.

## Transactive Systems Application¶

Transactive energy is a method of controlling loads and resources on the distribution system, combining both market and electrical principles [1]. One reason for including this application in DOE-funded GridAPPS-D is that PNNL has made several technical contributions and led several demonstration projects in transactive systems, also funded by DOE [2].

Application structure

This transactive systems application is to be implemented as a modularized 2-layer 3-level structure, as seen from Figure 3. The layer decomposition helps the control of various groups, with limited information flow between different layers. With the predefined functions in each agent type (Agent A, B, and C) in each level, the existing transactive system related work can be conveniently integrated into the application, and the new control features can be added into specific control function in each type of the agent easily.

Figure 3: The structure of the modularized 2-layer 3-level transactive system application

The modularized agents opens the door for integrating different control mechanisms into the application. Users need to consider which level their control algorithm fits into, and fill in the control function of the Agent class in that level, without worrying about communications between the agents. In each level, the same type of the agent may have various control functions, which help combining benefits of different control schemes together.

Agent A, B and C will be implemented as VOLTTRON applications. VOLTTRON is an application platform for distributed sensing and control applications [3]. With the capability of hardware-in-the-loop (HIL) testing through VOLTTRON, the transactive systems application will be tested using the actual devices. A GOSS-VOLTTRON Bridge is to be implemented, for the communication between GridAPPS-D and the VOLTTRON agents in the transactive systems application.

Application test cases

The hierarchical control framework introduced in [4] for integrated coordination between distributed energy resources and demand response will be implemented into the application. In addition, [4] has not considered the power losses or power constrains, which will be taken into consideration in this test case. The two-layer control mechanism, including the coordination layer and device layer, fits the proposed structure of the application well. The control in each level will be implemented into corresponding function in each type of the agent. The IEEE 123-node test feeder built in GridLAB-D will be used for testing the application.

CIM extension for the Application

The latest versions of GridAPPS-D has used a reduced-order CIM to support feeder modeling. With transactive system application included into GridAPPS-D platform, more objects, such as house air conditioner and water heater, need to be defined in CIM. Before the definition in CIM, a simplified version of the house object and water heater object are to be implemented in GridLAB-D.

### References¶

[1] Gridwise Architecture Council. (2017). Transactive Energy. Available: http://www.gridwiseac.org/about/transactive_energy.aspx

[2] Pacific Northwest National Laboratory. (2017). Transactive Energy Simulation Platform (TESP). Available: http://tesp.readthedocs.io/en/latest/

[3] S. Katipamula, J. Haack, G. Hernandez, B. Akyol, and J. Hagerman, “VOLTTRON: An Open-Source Software Platform of the Future,” IEEE Electrification Magazine, vol. 4, pp. 15-22, 2016.

[4] Di Wu, Jianming Lian, Yannan Sun, Tao Yang, Jacob Hansen, “Hierarchical control framework for integrated coordination between distributed energy resources and demand response,” Electric Power Systems Research, pp. 45-54, May 2017.

## Distribution Optimal Power Flow for Real-Time Setpoint Dispatch¶

### Objectives¶

This application is designed to address the problem of optimizing the operation of aggregations of heterogeneous energy resources connected to a distribution system. We will focus on real=time optimization method and the power setting points of the distributed energy resources (DERs) will be updated on a second or subsecond timescale to maximize the operational objectives while coping with the variability of ambient conditions and noncontrollable energy assets [1]. In order to avoid massive measurements and overcome the limitation caused by model inaccuracy, this application will be implemented in a distributed manner, and only local measurements and a feedback signal from the substation aggregator are needed to determine the optimal setpoints for each controlled DER unit.

Figure 1 The conceptual framework of distribution OPF for real=time setpoint dispatch.

Figure 1 shows the conceptual framework of this application, and this application is targeting at TRL 3.

### Design¶

Figure 2 describes the overall work flow of the application. Distribution OPF algorithm requires real=time measurements, distribution system model and power flow results, which will be obtained from GridAPPS=D platform through GOSS/FNCS message bus. The optimization problem formulation can be constructed using user=defined cost functions for different controllable devices. Finally the optimal setpoints for controllable devices will be solved based on the feedback information from system measurements. These setpoints will be sent back to GridLab=D grid model to update DER operations. Such a closed=loop control forms the control iteration for the studied time point, and new setpoints for the following time points will be determined in the same manner using the updated model and measurements.

Figure 2 The workflow of real=time setpoint dispatch application and its interaction with GridApps=D.

### Data requirements¶

The DER application requires p and q values from the inverters attached to PVs, loads, and capacitors. The DER application also requires setting the p and q values of inverters attached to PVs.

### Testing and Validation¶

Evaluation metrics of this application:

• Real/reactive power at the substation
• System loss
• Voltages across the entire distribution grid: voltage magnitude, voltage fluctuation, voltage unbalance.
• Legacy control device operations: total control actions of all capacitors and regulators

Scenarios:

• Optimal Dispatch for Distributed PV Systems
• Optimal Dispatch for Distributed PV + Energy Storage
• Etc. (will be added when implementing the application)

### Operating/Running¶

This application will be developed using Python.

### References¶

[1] E. Dall’Anese, A. Bernstein, and A. Simonetto, “Feedback=based Projected=gradient Method for Real=time Optimization of Aggregations of Energy Resources,” IEEE Global Conference on Signal and Information Processing (GlobalSIP), Montreal, Canada, Nov. 2017.

## Short-Term Grid Forecasting¶

### Objectives¶

Today’s distribution systems have been experiencing a significant transformation due to an increasing amount of smart electric loads and distributed energy resources, such as electric vehicles, smart home appliances, rooftop photovoltaic systems, and energy storage. As more flexible resources integrated into distribution systems, coordination among various flexible resources plays an important role in distribution system operations to optimally manage distribution assets and flexible resources. On the other hand, with the increasing penetration of variable energy resources, it is crucial for system operators to not only monitor and estimate the current grid conditions but also forecast the future system status, which allows for proactive dispatch of controllable resources and better preparation for ever-changing grid conditions. This application develops predictive locational marginal prices (DLMPs) to proactively manage the distribution assets and flexible resources based on forecasted grid conditions. This application enables the distribution system operators to optimally incentivize individual resources to achieve system-level control objectives, such as minimizing total generation cost and optimizing the voltage profile; and it paves the way to a fully functional distribution market with granular prices that reflect the time- and location-specific values of individual participants.

### Design¶

This application develops a high-resolution, short-term load forecasting method to accurately predict the power consumption of individual customers in distribution systems. Using historical load measurements as inputs, it trains a support vector regression model to forecast the future load. Based on the forecasted load in the short-term future, this application develops a three-phase AC optimal power flow problem to determine the predictive DLMPs in distribution systems. By accurately modeling the losses and the imbalances of distribution networks, it provides time- and location-specific pricing of individual resources.

### Operating/Running¶

The application was built using Python 3.6. It will be run from the platform GUI.

### References¶

[1] H. Jiang, Y. Zhang, E. Muljadi, J. J. Zhang, and D. W. Gao, “A Short-Term and High-Resolution Distribution System Load Forecasting Approach Using Support Vector Regression with Hybrid Parameters Optimization,” in IEEE Transactions on Smart Grid, vol. 9, no. 4, pp. 3341-3350, July 2018. [2] R. Yang and Y. Zhang, “Three-Phase AC Optimal Power Flow Based Distribution Locational Marginal Price,” IEEE Innovative Smart Grid Technologies, Arlington, VA, Apr. 2017.

## Solar Forecasting Application¶

### Objectives¶

When observations of solar radiation are limited, persistence and smart persistence solar forecasting techniques are frequently the easiest and most effective methods to use. Often though, these techniques suffer from having no information about current cloud properties, which could improve the forecast. At NREL, a Physics-based Smart Persistence model (PSPI) [1] was created for intra-hour solar forecasting using only GHI observations and a cloud retrieval technique. This model breaks down common solar radiation components such as GHI and solar zenith angle (SZA) using a two-stream approximation [2] and methods used in [3] to forecast future GHI, cloud fraction, and cloud albedo. With this information, this technique can then be used to forecast solar power (still in development). Figure 1 below shows the conceptual framework for PSPI.

Figure 1 Conceptual framework for PSPI. PSPI breaks up the GHI and solar zenith angle (SZA) into cloud fraction and cloud albedo components.

### Design¶

PSPI is designed to operate only using GHI observations. Other atmospheric parameters, such as pressure and temperature, can be ingested into the application as well if those observations exist. Currently, site-specific annual averages of these parameters are used. Other parameters, such as altitude of the site of interest, need to be adjusted prior to running the application. Whatever atmospheric variables are available via the GridAPPS-D platform, they can be ingested into the PSPI based on the user’s needs (still in development). Once all desired parameters are chosen and the application is run, intra-hour GHI forecasts can be made (5 to 60-minute forecasts) as frequently as observations arrive (usually minutely).


text:
An object with a mass of 16 kg is revolving around a point at a distance of 3 m. If the object is making revolutions at a frequency of 13 Hz, what is the centripetal force acting on the object?

Jan 28, 2016

I found: $320 , 250 N$

Explanation:

Centripetal force is equal to mass time centripetal acceleration:
${F}_{c} = m \cdot {a}_{c} = m \cdot {v}^{2} / r$
where:
$m = 16 k g =$mass;
v=?=linear velocity;
$r = 3 m =$radius.

Now:
Angular Velocity $\omega$ (a kind of circular velocity!) will be equal to distance divided time or:
$\omega = \frac{2 \pi}{T}$

in this case the distance will be the circumference of $2 \pi$ radians divided by the time or period $T$ to desribe it.
But period is related to frequency $\nu$ as:
$\nu = \frac{1}{T}$ so we can write:
$\omega = 2 \pi \nu$

But we want a Linear velocity!
We simply introduce the radius into the $\omega$ to get:
$v = \omega r = 2 \pi \nu r$
The centripetal force will then become:
F_c=m(4pi^2)nu^2r^2)/r=m(4pi^2)(nu^2)r=16*(4pi^2)(13^2)*3=320,248.9N~~320,250N

format: plain


text:
Strouhal number

In dimensional analysis, the Strouhal number (St, or sometimes Sr to avoid the conflict with the Stanton number) is a dimensionless number describing oscillating flow mechanisms. The parameter is named after Vincenc Strouhal, a Czech physicist who experimented in 1878 with wires experiencing vortex shedding and singing in the wind.[1][2] The Strouhal number is an integral part of the fundamentals of fluid mechanics.

The Strouhal number is often given as

${\displaystyle {\text{St}}={\frac {fL}{U}},}$

where f is the frequency of vortex shedding, L is the characteristic length (for example, hydraulic diameter or the airfoil thickness) and U is the flow velocity. In certain cases, like heaving (plunging) flight, this characteristic length is the amplitude of oscillation. This selection of characteristic length can be used to present a distinction between Strouhal number and reduced frequency:

${\displaystyle {\text{St}}={\frac {kA}{\pi c}},}$

where k is the reduced frequency, and A is amplitude of the heaving oscillation.

Strouhal number (Sr) as a function of the Reynolds number (R) for a long circular cylinder.

For large Strouhal numbers (order of 1), viscosity dominates fluid flow, resulting in a collective oscillating movement of the fluid "plug". For low Strouhal numbers (order of 10−4 and below), the high-speed, quasi-steady-state portion of the movement dominates the oscillation. Oscillation at intermediate Strouhal numbers is characterized by the buildup and rapidly subsequent shedding of vortices.[3]

For spheres in uniform flow in the Reynolds number range of 8×102 < Re < 2×105 there co-exist two values of the Strouhal number. The lower frequency is attributed to the large-scale instability of the wake, is independent of the Reynolds number Re and is approximately equal to 0.2. The higher-frequency Strouhal number is caused by small-scale instabilities from the separation of the shear layer.[4][5]

Applications

Metrology

In metrology, specifically axial-flow turbine meters, the Strouhal number is used in combination with the Roshko number to give a correlation between flow rate and frequency. The advantage of this method over the frequency/viscosity versus K-factor method is that it takes into account temperature effects on the meter.

${\displaystyle {\text{St}}={\frac {f}{U}}C^{3},}$

where

f = meter frequency,
U = flow rate,
C = linear coefficient of expansion for the meter housing material.

This relationship leaves Strouhal dimensionless, although a dimensionless approximation is often used for C3, resulting in units of pulses/volume (same as K-factor).

Animal locomotion

In swimming or flying animals, Strouhal number is defined as

${\displaystyle {\text{St}}={\frac {f}{U}}A,}$

where,

f = oscillation frequency (tail-beat, wing-flapping, etc.),
U = flow rate,
A = peak-to-peak oscillation amplitude.

In animal flight or swimming, propulsive efficiency is high over a narrow range of Strouhal constants, generally peaking in the 0.2 < St < 0.4 range.[6] This range is used in the swimming of dolphins, sharks, and bony fish, and in the cruising flight of birds, bats and insects.[6] However, in other forms of flight other values are found.[6] Intuitively the ratio measures the steepness of the strokes, viewed from the side (e.g., assuming movement through a stationary fluid) – f is the stroke frequency, A is the amplitude, so the numerator fA is half the vertical speed of the wing tip, while the denominator V is the horizontal speed. Thus the graph of the wing tip forms an approximate sinusoid with aspect (maximal slope) twice the Strouhal constant.[7]

• Aeroelastic flutter
• Froude number – A dimensionless number defined as the ratio of the flow inertia to the external field
• Kármán vortex street – Repeating pattern of swirling vortices caused by the unsteady separation of flow of a fluid around blunt bodies
• Mach number – Ratio of speed of object moving through fluid and local speed of sound
• Reynolds number – Dimensionless quantity used to help predict fluid flow patterns
• Rossby number – The ratio of inertial force to Coriolis force
• Weber number – A dimensionless number in fluid mechanics that is often useful in analysing fluid flows where there is an interface between two different fluids
• Womersley number – A dimensionless expression of the pulsatile flow frequency in relation to viscous effects

References

1. ^ Strouhal, V. (1878) "Ueber eine besondere Art der Tonerregung" (On an unusual sort of sound excitation), Annalen der Physik und Chemie, 3rd series, 5 (10) : 216–251.
2. ^ White, Frank M. (1999). Fluid Mechanics (4th ed.). McGraw Hill. ISBN 978-0-07-116848-9.
3. ^ Sobey, Ian J. (1982). "Oscillatory flows at intermediate Strouhal number in asymmetry channels". Journal of Fluid Mechanics. 125: 359–373. Bibcode:1982JFM...125..359S. doi:10.1017/S0022112082003371.
4. ^ Kim, K. J.; Durbin, P. A. (1988). "Observations of the frequencies in a sphere wake and drag increase by acoustic excitation". Physics of Fluids. 31 (11): 3260–3265. Bibcode:1988PhFl...31.3260K. doi:10.1063/1.866937.
5. ^ Sakamoto, H.; Haniu, H. (1990). "A study on vortex shedding from spheres in uniform flow". Journal of Fluids Engineering. 112 (December): 386–392. Bibcode:1990ATJFE.112..386S. doi:10.1115/1.2909415.
6. ^ a b c Taylor, Graham K.; Nudds, Robert L.; Thomas, Adrian L. R. (2003). "Flying and swimming animals cruise at a Strouhal number tuned for high power efficiency". Nature. 425 (6959): 707–711. Bibcode:2003Natur.425..707T. doi:10.1038/nature02000. PMID 14562101.
7. ^ Corum, Jonathan (2003). "The Strouhal Number in Cruising Flight". Retrieved 2012-11-13– depiction of Strouhal number for flying and swimming animalsCS1 maint: postscript (link)


text:
# Appendix - Sorting Algorithms

### What is Sort Key?

Sometimes we sort scalar objects such as numbers, and other times we might want to sort non-scalar objects such as Objects with many class variables. In the latter case, one must designate a specific variable (or a function) to be used as the sort key. A sort key is part of the data item that determines the ordering relation used in the sort. (In Java, this is achieved by using the Comparable interface.)

### What are Interval vs External Sorting Algorithms?

Sometimes the data to be sorted is so large that it cannot fit in memory. The sorting algorithms in this case have very different requirements, since only a fraction of the data can be examined at a time. Algorithms that sort data that cannot all be stored in memory are called external sorting algorithms. Those that sort data that can fit entirely in memory are called internal sorts.

### What are Stable Sorting Algorithms?

Sometimes the data to be sorted does not have unique keys and multiple elements can have the same key. It may be important for a sorting algorithm to preserve the relative order of elements with equal keys. Sorts that preserve the order of equal keys are called stable sorts. To give an example, suppose that data is sorted by last name, and if there are any elements with equal last names, then ties are broken by sorting by first name. One way to do this is to first sort all of the data by first name. Then, the data can be sorted by last name, as long as it has the property that elements with equal keys stay in the same relative order. This will work because if there are two people with the same last name but different first names, then the second sort will move elements with different last names relative to each other, but those with equal last names will stay in the same relative order, and since they are already sorted by first name, those with smaller first names and equal last names will precede those with larger first names and equal last names. E.g.,

zachary abigail
smith harry
jones mary
smith sam

becomes,

jones mary
smith harry
smith sam
zachary abigail

### What are Natural Sorting Algorithms?

When data is sorted, mostly what takes place is that keys are compared and data items are moved around. When measuring the performance of sorting algorithms, sometimes it is only the number of key comparisons that are of interest. However, if the data items are very big, then moving a data item can be a costly operation. In this case we may also be interested in how many data movement operations take place as a function of input size. The number of key comparisons might be small but if the data movements are frequent, then it may not perform as well as an algorithm with fewer data movements and more key comparisons. One measure of a sort is how much data movement it performs when the initial data set is already sorted. Sorts that do not move the data much in that case are called natural sorts.


text:
Outlook: NextGen Healthcare Inc. Common Stock assigned short-term Ba1 & long-term Ba1 estimated rating.
Dominant Strategy : Hold
Time series to forecast n: 29 Dec 2022 for (n+3 month)

## Abstract

Stock market prediction is a major exertion in the field of finance and establishing businesses. Stock market is totally uncertain as the prices of stocks keep fluctuating on a daily basis because of numerous factors that influence it. One of the traditional ways of predicting stock prices was by using only historical data. But with time it was observed that other factors such as peoples' sentiments and other news events occurring in and around the country affect the stock market, for e.g. national elections, natural calamity etc.(Waqar, M., Dawood, H., Guo, P., Shahnawaz, M.B. and Ghazanfar, M.A., 2017, December. Prediction of stock market by principal component analysis. In 2017 13th International Conference on Computational Intelligence and Security (CIS) (pp. 599-602). IEEE.) We evaluate NextGen Healthcare Inc. Common Stock prediction models with Multi-Task Learning (ML) and Paired T-Test1,2,3,4 and conclude that the NXGN stock is predictable in the short/long term. According to price forecasts for (n+3 month) period, the dominant strategy among neural network is: Hold

## Key Points

1. Stock Forecast Based On a Predictive Algorithm
2. Market Signals
3. Is Target price a good indicator?

## NXGN Target Price Prediction Modeling Methodology

We consider NextGen Healthcare Inc. Common Stock Decision Process with Multi-Task Learning (ML) where A is the set of discrete actions of NXGN stock holders, F is the set of discrete states, P : S × F × S → R is the transition probability distribution, R : S × F → R is the reaction function, and γ ∈ [0, 1] is a move factor for expectation.1,2,3,4

F(Paired T-Test)5,6,7= $\begin{array}{cccc}{p}_{a1}& {p}_{a2}& \dots & {p}_{1n}\\ & ⋮\\ {p}_{j1}& {p}_{j2}& \dots & {p}_{jn}\\ & ⋮\\ {p}_{k1}& {p}_{k2}& \dots & {p}_{kn}\\ & ⋮\\ {p}_{n1}& {p}_{n2}& \dots & {p}_{nn}\end{array}$ X R(Multi-Task Learning (ML)) X S(n):→ (n+3 month) $∑ i = 1 n s i$

n:Time series to forecast

p:Price signals of NXGN stock

j:Nash equilibria (Neural Network)

k:Dominated move

a:Best response for target price

For further technical information as per how our model work we invite you to visit the article below:

How do AC Investment Research machine learning (predictive) algorithms actually work?

## NXGN Stock Forecast (Buy or Sell) for (n+3 month)

Sample Set: Neural Network
Stock/Index: NXGN NextGen Healthcare Inc. Common Stock
Time series to forecast n: 29 Dec 2022 for (n+3 month)

According to price forecasts for (n+3 month) period, the dominant strategy among neural network is: Hold

X axis: *Likelihood% (The higher the percentage value, the more likely the event will occur.)

Y axis: *Potential Impact% (The higher the percentage value, the more likely the price will deviate.)

Z axis (Grey to Black): *Technical Analysis%

## IFRS Reconciliation Adjustments for NextGen Healthcare Inc. Common Stock

1. An entity need not undertake an exhaustive search for information but shall consider all reasonable and supportable information that is available without undue cost or effort and that is relevant to the estimate of expected credit losses, including the effect of expected prepayments. The information used shall include factors that are specific to the borrower, general economic conditions and an assessment of both the current as well as the forecast direction of conditions at the reporting date. An entity may use various sources of data, that may be both internal (entity-specific) and external. Possible data sources include internal historical credit loss experience, internal ratings, credit loss experience of other entities and external ratings, reports and statistics. Entities that have no, or insufficient, sources of entityspecific data may use peer group experience for the comparable financial instrument (or groups of financial instruments).
2. An entity applies IAS 21 to financial assets and financial liabilities that are monetary items in accordance with IAS 21 and denominated in a foreign currency. IAS 21 requires any foreign exchange gains and losses on monetary assets and monetary liabilities to be recognised in profit or loss. An exception is a monetary item that is designated as a hedging instrument in a cash flow hedge (see paragraph 6.5.11), a hedge of a net investment (see paragraph 6.5.13) or a fair value hedge of an equity instrument for which an entity has elected to present changes in fair value in other comprehensive income in accordance with paragraph 5.7.5 (see paragraph 6.5.8).
3. If an entity previously accounted at cost (in accordance with IAS 39), for an investment in an equity instrument that does not have a quoted price in an active market for an identical instrument (ie a Level 1 input) (or for a derivative asset that is linked to and must be settled by delivery of such an equity instrument) it shall measure that instrument at fair value at the date of initial application. Any difference between the previous carrying amount and the fair value shall be recognised in the opening retained earnings (or other component of equity, as appropriate) of the reporting period that includes the date of initial application.
4. Paragraph 5.7.5 permits an entity to make an irrevocable election to present in other comprehensive income subsequent changes in the fair value of particular investments in equity instruments. Such an investment is not a monetary item. Accordingly, the gain or loss that is presented in other comprehensive income in accordance with paragraph 5.7.5 includes any related foreign exchange component.

*International Financial Reporting Standards (IFRS) adjustment process involves reviewing the company's financial statements and identifying any differences between the company's current accounting practices and the requirements of the IFRS. If there are any such differences, neural network makes adjustments to financial statements to bring them into compliance with the IFRS.

## Conclusions

NextGen Healthcare Inc. Common Stock assigned short-term Ba1 & long-term Ba1 estimated rating. We evaluate the prediction models Multi-Task Learning (ML) with Paired T-Test1,2,3,4 and conclude that the NXGN stock is predictable in the short/long term. According to price forecasts for (n+3 month) period, the dominant strategy among neural network is: Hold

### NXGN NextGen Healthcare Inc. Common Stock Financial Analysis*

Rating Short-Term Long-Term Senior
Outlook*Ba1Ba1
Income StatementCB2
Balance SheetCaa2Ba3
Leverage RatiosBaa2C
Cash FlowCCaa2
Rates of Return and ProfitabilityB3B2

*Financial analysis is the process of evaluating a company's financial performance and position by neural network. It involves reviewing the company's financial statements, including the balance sheet, income statement, and cash flow statement, as well as other financial reports and documents.
How does neural network examine financial reports and understand financial state of the company?

### Prediction Confidence Score

Trust metric by Neural Network: 93 out of 100 with 684 signals.

## References

1. Bessler, D. A. S. W. Fuller (1993), "Cointegration between U.S. wheat markets," Journal of Regional Science, 33, 481–501.
2. Efron B, Hastie T, Johnstone I, Tibshirani R. 2004. Least angle regression. Ann. Stat. 32:407–99
3. Andrews, D. W. K. (1993), "Tests for parameter instability and structural change with unknown change point," Econometrica, 61, 821–856.
4. Li L, Chen S, Kleban J, Gupta A. 2014. Counterfactual estimation and optimization of click metrics for search engines: a case study. In Proceedings of the 24th International Conference on the World Wide Web, pp. 929–34. New York: ACM
5. Bastani H, Bayati M. 2015. Online decision-making with high-dimensional covariates. Work. Pap., Univ. Penn./ Stanford Grad. School Bus., Philadelphia/Stanford, CA
6. V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. P. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, pages 1928–1937, 2016
7. Chamberlain G. 2000. Econometrics and decision theory. J. Econom. 95:255–83
Frequently Asked QuestionsQ: What is the prediction methodology for NXGN stock?
A: NXGN stock prediction methodology: We evaluate the prediction models Multi-Task Learning (ML) and Paired T-Test
Q: Is NXGN stock a buy or sell?
A: The dominant strategy among neural network is to Hold NXGN Stock.
Q: Is NextGen Healthcare Inc. Common Stock stock a good investment?
A: The consensus rating for NextGen Healthcare Inc. Common Stock is Hold and assigned short-term Ba1 & long-term Ba1 estimated rating.
Q: What is the consensus rating of NXGN stock?
A: The consensus rating for NXGN is Hold.
Q: What is the prediction period for NXGN stock?
A: The prediction period for NXGN is (n+3 month)


text:
# Using Unpolarized Light to Calculate Reflectance and Transmittance

#1

Hi,

I’ve read the tutorial on using an unpolarized beam, and how to generate my results.
In the script file provided with the tutorial at

They calculate this by simulating a beam with a polarization angle of 0 and then a beam with a polarization of angle 90, they then get the quantity <|E|2> referring to the time averaged electric field intensity of the unpolarized beam source as,

<|E|2> = 0.5 (<|E_0|>^2 + <|E_90|>^2)

In the script for the unpolarized beam they do the same additions for calculating transmission.

So, now if I’m simulating a gold nanoparticle of 10 nm radius, and follow the same procedure, while calculating the reflectance and transmission in each case using field and profile monitors. In order to get the averaged electric field intensity, all I have to do is something along the lines of:

T_unpol=0.5*(T_0+T_90);
R_unpol = 0.5*(R_0+R_90);
E2_unpol=0.5*(E2_0+E2_90);

Are the E2_0 and E2_90 referring to the E abs^2 variable in the field and profile monitor? Must I apply these same additions if I’m calculating power absorption or scattering/absorption cross sections using the pabs, and cross section analysis monitors?

#2

Hi @apmanuel,

That is correct. As long as you are dealing with a linear system, you can obtain the unpolarized results by incoherently averaging the results from 2 simulations using the 2 orthogonal polarization. This is valid for $|E|^2$, as well as T and R, but also $P_{abs}$ as

$P_{abs} = -{1 \over 2} \omega |E|^2 imag(\epsilon)$

so

$P_{abs} = -{1 \over 2} \omega \left( {1 \over 2} |E_0|^2 + {1 \over 2}|E_{90}|^2 \right) imag(\epsilon)$

Similarly, the cross section calculation is using the transmission through monitors to get the power ratio going through the monitors that is then normalized to the source intensity.

I hope this helps.

#3

Just a few questions:

(1) What do you mean by a linear system? What if I was looking at specific arrangements of nanorods in a certain shape?
(2) The imag(e) refers to the imaginary component of the dielectric constant?
(3) The last statement, you say that the cross section calculation using transmission through the planes of the monitor, so do I use the same incoherent average here as in T and R, or do I use that provided in Pabs?

#4

Hi @apmanuel,

I meant the response of the system is linear (it would be different if we were using non-linear materials).

Correct, $imag(\epsilon)$ is the imaginary part of the permittivity. Note for dispersive materials, $\epsilon$ is not a constant.

You can use the same incoherent average as in T and R. The cross section analysis group from the object library is using a box of monitors and get the transmissions through these monitors to calculate the cross section:

$\sigma = {\sum T_i} {sourcepower(f) \over sourceintensity(f)}$

Where $\sum T_i$ is the sum of the transmission of each monitor. This is used, for instance, in the Mie scattering example.

#5

Hi,

Following your instructions I was able to set up my simulations accordingly. I wanted to do the unpolarized calculation on a nanotube where I’m using a TFSF source.
Basically I did one simulation with TFSF source of 0 degree polarization, and the second with the TFSF source of 90 degree polarization, with both sources having the light enter in from atop of the nanotube. While my 0 degree polarization simulation converged well and showed the relevant reflectance and transmittance behavior, my 90 degree polarization simulation didn’t converge at all with the autoshutoff level increasing from 1-200 by the end of the simulation. Could this have to do with how I’m using the 90 degree polarized TFSF source?

#6

Hi @apmanuel,

It’s difficult to say where the problem could be as there can be multiple causes for diverging simulation.
Can you eventually share the simulation file?


text:
Check GMAT Club Decision Tracker for the Latest School Decision Releases https://gmatclub.com/AppTrack

 It is currently 22 May 2017, 14:53

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# Events & Promotions

###### Events & Promotions in June
Open Detailed Calendar

# If x and y are integers and 2 < x < y, does y = 16 ?

 new topic post reply Question banks Downloads My Bookmarks Reviews Important topics
Author Message
TAGS:

### Hide Tags

VP
Status: Final Lap Up!!!
Affiliations: NYK Line
Joined: 21 Sep 2012
Posts: 1085
Location: India
GMAT 1: 410 Q35 V11
GMAT 2: 530 Q44 V20
GMAT 3: 630 Q45 V31
GPA: 3.84
WE: Engineering (Transportation)
Followers: 38

Kudos [?]: 564 [0], given: 70

If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

09 Mar 2013, 13:06
7
This post was
BOOKMARKED
00:00

Difficulty:

75% (hard)

Question Stats:

51% (02:12) correct 49% (01:39) wrong based on 253 sessions

### HideShow timer Statistics

If x and y are integers and 2 < x < y, does y = 16 ?

(1) The GCF of X and Y is 2.
(2) The LCM of X and Y is 48.
[Reveal] Spoiler: OA
VP
Status: Final Lap Up!!!
Affiliations: NYK Line
Joined: 21 Sep 2012
Posts: 1085
Location: India
GMAT 1: 410 Q35 V11
GMAT 2: 530 Q44 V20
GMAT 3: 630 Q45 V31
GPA: 3.84
WE: Engineering (Transportation)
Followers: 38

Kudos [?]: 564 [0], given: 70

Re: if x and y are integers and 2<x<y, does y =16 [#permalink]

### Show Tags

09 Mar 2013, 13:09
I know that each statements are insufficient by itself. But i think Even taken together they are insufficient.
We know that GCF*LCM = X*Y
So X*Y = 96
Hence , when y = 24 , x =4
Similarly when y = 16 , x = 6
So i think both statements are insufficient taken together.

Archit
Math Expert
Joined: 02 Sep 2009
Posts: 38798
Followers: 7713

Kudos [?]: 105763 [0], given: 11581

Re: if x and y are integers and 2<x<y, does y =16 [#permalink]

### Show Tags

09 Mar 2013, 13:26
Archit143 wrote:
If x and y are integers and 2 < x < y, does y = 16 ?

(1) The GCF of X and Y is 2.
(2) The LCM of X and Y is 48.

I know that each statements are insufficient by itself. But i think Even taken together they are insufficient.
We know that GCF*LCM = X*Y
So X*Y = 96
Hence , when y = 24 , x =4
Similarly when y = 16 , x = 6
So i think both statements are insufficient taken together.

Archit

Notice that the greatest factor of 24 and 4 is 4, not 2 as given in the second statement.

Hope it helps.
_________________
Manager
Joined: 29 Sep 2013
Posts: 53
Followers: 0

Kudos [?]: 36 [0], given: 48

Re: if x and y are integers and 2<x<y, does y =16 [#permalink]

### Show Tags

19 Oct 2013, 20:07
Archit143 wrote:
I know that each statements are insufficient by itself. But i think Even taken together they are insufficient.
We know that GCF*LCM = X*Y
So X*Y = 96
Hence , when y = 24 , x =4
Similarly when y = 16 , x = 6
So i think both statements are insufficient taken together.

Archit

If GCF is 2 and LCM is 48, than the Pair of X and Y can be:
X=2,Y=48 and X=6,Y=16 and X=16, Y=6 and X=48, Y=2

I think the answer is
[Reveal] Spoiler:
E
Math Expert
Joined: 02 Sep 2009
Posts: 38798
Followers: 7713

Kudos [?]: 105763 [2] , given: 11581

Re: if x and y are integers and 2<x<y, does y =16 [#permalink]

### Show Tags

20 Oct 2013, 04:36
2
KUDOS
Expert's post
suk1234 wrote:
Archit143 wrote:
I know that each statements are insufficient by itself. But i think Even taken together they are insufficient.
We know that GCF*LCM = X*Y
So X*Y = 96
Hence , when y = 24 , x =4
Similarly when y = 16 , x = 6
So i think both statements are insufficient taken together.

Archit

If GCF is 2 and LCM is 48, than the Pair of X and Y can be:
X=2,Y=48 and X=6,Y=16 and X=16, Y=6 and X=48, Y=2

I think the answer is
[Reveal] Spoiler:
E

Please read the stem carefully. It's given that 2<x<y.
_________________
Manager
Joined: 31 Mar 2013
Posts: 72
Location: India
GMAT 1: 770 Q51 V41
GPA: 3.02
Followers: 1

Kudos [?]: 27 [0], given: 109

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

05 Nov 2013, 03:15
I am not getting the right answer for some reason. Can you please tell me the set of numbers for which both the statements are satisfied?

thank you.
Math Expert
Joined: 02 Sep 2009
Posts: 38798
Followers: 7713

Kudos [?]: 105763 [1] , given: 11581

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

05 Nov 2013, 07:00
1
KUDOS
Expert's post
emailmkarthik wrote:
If x and y are integers and 2 < x < y, does y = 16 ?

(1) The GCF of X and Y is 2.
(2) The LCM of X and Y is 48.

I am not getting the right answer for some reason. Can you please tell me the set of numbers for which both the statements are satisfied?

thank you.

x = 6 and y = 16 --> the greatest common factor of 6 and 16 is 2, and the least common multiple of 6 and 16 is 48.
_________________
Manager
Joined: 31 Mar 2013
Posts: 72
Location: India
GMAT 1: 770 Q51 V41
GPA: 3.02
Followers: 1

Kudos [?]: 27 [0], given: 109

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

05 Nov 2013, 07:13
Thanks Bunuel. But I am a but unclear still. Is there another set of numbers that satisfy both statements? Else answer should be C, no?
Math Expert
Joined: 02 Sep 2009
Posts: 38798
Followers: 7713

Kudos [?]: 105763 [0], given: 11581

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

05 Nov 2013, 07:15
emailmkarthik wrote:
Thanks Bunuel. But I am a but unclear still. Is there another set of numbers that satisfy both statements? Else answer should be C, no?

Not sure what you mean...

The correct answer IS C: no other x and y satisfy both the stem and the statements.
_________________
Manager
Joined: 31 Mar 2013
Posts: 72
Location: India
GMAT 1: 770 Q51 V41
GPA: 3.02
Followers: 1

Kudos [?]: 27 [0], given: 109

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

05 Nov 2013, 07:18
My goodness. Thank you so much! I thought the answer was E and I was very confused. I saw the answer of some post and assumed it to be OA.
Intern
Joined: 29 May 2012
Posts: 12
Concentration: General Management, Finance
GPA: 3.49
Followers: 0

Kudos [?]: 82 [0], given: 18

If x and y are integers and 2 < x < y, does y = 16? [#permalink]

### Show Tags

06 Nov 2013, 10:59
If x and y are integers and 2 < x < y, does y = 16?

(1) The GCF of x and y is 2
(2) The LCM of x and y is 48
_________________

"When ideas get really complicated and the world gets complicated, its foolish to think that the person who's first can figure it all out"

Magoosh GMAT Instructor
Joined: 28 Dec 2011
Posts: 4026
Followers: 1415

Kudos [?]: 6748 [3] , given: 84

Re: If x and y are integers and 2 < x < y, does y = 16? [#permalink]

### Show Tags

06 Nov 2013, 19:05
3
KUDOS
Expert's post
2
This post was
BOOKMARKED
accincognito wrote:
If x and y are integers and 2 < x < y, does y = 16?

(1) The GCF of x and y is 2
(2) The LCM of x and y is 48

Dear accincognito,
I'm happy to help.

This is a hard problem! See this post for some insight:
http://magoosh.com/gmat/2012/gmat-math-factors/

Statement #1: The GCF of x and y is 2
This leave open a wide array of possibilities. All we know is that x and y are two even numbers, both bigger than 2, with no common factors other than two: they could be
x = 4, y = 6
x = 6, y = 8
x = 6, y = 10
x = 6, y = 16
So, it's possible for y to equal 16 or equal something else. This statement, alone and by itself, does not give us sufficient information, so it is insufficient.

Statement #2: The LCM of x and y is 48
Without any other information, we could have
x = 3, y = 16
x = 4, y = 48
So, it's possible for y to equal 16 or equal something else. This statement, alone and by itself, does not give us sufficient information, so it is insufficient.

Combined: this is where it gets interesting.
The GCF of x and y is 2
The LCM of x and y is 48
This is a tricky combination. First, let's list all the factors of 48 --- in order to have a LCM of 48 with another number, each number must be a factor of 48.
factors of 48 = {1, 2, 3, 4, 6, 8, 12, 16, 24, 48}
Those are the possible candidates for x & y. We can eliminate 1 & 2, because x > 2, and we can eliminate 3, because that cannot have a GCF of 2 with anything else.
Possibilities for x & y = {4, 6, 8, 12, 16, 24, 48}
If y = 48, then every other number in the set is factor of 48, so the GCF would be the smaller number --- e.g. the GCF of 6 and 48 is 6. Therefore, we can't use 48.
If y = 24, then the first four numbers are factors of 24, so they don't work, and the GCF of 16 & 24 is 8. Therefore, we can't use 24.
Possibilities for x & y = {4, 6, 8, 12, 16}
Suppose y = 16
x = 4, y = 16 ===> GCF = 4, doesn't work
x = 6, y = 16 ===> GCF = 2 --- this is one possible pair!!
x = 8, y = 16 ===> GCF = 8, doesn't work
x = 12, y = 16 ===> GCF = 4, doesn't work
Suppose y = 8
x = 4, y = 8 ===> GCF = 4, doesn't work
x = 6, y = 8 ===> GCF = 2, but LCM = 24, doesn't work
Suppose y = 6
x = 4, y = 6 ===> GCF = 2, but LCM = 12, doesn't work
So, after all that, the only pair that satisfies both statements is x = 6, y = 16, so it turns out, y does in fact equal 16. We are able to give a definitive answer to the prompt question, so the combined statements are sufficient.

Does all this make sense?
Mike
_________________

Mike McGarry
Magoosh Test Prep

Current Student
Joined: 06 Sep 2013
Posts: 2005
Concentration: Finance
Followers: 68

Kudos [?]: 643 [1] , given: 355

Re: If x and y are integers and 2 < x < y, does y = 16? [#permalink]

### Show Tags

31 Mar 2014, 08:20
1
KUDOS
mikemcgarry wrote:
accincognito wrote:
If x and y are integers and 2 < x < y, does y = 16?

(1) The GCF of x and y is 2
(2) The LCM of x and y is 48

Dear accincognito,
I'm happy to help.

This is a hard problem! See this post for some insight:
http://magoosh.com/gmat/2012/gmat-math-factors/

Statement #1: The GCF of x and y is 2
This leave open a wide array of possibilities. All we know is that x and y are two even numbers, both bigger than 2, with no common factors other than two: they could be
x = 4, y = 6
x = 6, y = 8
x = 6, y = 10
x = 6, y = 16
So, it's possible for y to equal 16 or equal something else. This statement, alone and by itself, does not give us sufficient information, so it is insufficient.

Statement #2: The LCM of x and y is 48
Without any other information, we could have
x = 3, y = 16
x = 4, y = 48
So, it's possible for y to equal 16 or equal something else. This statement, alone and by itself, does not give us sufficient information, so it is insufficient.

Combined: this is where it gets interesting.
The GCF of x and y is 2
The LCM of x and y is 48
This is a tricky combination. First, let's list all the factors of 48 --- in order to have a LCM of 48 with another number, each number must be a factor of 48.
factors of 48 = {1, 2, 3, 4, 6, 8, 12, 16, 24, 48}
Those are the possible candidates for x & y. We can eliminate 1 & 2, because x > 2, and we can eliminate 3, because that cannot have a GCF of 2 with anything else.
Possibilities for x & y = {4, 6, 8, 12, 16, 24, 48}
If y = 48, then every other number in the set is factor of 48, so the GCF would be the smaller number --- e.g. the GCF of 6 and 48 is 6. Therefore, we can't use 48.
If y = 24, then the first four numbers are factors of 24, so they don't work, and the GCF of 16 & 24 is 8. Therefore, we can't use 24.
Possibilities for x & y = {4, 6, 8, 12, 16}
Suppose y = 16
x = 4, y = 16 ===> GCF = 4, doesn't work
x = 6, y = 16 ===> GCF = 2 --- this is one possible pair!!
x = 8, y = 16 ===> GCF = 8, doesn't work
x = 12, y = 16 ===> GCF = 4, doesn't work
Suppose y = 8
x = 4, y = 8 ===> GCF = 4, doesn't work
x = 6, y = 8 ===> GCF = 2, but LCM = 24, doesn't work
Suppose y = 6
x = 4, y = 6 ===> GCF = 2, but LCM = 12, doesn't work
So, after all that, the only pair that satisfies both statements is x = 6, y = 16, so it turns out, y does in fact equal 16. We are able to give a definitive answer to the prompt question, so the combined statements are sufficient.

Does all this make sense?
Mike

No need to test that many cases, let's see

x,y are positive integers and 2<x<y. Is y=16?

First statement
GCF (x,y) is 2

Well we could have:

x=4, y=6 answer is NO or x=6, y=16 answer is YES

Hence insufficient

Second Statement
LCM (x,y) is 48
48 = 2^4 * 3

Now we can test cases here too: Either x=3 and y=2^4 when answer is YES
OR x=7 y = 48 answer is NO

Both together
Since GCF =2 and LCM = 48 and since 2<x<y we can only have x=6, y=16

Hence C is the correct answer
Cheers
J
Current Student
Joined: 06 Sep 2013
Posts: 2005
Concentration: Finance
Followers: 68

Kudos [?]: 643 [1] , given: 355

Re: If x and y are integers and 2 < x < y, does y = 16? [#permalink]

### Show Tags

31 Mar 2014, 08:20
1
KUDOS
Again @Mike, No need for all the fuzz, let's see

x,y are positive integers and 2<x<y. Is y=16?

First statement
GCF (x,y) is 2

Well we could have:

x=4, y=6 answer is NO or x=6, y=16 answer is YES

Hence insufficient

Second Statement
LCM (x,y) is 48
48 = 2^4 * 3

Now we can test cases here too: Either x=3 and y=2^4 when answer is YES
OR x=7 y = 48 answer is NO

Both together
Since GCF =2 and LCM = 48 and since 2<x<y we can only have x=6, y=16

Hence C is the correct answer
Cheers
J

Last edited by jlgdr on 29 May 2014, 07:18, edited 1 time in total.
Veritas Prep GMAT Instructor
Joined: 16 Oct 2010
Posts: 7368
Location: Pune, India
Followers: 2281

Kudos [?]: 15071 [2] , given: 224

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

01 Apr 2014, 20:57
2
KUDOS
Expert's post
1
This post was
BOOKMARKED
Archit143 wrote:
If x and y are integers and 2 < x < y, does y = 16 ?

(1) The GCF of X and Y is 2.
(2) The LCM of X and Y is 48.

Given: 2 < X < Y
Question: Does Y = 16?

(1) The GCF of X and Y is 2.
X = 2a; Y = 2b (a and b are co prime integers)
Y may or may not be 16 e.g. X = 6, Y = 16 OR X = 6, Y = 8 etc

(2) The LCM of X and Y is 48.
$$48 = 2^4 * 3$$
One of X and Y must have 2^4 = 16 as a factor and one must have 3 as a factor. Again, Y may or may not be 16 e.g. X = 6, Y = 16 OR X = 1, Y = 48 etc

Using both together, X = 2a, Y = 2b.
Since a and b need to be co-prime and both X and Y need to be greater than 2, one of a and b must be 3 and the other must be 8 (since X and Y already have a 2 to make 16).
X = 6, Y = 16 (since X is less than Y).
Y must be 16.

_________________

Karishma
Veritas Prep | GMAT Instructor
My Blog

Get started with Veritas Prep GMAT On Demand for \$199

Veritas Prep Reviews

VP
Joined: 18 Sep 2014
Posts: 1207
Location: India
Followers: 43

Kudos [?]: 709 [0], given: 75

If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

10 Jan 2016, 09:24
If x and y are integers and $$2 < x < y$$, does $$y = 16$$ ?

(1) The GCF of X and Y is 2.

since we have many solutions such as $$(6, 8)$$, $$(6,16)$$, etc.

we cannot say whether $$y=16$$ or not.

Statement 1 is insufficient.

(2) The LCM of X and Y is 48.

since we have many solutions such as $$(16, 24)$$, $$(3,16)$$, etc.

we cannot say whether $$y=16$$ or not.

Statement 2 is insufficient.

Combining 1 and 2,

we know that $$LCM * GCF$$= product of the integers $$x * y$$

so $$xy=96=2^5*3$$

since GCF is 2, we know that both are even numbers indicating a single 2 in both x and y.

Thereby we get values of $$(x,y)$$ as $$(6, 16)$$, $$(8, 12)$$ and $$(4, 24).$$

out of these 3 pairs only $$(6,16)$$ has $$LCM$$ of $$48$$.

So $$y=16$$ and thus $$C$$ is the correct answer.
_________________

The only time you can lose is when you give up. Try hard and you will suceed.
Thanks = Kudos. Kudos are appreciated

http://gmatclub.com/forum/rules-for-posting-in-verbal-gmat-forum-134642.html
When you post a question Pls. Provide its source & TAG your questions
Avoid posting from unreliable sources.

My posts
http://gmatclub.com/forum/beauty-of-coordinate-geometry-213760.html#p1649924
http://gmatclub.com/forum/calling-all-march-april-gmat-takers-who-want-to-cross-213154.html
http://gmatclub.com/forum/possessive-pronouns-200496.html
http://gmatclub.com/forum/double-negatives-206717.html
http://gmatclub.com/forum/the-greatest-integer-function-223595.html#p1721773

Math Revolution GMAT Instructor
Joined: 16 Aug 2015
Posts: 3276
GPA: 3.82
Followers: 235

Kudos [?]: 2009 [0], given: 0

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

11 Jan 2016, 17:52
Forget conventional ways of solving math questions. In DS, Variable approach is the easiest and quickest way to find the answer without actually solving the problem. Remember equal number of variables and independent equations ensures a solution.

If x and y are integers and 2 < x < y, does y = 16 ?

(1) The GCF of X and Y is 2.
(2) The LCM of X and Y is 48.

In the original condition, there are 2 variables(x,y) and 1 equation(2<x<y), which should match with the number of equations. So you need 1 more equation. For 1) 1 equation, for 2) 1equation, which is likely to make D the answer.
For 1), (x,y)=(4,6) -> no, (x,y)=(6,16) -> yes, which is not sufficient.
For 2), (x,y)=(3,48) -> no, (x,y)=(6,16) -> yes, which is not sufficient.
When 1) & 2), (x,y)=(6,16) -> yes, which is sufficient. Therefore, the answer is C.

 For cases where we need 1 more equation, such as original conditions with “1 variable”, or “2 variables and 1 equation”, or “3 variables and 2 equations”, we have 1 equation each in both 1) and 2). Therefore, there is 59 % chance that D is the answer, while A or B has 38% chance and C or E has 3% chance. Since D is most likely to be the answer using 1) and 2) separately according to DS definition. Obviously there may be cases where the answer is A, B, C or E.
_________________

MathRevolution: Finish GMAT Quant Section with 10 minutes to spare
The one-and-only World’s First Variable Approach for DS and IVY Approach for PS with ease, speed and accuracy.
Find a 10% off coupon code for GMAT Club members.
“Receive 5 Math Questions & Solutions Daily”
Unlimited Access to over 120 free video lessons - try it yourself
See our Youtube demo

Intern
Joined: 06 Jul 2014
Posts: 3
Followers: 0

Kudos [?]: 0 [0], given: 23

### Show Tags

11 Oct 2016, 05:36
If x and y are integers and 2<x<y, does y=16?

(1) The greatest common factor of x and y is 2.
(2) The lowest common multiple of x and y is 48.
Math Expert
Joined: 02 Sep 2009
Posts: 38798
Followers: 7713

Kudos [?]: 105763 [0], given: 11581

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

11 Oct 2016, 05:39
Bounce1987 wrote:
If x and y are integers and 2<x<y, does y=16?

(1) The greatest common factor of x and y is 2.
(2) The lowest common multiple of x and y is 48.

Merging topics. Please refer to the discussion above.
_________________
SVP
Joined: 05 Jul 2006
Posts: 1747
Followers: 6

Kudos [?]: 357 [0], given: 49

Re: If x and y are integers and 2 < x < y, does y = 16 ? [#permalink]

### Show Tags

12 Oct 2016, 12:40
Archit143 wrote:
If x and y are integers and 2 < x < y, does y = 16 ?

(1) The GCF of X and Y is 2.
(2) The LCM of X and Y is 48.

FROM 1 GCF is 2 ( common prime factor with the lowest power )

(x,y) could be (4, 28) , (6,10) (14,16) ... insuff

from 2

LCM = (2^4 *3) ( factors unique to each integer * common prime factor to the largest power) ... insuff

both

since 2 is the GCF then one one of the 2 numbers has 2^1 and the other 2^4 and we need to know where the 3 factor belongs ( it only belongs to one of the two numbers since GCF is 2) . from stem 2<x<y , thus the smallest of x and y has to be bigger than 2^1 by the 3 factor , thus (x,y) = (6,16)
Re: If x and y are integers and 2 < x < y, does y = 16 ?   [#permalink] 12 Oct 2016, 12:40
Similar topics Replies Last post
Similar
Topics:
If x and y are integers, is 2xy<x2+y2? 3 29 Apr 2016, 12:54
3 Is y < 2x? 4 12 Jan 2016, 20:39
2 If x and y are positive integers, is x - y > (x+y)/2 ? (1) y < x (2) 7 03 Oct 2016, 05:44
8 Does integer n have 2 factors x & y such that 1 < x < y < n? 5 15 Mar 2016, 10:36
18 Is x^2 < x - |y|? 19 25 Jun 2016, 21:32
Display posts from previous: Sort by

# If x and y are integers and 2 < x < y, does y = 16 ?

 new topic post reply Question banks Downloads My Bookmarks Reviews Important topics

 Powered by phpBB © phpBB Group and phpBB SEO Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.


text:
A Bloom Filter is a probabilistic data structure with a build in method allowing for efficient testing for the presence of an element in some given set. Please refer to Wikipedia for further details.

The two basic operations on a Bloom Filter are

1. insertion: hash the value to be inserted k times and update a bit array at the index equal to each hashed value.
2. querying: hash the value k times and in case of k collisions, then return true; otherwise false.

Querying a Bloom Filter is very fast but speed comes with a price. Because the underlying implementation depends on hash function(s) there is a chance of false positive answer when checking if a certain element is present in the Bloom Filter or not. The algorithm guarantees that no false negatives answers are given when querying. In other words the Bloom Filter might indicate that some element is present in the set even if it is not. However if one query for membership of some element known not to be in the set the answer will always be that the given element is not present in the set.

# Challenge and approach

Say you want to join two tables A and B based on some field x and that the number of records in A is considerable larger than the number of records in B. In the book Data Algorithms by Mahmoud Parsian the first approach to solve this is simple by brute force illustrated by this pseudo-code:

A variant of this approach is to sort the tables A and B by x before joining them. Such a method is described here.

Both approaches can be improved considerable by incorporating the use of a Bloom Filter. The idea is simple to build a Bloom Filter based on the smaller set B and then use the filter to rule out all records of A not present B.

# Implementation

The given F# implementation is inspired by the Java implementation by Ian Clarke. The underlying MapReduce function is very simple and do NOT represent a realistic example of a proper implementation of the MapReduce framework. There is just one mapper and one reducer. A real world working implementation would definitely include some degree of parallelism. The point here is not to build a MapReduce framework in F# but merely to show the performance improvement one can gain from using Bloom Filter for joining two tables.

Source code is available at GitHub.

# FsCheck

Given a desired false negative probability rate $p$ and the number of elements $n$ being filtered one can determine the length of the bit array by the following formula:

From this formula we see that the following relation holds for all probability rates $p1$ and $p2$ with $p1 < p2$:

length of bit array based on p1 < length of bit array based on p2

Instead of writing just a couple of unit tests verifying this property we can use the test framework FsCheck (inspired by the original Haskell version called QuickCheck). FsCheck cannot prove that the property holds for all lists but it can automatically generate a large number of lists and verify that the relation holds for all these lists. Please see the source code for details.

# Results

In the table below we see the results from simulating the join of two tables in memory. The larger table contains the number of elements given in the column “Number of elements” and the smaller table contains 1/100 elements of the larger table.

Run times are shown in milliseconds for the two cases: brute force and Bloom Filter. We observe a significant performance improvement when using the Bloom Filter approach for larger tables.

Number of elements Without BF With BF Improvement
10000 54 21 61,1%
25000 297 44 85,2%
50000 1192 94 92,1%
100000 4778 213 95,5%
1000000 484404 8446 98,3%

My computer is a MacBook Pro with a Intel Core i5 2,6 GHz processor and 16 GB of memory.

# Alternative language implementations

Bloom Filter implementations in other programming languages and frameworks

• Algebird from Twitter in Scala. Contains lots of other interesting things as well.
• Java. Alternative Java implementation of Ian Clarkes original implementation.
• Scala. Also inspired by Ian Clarke.


text:
Some experiments in LaTeX that I mention in my zine, the codex.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

#### 14 lines 329 B Raw Permalink Normal View History

 Initial commit 1 year ago \documentclass{article}\usepackage[left=0.1cm,right=0.1cm,top=0.1cm,bottom=0.1cm]{geometry}\begin{document}\pdfpagewidth=2.3cm \pdfpageheight=0.7cm\noindent $x^n + y^n = z^n$\newpage\pdfpagewidth=10cm \pdfpageheight=6cm\parbox[bottom][6cm][c]{10cm}{$x^n + y^n = z^n$ \\ Plus some additional text.}\end{document}


text:
# Calculate the nth Fibonacci number, mod m

I was trying to output F(n) mod m to find the remainder of Fibonacci number, where F(n) could be a very big number:

# Uses python3
n, m =  [int(x) for x in input().split()]

def fib(n):
a = [0, 1]
if (n <=1):
return n
else:
for i in range(1, n):
a.append((a[-1] + a[-2])%m)
return a[i+1]
print (fib(n))

As I typed in 239 1000, it returns 161 as the remainder, which is correct. But with bigger inputs eg. 2816213588 239, it seems to exceed time limits, what can I do to improve the code?

Sorry, I am giving no code (I am on a phone and I don't know Python), but be aware that if m^2 is way lower than n, you could use the fact that your function gets periodical with a period maximally m^2 (as both a[-1] and a[-2] can gain m different values).

You could test in your for loop if/when you reached your period (if a[-2]==0 and a[-1]==1) and if so, variable i would indicate your period. Then you could simply grab a[n%(i-2)] as the answer, if I am not mistaken.

By the way, shouldn't the for loop range begin with 2?

• Interesting point! Out of curiosity, is it known that the repeated pattern does contain the initial values (0, 1) or can we reach another loop ? (like A -> B -> C -> D -> E -> C -> D -> E -> C -> D -> E -> C -> D -> E) – Josay May 19 at 18:56
• The for loop range is irrelevant because the loop variable isn't used. range(1, n) contains as many elements as range(2, n+1). Note that the sequence returned by range does not include the second argument. – Peter Taylor May 20 at 10:36
• @Josay I am pretty sure such C->D->E->C patterns cannot occur. I think, modulo addition (i.e. in a group) like this should divide the group (0 .. n-1) into congruent groups of the same size, each with a period equal to their size. But it is more an intuition now :). I do not remember most of my College Algebra now ... but I am sure Peter Taylor would know better (and I upvoted his answer, as he seems to remember more math than me :)). – Pavol Adam May 21 at 8:11
• Pavol (cc @Josay), what I remembered was the phrase "Pisano period", which I used to look up information in Wikipedia and OEIS. L. Edson Jeffery states in OEIS that it does always repeat the initial values, and gives a reference. If I were to try to prove it independently I think I'd tackle it using Binet's formula in a suitable field extension of $\mathbb{Z}/n\mathbb{Z}$. – Peter Taylor May 21 at 9:54
# Uses python3

I don't see much to argue against documenting this instead with a hashbang:

#!/usr/bin/python3

Sure, on Windows that path won't work, but on many other platforms it will.

n, m =  [int(x) for x in input().split()]
...
print (fib(n))

It is generally considered best practice to use

if __name__ == "__main__":
...

as a guard around "immediate" code. This makes the file reusable as a library.

I don't understand the inconsistency in making m a global but n an argument to the function.

def fib(n):
a = [0, 1]
if (n <=1):
return n
else:
for i in range(1, n):
a.append((a[-1] + a[-2])%m)
return a[i+1]

There are two PEP8 violations in this code: the missing space after <= on line 3, and the missing space around % on line 7. As a matter of style I would also drop the parentheses around the condition on line 3.

Other answers have addressed saving memory by keeping only the two most recent values, or saving time by exploiting the periodicity modulo m. Depending on your priorities for optimisation and expected values of n and m there are a couple of other things you could consider:

• Using the identities $$\F(2n) = 2 F(n+1) F(n) - F(n)^2\$$ and $$\F(2n+1) = F(n+1)^2 + F(n)^2\$$ you can calculate $$\F(n)\$$ in $$\O(\lg n)\$$ arithmetic operations. I describe this in much more detail, with SML code, on my personal website.
• If you prefer to attack the running time via periodicity (perhaps because $$\\lg n > 6m\$$), there are some tricks you can use to try to optimise it. The Pisano period is multiplicative, so if you can factor m that can reduce the number of steps you have to take to find the period. And there are number-theoretical theorems you can apply to reduce the search space.

Code organisation

Le's write your function in such a way that it is easier to test. First step is to provide m as a parameter. Also, we can take this chance to write a proper docstring for the function. We get something like:

def fib(n, m):
"""Compute Fibonnaci(n) % m."""
a = [0, 1]
if (n <=1):
ret = n
else:
for i in range(1, n):
a.append((a[-1] + a[-2])%m)
ret = a[i+1]
# print(ret)
return ret

(The single return and print statements are added to make the next step easier).

Now, we can add tests and add a computation of the time consumed. That benchmark will help ensuring our optimisations actually make things faster:

def test():
start = time.time()
assert fib(9, 32) == 2
assert fib(9, 100) == 34
assert fib(239, 1000) == 161
assert fib(239, 100000000) == 88152161
assert fib(239643, 100) == 62
assert fib(2396434, 100) == 87
end = time.time()
print(end - start)

Removing the array based logic

We define an array of value but we never really care about more than 2 values (the values at the end). We could rewrite this using 2 variables (and use the tuple unpacking that Python provides):

def fib(n, m):
"""Compute Fibonnaci(n) % m."""
a, b = 0, 1
if n <= 1:
ret = n
else:
for i in range(1, n):
a, b = b, (a + b) % m
ret = b
print(ret)
return ret

At this stage, the code is twice as fast.

Bug / weird edge case

The logic when n <= 1 does not take into account the m argument. This gives a wrong result for the following input:

assert fib(1, 1) == 0

This is a pretty degenerate case but it is easy to fix it.

We can do:

    ret = n % m

And add the following test cases:

assert fib(0, 1) == 0
assert fib(1, 1) == 0
assert fib(1, 10) == 1
assert fib(1, 10) == 1
assert fib(2, 10) == 1
assert fib(3, 10) == 2
assert fib(4, 10) == 3
assert fib(5, 10) == 5

At this stage, we have:

def fib(n, m):
"""Compute Fibonnaci(n) % m."""
if n <= 1:
return n % m
else:
a, b = 0, 1
for i in range(1, n):
a, b = b, (a + b) % m
return b

def test():
start = time.time()
assert fib(0, 1) == 0
assert fib(1, 1) == 0
assert fib(1, 10) == 1
assert fib(1, 10) == 1
assert fib(2, 10) == 1
assert fib(3, 10) == 2
assert fib(4, 10) == 3
assert fib(5, 10) == 5
assert fib(9, 32) == 2
assert fib(9, 100) == 34
assert fib(239, 1000) == 161
assert fib(239, 100000000) == 88152161
assert fib(239643, 100) == 62
assert fib(2396434, 100) == 87
end = time.time()
print(end - start)

Using maths

A different algorithm could be written using mathematical properties. I have yet to find something interesting to provide...

def fib(n, m):
"""Compute Fibonnaci(n) % m."""
if n <= 1:
return n % m
else:
beg = (0, 1)
a, b = beg
cache = [a, b]
for i in range(1, n):
a, b = b, (a + b) % m
if (a, b) == beg:
return cache[n % i]
cache.append(b)
return b


text:
# The brown hairs present at the base of the petiole of Pteris are called :

$\begin {array} {1 1} (1)\;Setae & \quad (2)\;Ramenta \\ (3)\;Spines & \quad (4)\;Stipules \end {array}$


text:
# Revision history [back]

That is it. You can also use the sum command to combine a list of plot objects.

f=x^2+10
p=[]
for i in range(0,5):
p.append(plot(f-i,(x,-3,3)))
sum(p)

You can use list comprehensions in Python to shorten this significantly and produce the same result.

sum([plot(x^2+10 - i,(x,-3,3)) for i in range(0,5)])


text:
# [NTG-context] Font installation

Thomas A. Schmitz thomas.schmitz at uni-bonn.de
Mon Nov 6 15:08:46 CET 2006

On Nov 6, 2006, at 2:54 PM, Antoine Junod wrote:

> tmf files are in:
>
>   ./texmf-fonts/fonts/tfm/sil/doulos/texnansi-DoulosSILR.tfm
>   ./texmf-fonts/fonts/tfm/sil/doulos/texnansi-raw-DoulosSILR.tfm
>
> mtexfont.pdf seems to say that's the right place (page 3).
>
> Yes, I've run texhash/mktexlsr.
>
> What else should I check?
>
> -AJ

Excuse me, I wasn't paying enough attention. From your log, it is
clear that ConTeXt is looking for a tfm that is called DoulosSil.tfm
-- which, of course, isn't there. I think the reason is because you
use the same name "doulos" for all your definitions. Try to edit your
test file like so:

\usetypescriptfile[type-doulos]
\definetypeface[Doulos][rm][serif][doulos][default][encoding=texnansi]
\setupbodyfont[Doulos,rm,10pt]

\starttext
This is the end, gggggnnnnnn
\stoptext

HTH

Thomas


text:
# Interlace frame numbers with file output node

I have a setup in the compositor that takes a piece of footage, does some operations, and outputs 3 difference files. Let's call them output A, B, and C. I have the file output node with added sockets to output each. What this gives me in the output folder is each output followed by the frame number. For example, frame 1 will give me A-0001.png, B-0001.png, C-0001.png.

What I would like is to alter the frame number appended to the output files so that instead I would have A-0001.png, B-0002.png, C-0003.png. Frame 2 would then give A-0004, B-0005, C-0006.

The end result would triple the number of frames of the animation and have them interlaced.

Is this possible with the file output node? Is it possible with a script?

• I think, the frame number will only be added if you don't specify the complete filename but omit the ending (the file suffix like .png). However, you might script a complete filename including your desired frame numbers via a driver function. You should be able to calculate your frame number via (bpy.context.scene.frame_current - 1) * 3 + output_offset (with output_offset being 1..3 for A..C. in your custom function. – Samoth May 2 '16 at 8:18
• The File Output node seems to add the frame# and format regardless. If I tell it the output is A.png, it'll give me A.png0001.png. – Ascalon May 2 '16 at 20:06
• I have the same issue :( Seems no way to stop blender appending the exact frame number to the filename. – hedgehog90 Apr 23 '19 at 12:12
• Setting render.use_file_extension=False removes the extension, but the frame number is still added. – Martin R. Aug 20 '19 at 23:08

I'm maybe wrong but it seems there is no way to avoid Blender (2.8) to remove the frame number and the extension of the filename with CompositorNodeOutputFile object, as I'm rendering by a python script I finally fixed it by renaming the files with os.rename combined with a regular expression just after render.