text:
§19.36(i) Duplication Method

Numerical differences between the variables of a symmetric integral can be reduced in magnitude by successive factors of 4 by repeated applications of the duplication theorem, as shown by (19.26.18). When the differences are moderately small, the iteration is stopped, the elementary symmetric functions of certain differences are calculated, and a polynomial consisting of a fixed number of terms of the sum in (19.19.7) is evaluated. For $\mathop{R_{F}\/}\nolimits$ the polynomial of degree 7, for example, is

 19.36.1 $1-\tfrac{1}{10}E_{2}+\tfrac{1}{14}E_{3}+\tfrac{1}{24}E_{2}^{2}-\tfrac{3}{44}E_% {2}E_{3}-\tfrac{5}{208}E_{2}^{3}+\tfrac{3}{104}E_{3}^{2}+\tfrac{1}{16}E_{2}^{2% }E_{3},$ Symbols: $E_{s}(\mathbf{z})$: elementary symmetric function Referenced by: §19.19, §19.36(i), §19.36(i) Permalink: http://dlmf.nist.gov/19.36.E1 Encodings: TeX, pMML, png

where the elementary symmetric functions $E_{s}$ are defined by (19.19.4). If (19.36.1) is used instead of its first five terms, then the factor $(3r)^{-1/6}$ in Carlson (1995, (2.2)) is changed to $(3r)^{-1/8}$.

For both $\mathop{R_{D}\/}\nolimits$ and $\mathop{R_{J}\/}\nolimits$ the factor $(r/4)^{-1/6}$ in Carlson (1995, (2.18)) is changed to $(r/5)^{-1/8}$ when the following polynomial of degree 7 (the same for both) is used instead of its first seven terms:

 19.36.2 $1-\tfrac{3}{14}E_{2}+\tfrac{1}{6}E_{3}+\tfrac{9}{88}E_{2}^{2}-\tfrac{3}{22}E_{% 4}-\tfrac{9}{52}E_{2}E_{3}+\tfrac{3}{26}E_{5}-\tfrac{1}{16}E_{2}^{3}+\tfrac{3}% {40}E_{3}^{2}+\tfrac{3}{20}E_{2}E_{4}+\tfrac{45}{272}E_{2}^{2}E_{3}-\tfrac{9}{% 68}(E_{3}E_{4}+E_{2}E_{5}).$ Symbols: $E_{s}(\mathbf{z})$: elementary symmetric function Referenced by: §19.19 Permalink: http://dlmf.nist.gov/19.36.E2 Encodings: TeX, pMML, png

Polynomials of still higher degree can be obtained from (19.19.5) and (19.19.7).

The duplication method starts with computation of $\lambda_{0}=\sqrt{x}\sqrt{y}+\sqrt{y}\sqrt{z}+\sqrt{z}\sqrt{x}$. The reductions in §19.29(i) represent $x,y,z$ as squares, for example $x=U_{12}^{2}$ in (19.29.4). Because $U_{12}$ may be real and negative, or even complex, care is needed to ensure $\sqrt{x}=U_{12}$, and similarly for $y$ and $z$. This precaution is needed only for $\lambda_{0}$. Alternatively, the first duplication is done analytically as in Carlson and FitzSimons (2000), where further information can be found.

Example

Three applications of (19.26.18) yield

 19.36.3 $\mathop{R_{F}\/}\nolimits\!\left(1,2,4\right)=\mathop{R_{F}\/}\nolimits\!\left% (z_{1},z_{2},z_{3}\right),$

where, in the notation of (19.19.7) with $a=-\frac{1}{2}$ and $n=3$,

 19.36.4 \begin{aligned}\displaystyle z_{1}&\displaystyle=2.10985\;99098\;8,\\ \displaystyle z_{3}&\displaystyle=2.15673\;49098\;8,\\ \displaystyle Z_{1}&\displaystyle=0.00977\;77253\;5,\end{aligned}\quad\begin{% aligned}\displaystyle z_{2}&\displaystyle=2.12548\;49098\;8,\\ \displaystyle A&\displaystyle=2.13069\;32432\;1,\\ \displaystyle Z_{2}&\displaystyle=0.00244\;44313\;4,\end{aligned}\\ {Z_{3}=-Z_{1}-Z_{2}=-0.01222\;21566\;9,}\\ {E_{2}=\Sci{-1.25480\;14}{-4},\quad E_{3}=\Sci{-2.9212}{-7}.}

The first five terms of (19.36.1) suffice for

 19.36.5 $\mathop{R_{F}\/}\nolimits\!\left(1,2,4\right)=0.68508\;58166\dots.$ Symbols: $\mathop{R_{F}\/}\nolimits\!\left(x,y,z\right)$: symmetric elliptic integral of first kind Referenced by: §19.36(ii) Permalink: http://dlmf.nist.gov/19.36.E5 Encodings: TeX, pMML, png

All cases of $\mathop{R_{F}\/}\nolimits$, $\mathop{R_{C}\/}\nolimits$, $\mathop{R_{J}\/}\nolimits$, and $\mathop{R_{D}\/}\nolimits$ are computed by essentially the same procedure (after transforming Cauchy principal values by means of (19.20.14) and (19.2.20)). Complex values of the variables are allowed, with some restrictions in the case of $\mathop{R_{J}\/}\nolimits$ that are sufficient but not always necessary. The computation is slowest for complete cases. For details see Carlson (1995, 2002) and Carlson and FitzSimons (2000). In the Appendix of the last reference it is shown how to compute $\mathop{R_{J}\/}\nolimits$ without computing $\mathop{R_{C}\/}\nolimits$ more than once. Because of cancellations in (19.26.21) it is advisable to compute $\mathop{R_{G}\/}\nolimits$ from $\mathop{R_{F}\/}\nolimits$ and $\mathop{R_{D}\/}\nolimits$ by (19.21.10) or else to use §19.36(ii).

Legendre’s integrals can be computed from symmetric integrals by using the relations in §19.25(i). Note the remark following (19.25.11). If (19.25.9) is used when $0\leq k^{2}\leq 1$, cancellations may lead to loss of significant figures when $k^{2}$ is close to 1 and $\phi>\pi/4$, as shown by Reinsch and Raab (2000). The cancellations can be eliminated, however, by using (19.25.10).

Accurate values of $\mathop{F\/}\nolimits\!\left(\phi,k\right)-\mathop{E\/}\nolimits\!\left(\phi,k\right)$ for $k^{2}$ near 0 can be obtained from $\mathop{R_{D}\/}\nolimits$ by (19.2.6) and (19.25.13).

Complete cases of Legendre’s integrals and symmetric integrals can be computed with quadratic convergence by the AGM method (including Bartky transformations), using the equations in §19.8(i) and §19.22(ii), respectively.

The incomplete integrals $\mathop{R_{F}\/}\nolimits\!\left(x,y,z\right)$ and $\mathop{R_{G}\/}\nolimits\!\left(x,y,z\right)$ can be computed by successive transformations in which two of the three variables converge quadratically to a common value and the integrals reduce to $\mathop{R_{C}\/}\nolimits$, accompanied by two quadratically convergent series in the case of $\mathop{R_{G}\/}\nolimits$; compare Carlson (1965, §§5,6). (In Legendre’s notation the modulus $k$ approaches 0 or 1.) Let

 19.36.6 $\displaystyle 2a_{n+1}$ $\displaystyle=a_{n}+\sqrt{a_{n}^{2}-c_{n}^{2}},$ $\displaystyle 2c_{n+1}$ $\displaystyle=a_{n}-\sqrt{a_{n}^{2}-c_{n}^{2}}=c_{n}^{2}/(2a_{n+1}),$ $\displaystyle 2t_{n+1}$ $\displaystyle=t_{n}+\sqrt{t_{n}^{2}+\theta c_{n}^{2}},$ Symbols: $n$: nonnegative integer Referenced by: §19.36(ii), §19.36(ii) Permalink: http://dlmf.nist.gov/19.36.E6 Encodings: TeX, TeX, TeX, pMML, pMML, pMML, png, png, png

where $n=0,1,2,\dots$, and

 19.36.7 $\displaystyle 0$ $\displaystyle $\displaystyle t_{0}$ $\displaystyle\geq 0,$ $\displaystyle t_{0}^{2}+\theta a_{0}^{2}$ $\displaystyle\geq 0,$ $\displaystyle\theta$ $\displaystyle=\pm 1.$ Permalink: http://dlmf.nist.gov/19.36.E7 Encodings: TeX, TeX, TeX, TeX, pMML, pMML, pMML, pMML, png, png, png, png

Then (19.22.18) implies that

 19.36.8 $\mathop{R_{F}\/}\nolimits\!\left(t_{n}^{2},t_{n}^{2}+\theta c_{n}^{2},t_{n}^{2% }+\theta a_{n}^{2}\right)$ Symbols: $\mathop{R_{F}\/}\nolimits\!\left(x,y,z\right)$: symmetric elliptic integral of first kind and $n$: nonnegative integer Referenced by: §19.36(ii) Permalink: http://dlmf.nist.gov/19.36.E8 Encodings: TeX, pMML, png

is independent of $n$. As $n\to\infty$, $c_{n}$, $a_{n}$, and $t_{n}$ converge quadratically to limits $0$, $M$, and $T$, respectively; hence

 19.36.9 $\mathop{R_{F}\/}\nolimits\!\left(t_{0}^{2},t_{0}^{2}+\theta c_{0}^{2},t_{0}^{2% }+\theta a_{0}^{2}\right)=\mathop{R_{F}\/}\nolimits\!\left(T^{2},T^{2},T^{2}+% \theta M^{2}\right)=\mathop{R_{C}\/}\nolimits\!\left(T^{2}+\theta M^{2},T^{2}% \right).$

If $t_{0}=a_{0}$ and $\theta=-1$, so that $t_{n}=a_{n}$, then this procedure reduces to the AGM method for the complete integral.

The step from $n$ to $n+1$ is an ascending Landen transformation if $\theta=1$ (leading ultimately to a hyperbolic case of $\mathop{R_{C}\/}\nolimits$) or a descending Gauss transformation if $\theta=-1$ (leading to a circular case of $\mathop{R_{C}\/}\nolimits$). If $x$, $y$, and $z$ are permuted so that $0\leq x, then the computation of $\mathop{R_{F}\/}\nolimits\!\left(x,y,z\right)$ is fastest if we make $c_{0}^{2}\leq a_{0}^{2}/2$ by choosing $\theta=1$ when $y<(x+z)/2$ or $\theta=-1$ when $y\geq(x+z)/2$.

Example

We compute $\mathop{R_{F}\/}\nolimits\!\left(1,2,4\right)$ by setting $\theta=1$, $t_{0}=c_{0}=1$, and $a_{0}=\sqrt{3}$. Then

 19.36.10 $\displaystyle c_{3}^{2}$ $\displaystyle=\Sci{6.65}{-12},$ $\displaystyle a_{3}^{2}$ $\displaystyle=2.46209\;30206\;0=M^{2},$ $\displaystyle t_{3}^{2}$ $\displaystyle=1.46971\;53173\;1=T^{2}.$ Symbols: $M$: limit and $T$: limit Permalink: http://dlmf.nist.gov/19.36.E10 Encodings: TeX, TeX, TeX, pMML, pMML, pMML, png, png, png

Hence

 19.36.11 $\mathop{R_{F}\/}\nolimits\!\left(1,2,4\right)=\mathop{R_{C}\/}\nolimits\!\left% (T^{2}+M^{2},T^{2}\right)=0.68508\;58166,$

in agreement with (19.36.5). Here $\mathop{R_{C}\/}\nolimits$ is computed either by the duplication algorithm in Carlson (1995) or via (19.2.19).

 19.36.12 $\displaystyle h_{n}$ $\displaystyle=\sqrt{t_{n}^{2}+\theta a_{n}^{2}},$ $n=0,1,2,\dots$, $\displaystyle h_{n}$ $\displaystyle=h_{n-1}\frac{t_{n}}{\sqrt{t_{n}^{2}+\theta c_{n}^{2}}},$ $n=1,2,\dots$. Symbols: $n$: nonnegative integer and $h_{n}$ Referenced by: §19.36(ii) Permalink: http://dlmf.nist.gov/19.36.E12 Encodings: TeX, TeX, pMML, pMML, png, png

Then

 19.36.13 $2\!\mathop{R_{G}\/}\nolimits\!\left(t_{0}^{2},t_{0}^{2}+\theta c_{0}^{2},t_{0}% ^{2}+\theta a_{0}^{2}\right)=\left(t_{0}^{2}+\theta\sum_{m=0}^{\infty}2^{m-1}c% _{m}^{2}\right)\mathop{R_{C}\/}\nolimits\!\left(T^{2}+\theta M^{2},T^{2}\right% )+h_{0}+\sum_{m=1}^{\infty}2^{m}(h_{m}-h_{m-1}).$

If the iteration of (19.36.6) and (19.36.12) is stopped when $c_{s}<\sqrt{r}t_{s}$ ($M$ and $T$ being approximated by $a_{s}$ and $t_{s}$, and the infinite series being truncated), then the relative error in $\mathop{R_{F}\/}\nolimits$ and $\mathop{R_{G}\/}\nolimits$ is less than $r$ if we neglect terms of order $r^{2}$.

$\mathop{F\/}\nolimits\!\left(\phi,k\right)$ can be evaluated by using (19.25.5). $\mathop{E\/}\nolimits\!\left(\phi,k\right)$ can be evaluated by using (19.25.7), and $\mathop{R_{D}\/}\nolimits$ by using (19.21.10), but cancellations may become significant. Thompson (1997, pp. 499, 504) uses descending Landen transformations for both $\mathop{F\/}\nolimits\!\left(\phi,k\right)$ and $\mathop{E\/}\nolimits\!\left(\phi,k\right)$. A summary for $\mathop{F\/}\nolimits\!\left(\phi,k\right)$ is given in Gautschi (1975, §3). For computation of $\mathop{K\/}\nolimits\!\left(k\right)$ and $\mathop{E\/}\nolimits\!\left(k\right)$ with complex $k$ see Fettis and Caslin (1969) and Morita (1978).

(19.22.20) reduces to $0=0$ if $p=x$ or $p=y$, and (19.22.19) reduces to $0=0$ if $z=x$ or $z=y$. Near these points there will be loss of significant figures in the computation of $\mathop{R_{J}\/}\nolimits$ or $\mathop{R_{D}\/}\nolimits$.

Descending Gauss transformations of $\mathop{\Pi\/}\nolimits\!\left(\phi,\alpha^{2},k\right)$ (see (19.8.20)) are used in Fettis (1965) to compute a large table (see §19.37(iii)). This method loses significant figures in $\rho$ if $\alpha^{2}$ and $k^{2}$ are nearly equal unless they are given exact values—as they can be for tables. If $\alpha^{2}=k^{2}$, then the method fails, but the function can be expressed by (19.6.13) in terms of $\mathop{E\/}\nolimits\!\left(\phi,k\right)$, for which Neuman (1969b) uses ascending Landen transformations.

Computation of Legendre’s integrals of all three kinds by quadratic transformation is described by Cazenave (1969, pp. 128–159, 208–230).

Quadratic transformations can be applied to compute Bulirsch’s integrals (§19.2(iii)). The function $\mathop{\mathrm{cel}\/}\nolimits\!\left(k_{c},p,a,b\right)$ is computed by successive Bartky transformations (Bulirsch and Stoer (1968), Bulirsch (1969b)). The function $\mathop{\mathrm{el2}\/}\nolimits\!\left(x,k_{c},a,b\right)$ is computed by descending Landen transformations if $x$ is real, or by descending Gauss transformations if $x$ is complex (Bulirsch (1965b)). Remedies for cancellation when $x$ is real and near 0 are supplied in Midy (1975). See also Bulirsch (1969a) and Reinsch and Raab (2000).

Bulirsch (1969a, b) extend Bartky’s transformation to $\mathop{\mathrm{el3}\/}\nolimits\!\left(x,k_{c},p\right)$ by expressing it in terms of the first incomplete integral, a complete integral of the third kind, and a more complicated integral to which Bartky’s method can be applied. The cases $k_{c}^{2}/2\leq p<\infty$ and $-\infty require different treatment for numerical purposes, and again precautions are needed to avoid cancellations.

§19.36(iii) Via Theta Functions

Lee (1990) compares the use of theta functions for computation of $\mathop{K\/}\nolimits\!\left(k\right)$, $\mathop{E\/}\nolimits\!\left(k\right)$, and $\mathop{K\/}\nolimits\!\left(k\right)-\mathop{E\/}\nolimits\!\left(k\right)$, $0\leq k^{2}\leq 1$, with four other methods. Also, see Todd (1975) for a special case of $\mathop{K\/}\nolimits\!\left(k\right)$. For computation of Legendre’s integral of the third kind, see Abramowitz and Stegun (1964, §§17.7 and 17.8, Examples 15, 17, 19, and 20). For integrals of the second and third kinds see Lawden (1989, §§3.4–3.7).

§19.36(iv) Other Methods

Numerical quadrature is slower than most methods for the standard integrals but can be useful for elliptic integrals that have complicated representations in terms of standard integrals. See §3.5.

For series expansions of Legendre’s integrals see §19.5. Faster convergence of power series for $\mathop{K\/}\nolimits\!\left(k\right)$ and $\mathop{E\/}\nolimits\!\left(k\right)$ can be achieved by using (19.5.1) and (19.5.2) in the right-hand sides of (19.8.12). A three-part computational procedure for $\mathop{\Pi\/}\nolimits\!\left(\phi,\alpha^{2},k\right)$ is described by Franke (1965) for $\alpha^{2}<1$.

When the values of complete integrals are known, addition theorems with $\psi=\pi/2$19.11(ii)) ease the computation of functions such as $\mathop{F\/}\nolimits\!\left(\phi,k\right)$ when $\frac{1}{2}\pi-\phi$ is small and positive. Similarly, §19.26(ii) eases the computation of functions such as $\mathop{R_{F}\/}\nolimits\!\left(x,y,z\right)$ when $x$ ($>0$) is small compared with $\min(y,z)$. These special theorems are also useful for checking computer codes.

For fast methods for computing the incomplete elliptic integral of the first kind see Karp and Sitnik (2007) and Fukushima (2010).


text:
Great Sharpe ratio with consumer staples sector strategy - TOO GOOD TO BE TRUE?

Hi all,

I recently implemented a VERY SIMPLE strategy with the consumer staples sector. It generates 736% total returns, a sharpe of 1.32, -34% max drawdown between 2003 and 2018. Obviously, this strategy does not meet all the risk criteria of Quantopian contest, but I'm thinking here more for personal use. Would anyone mind taking a look and telling me whether this strategy is too good to be true? If a common factor is this widely known and accessible, why it has not been used in the real world? Here is the strategy overview:

• Filter: SP500
• Commission: $5/ trade • Slippage: 5 basis points • Rebalance: every 4 weeks • Position: long 10 stocks with the lowest P/E • Leverage: 1x This is stupidly simple.... but just check it out :) 43 Loading... Backtest from to with initial capital Total Returns -- Alpha -- Beta -- Sharpe -- Sortino -- Max Drawdown -- Benchmark Returns -- Volatility --  Returns 1 Month 3 Month 6 Month 12 Month  Alpha 1 Month 3 Month 6 Month 12 Month  Beta 1 Month 3 Month 6 Month 12 Month  Sharpe 1 Month 3 Month 6 Month 12 Month  Sortino 1 Month 3 Month 6 Month 12 Month  Volatility 1 Month 3 Month 6 Month 12 Month  Max Drawdown 1 Month 3 Month 6 Month 12 Month from quantopian.algorithm import attach_pipeline, pipeline_output from quantopian.pipeline import Pipeline import quantopian.optimize as opt import quantopian.algorithm as algo from quantopian.pipeline.data import Fundamentals, factset from quantopian.pipeline.filters import QTradableStocksUS, Q500US from quantopian.pipeline.classifiers.fundamentals import Sector MAX_GROSS_LEVERAGE = 1.0 TOTAL_POSITIONS = 10 def initialize(context): schedule_function(func = rebalance, date_rule = date_rules.month_start(), time_rule = time_rules.market_open(), ) attach_pipeline(make_pipeline(),'CONSUMER_DEFENSIVE') set_commission(commission.PerTrade(5)) set_slippage(slippage.FixedBasisPointsSlippage(basis_points=5)) def make_pipeline(): POR = factset.Fundamentals.pay_out_ratio_af.latest PE = Fundamentals.pe_ratio.latest PFCF = Fundamentals.fcf_ratio.latest sp_500 = Q500US() universe = Q500US() & Sector.eq(Sector(), Sector.CONSUMER_DEFENSIVE) #& (POR <= 0.0000000000001) #filter1 = PFCF.bottom(20, universe) longs = PE.bottom(10, universe) return Pipeline( columns={ #'POR': POR, 'longs': longs, 'sector': Sector(), }, screen = universe & longs ) def before_trading_start(context, data): context.pipeline_output = pipeline_output('CONSUMER_DEFENSIVE') context.longs = context.pipeline_output[context.pipeline_output['longs']].index def rebalance(context,data): my_positions = context.portfolio.positions long_weight = 1.0/TOTAL_POSITIONS for security in my_positions: if security not in context.longs and data.can_trade(security): order_target_percent(security, 0) for security in context.longs: if data.can_trade(security): if security not in my_positions: order_target_percent(security, long_weight) else: log.info("Didn't open position") There was a runtime error. 14 responses Hello Nam, these are impressive numbers! Returns like these aren't impossible to achieve through algorithmic trading, but it is also smart to make sure our algo's can survive and still perform under certain pressures. Does this one still perform the same with smaller dollar amounts ($50k, $100k,$1M, $5M)? Or Larger? How does it do on 1 year intervals? You're certainly on to something here! The returns look good in the past since consumer defensive sector was the best performing sector during the recession. The real question is: Do you still beat the market after taxes? Brief dips into margin up to 4M (custom chart) surely from partial fills and thus scheduling sells some time before buys may help. 15 Loading... Backtest from to with initial capital Total Returns -- Alpha -- Beta -- Sharpe -- Sortino -- Max Drawdown -- Benchmark Returns -- Volatility --  Returns 1 Month 3 Month 6 Month 12 Month  Alpha 1 Month 3 Month 6 Month 12 Month  Beta 1 Month 3 Month 6 Month 12 Month  Sharpe 1 Month 3 Month 6 Month 12 Month  Sortino 1 Month 3 Month 6 Month 12 Month  Volatility 1 Month 3 Month 6 Month 12 Month  Max Drawdown 1 Month 3 Month 6 Month 12 Month from quantopian.algorithm import attach_pipeline, pipeline_output from quantopian.pipeline import Pipeline import quantopian.optimize as opt import quantopian.algorithm as algo from quantopian.pipeline.data import Fundamentals, factset from quantopian.pipeline.filters import QTradableStocksUS, Q500US from quantopian.pipeline.classifiers.fundamentals import Sector MAX_GROSS_LEVERAGE = 1.0 TOTAL_POSITIONS = 10 def initialize(context): schedule_function(func = rebalance, date_rule = date_rules.month_start(), time_rule = time_rules.market_open(), ) attach_pipeline(make_pipeline(),'CONSUMER_DEFENSIVE') set_commission(commission.PerTrade(5)) set_slippage(slippage.FixedBasisPointsSlippage(basis_points=5)) context.csh_low = context.portfolio.cash context.mxlv = 0 for i in range(1, 391): schedule_function(extremes, date_rules.every_day(), time_rules.market_open(minutes=i)) def make_pipeline(): #POR = factset.Fundamentals.pay_out_ratio_af.latest PE = Fundamentals.pe_ratio.latest #PFCF = Fundamentals.fcf_ratio.latest #sp_500 = Q500US() universe = Q500US() & Sector.eq(Sector(), Sector.CONSUMER_DEFENSIVE) #& (POR <= 0.0000000000001) #filter1 = PFCF.bottom(20, universe) longs = PE.bottom(10, universe) return Pipeline( columns={ #'POR': POR, 'pe' : PE, 'longs' : longs, 'sector': Sector(), }, screen = universe & longs ) def before_trading_start(context, data): context.pipeline_output = pipeline_output('CONSUMER_DEFENSIVE') context.longs = context.pipeline_output[context.pipeline_output['longs']].index if context.portfolio.cash != context.portfolio.starting_cash: record(cash = context.portfolio.cash) do_log_preview = 0 # a way to toggle this off when it becomes annoying if do_log_preview: try: context.log_data_done except: log_data(context, context.pipeline_output, 9) # show pipe info once def rebalance(context,data): my_positions = context.portfolio.positions long_weight = 1.0 / TOTAL_POSITIONS for security in my_positions: if not data.can_trade(security): continue if security not in context.longs: order_target_percent(security, 0) for security in context.longs: if not data.can_trade(security): continue if security not in my_positions: order_target_percent(security, long_weight) else: log.info("Didn't open position") def extremes(context, data): if context.account.leverage > context.mxlv: context.mxlv = context.account.leverage record(MaxLv = context.mxlv) if context.portfolio.cash < context.csh_low: context.csh_low = context.portfolio.cash record(CashLow = context.csh_low) def log_data(context, z, num, fields=None): ''' Log info about pipeline output or, z can be any DataFrame or Series https://quantopian.com/posts/overview-of-pipeline-content-easy-to-add-to-your-backtest ''' if not len(z): log.info('Empty pipe') return try: context.log_data_done except: log.info('starting_cash${:,}   portfolio {:,} {} positions ...'.format( int(context.portfolio.cash), int(context.portfolio.portfolio_value), len(context.portfolio.positions) )) context.log_data_done = 1 # Options log_nan_only = 0 # Only log if nans are present. show_sectors = 0 # If sectors, see them or not. show_sorted_details = 1 # [num] high & low securities sorted, each column. padmax = 6 # num characters for each field, starting point. def out(lines): # log data lines of output efficiently buffer_len = 1024 # each group chunk = ':' for line in lines: if line is None or not len(line): continue # skip if empty string for example if len(chunk) + len(line) < buffer_len: # Add to chunk if will still be under buffer_len chunk += '\n{}'.format(line) else: # Or log chunk and start over with new line. log.info(chunk) chunk = ':\n{}'.format(line) if len(chunk) > 2: # if anything remaining log.info(chunk) if 'MultiIndex' in str(type(z.index)): log.info('Found MultiIndex, not set up to handle it, bailing out of log_data()') return # Change index to just symbols for readability, meanwhile, right-aligned z = z.rename(index=dict(zip(z.index.tolist(), [i.symbol.rjust(6) for i in z.index.tolist()]))) # Series ...... if 'Series' in str(type(z)): # is Series, not DataFrame nan_count = len(z[z != z]) nan_count = 'NaNs {}/{}'.format(nan_count, len(z)) if nan_count else '' if (log_nan_only and nan_count) or not log_nan_only: pad = max( padmax, len('%.5f' % z.max()) ) log.info('{}{}{} Series len {}'.format('min'.rjust(pad+5), 'mean'.rjust(pad+5), 'max'.rjust(pad+5), len(z))) log.info('{}{}{} {}'.format( ('%.5f' % z.round(6). min()).rjust(pad+5), ('%.5f' % z.round(6).mean()).rjust(pad+5), ('%.5f' % z.round(6). max()).rjust(pad+5), nan_count )) log.info('High\n{}'.format(z.sort_values(ascending=False).head(num))) log.info('Low\n{}' .format(z.sort_values(ascending=False).tail(num))) return # DataFrame ...... content_min_max = [ ['','min','mean','max',''] ] ; content = [] for col in z.columns: try: z[col].max() except: continue # skip non-numeric if col == 'sector' and not show_sectors: continue nan_count = len(z[col][z[col] != z[col]]) nan_count = 'NaNs {}/{}'.format(nan_count, len(z)) if nan_count else '' padmax = max( padmax, len(str(z[col].max())) ) ; mean_ = '' if len(str(z[col].max())) > 8 and 'float' in str(z[col].dtype): z[col] = z[col].round(6) # Reduce number of decimal places for floating point values if 'float' in str(z[col].dtype): mean_ = str(round(z[col].mean(), 6)) elif 'int' in str(z[col].dtype): mean_ = str(round(z[col].mean(), 1)) content_min_max.append([col, str(z[col] .min()), mean_, str(z[col] .max()), nan_count]) if log_nan_only and nan_count or not log_nan_only: log.info('Rows: {} Columns: {}'.format(z.shape[0], z.shape[1])) if len(z.columns) == 1: content.append('Rows: {}'.format(z.shape[0])) paddings = [6 for i in range(4)] for lst in content_min_max: # set max lengths i = 0 for val in lst[:4]: # value in each sub-list paddings[i] = max(paddings[i], len(str(val))) i += 1 headr = content_min_max[0] content.append(('{}{}{}{}{}'.format( headr[0] .rjust(paddings[0]), (headr[1]).rjust(paddings[1]+5), (headr[2]).rjust(paddings[2]+5), (headr[3]).rjust(paddings[3]+5), '' ))) for lst in content_min_max[1:]: # populate content using max lengths content.append(('{}{}{}{} {}'.format( lst[0].rjust(paddings[0]), lst[1].rjust(paddings[1]+5), lst[2].rjust(paddings[2]+5), lst[3].rjust(paddings[3]+5), lst[4], ))) out(content) if not show_sorted_details: return if len(z.columns) == 1: return # skip detail if only 1 column if fields == None: details = z.columns content = [] for detail in details: if detail == 'sector' and not show_sectors: continue hi = z[details].sort_values(by=detail, ascending=False).head(num) lo = z[details].sort_values(by=detail, ascending=False).tail(num) content.append(('_ _ _ {} _ _ _' .format(detail))) content.append(('{} highs ...\n{}'.format(detail, str(hi)))) content.append(('{} lows ...\n{}'.format(detail, str(lo)))) if log_nan_only and not len(lo[lo[detail] != lo[detail]]): continue # skip if no nans out(content)  There was a runtime error. Hey Jack Grebin I've tested it with different cash amounts (apparently smaller funds led to lower leverage because there's no partial fills) and the total returns are still spectacular. Hey Legendary Mode do you know any good method to incorporate taxes on Quantopian? Much appreciated! Hi Nam, I understand your comment about criteria, and caveat "for personal use" rather than Q contests, and that's all OK. As you say, for a very simple strategy it looks almost too good to be true ... but still it might be and, all other things equal, simpler is generally better. In the case of personal use, i'm not sure that scaling is necessarily a problem and, for some people/entities, taxes may not necessarily be an issue either. OK, so far, so good. However what concerns me most is the question of HOW exactly did you actually come up with this "strategy"? I hope this question will provoke some thoughtful discussion not only about Nam's specific strategy mentioned here, but also about the whole concept of system strategy design in general. If you already know that something (e.g. a single star performer stock, sector or whatever) performed well over some piece of past history, then is selecting it actually a "strategy" at all, or is it just driving by looking in the rear-view mirror? Demonstrating that something performed well in the past is not necessarily a valid form of "back-testing", and is neither a necessary nor sufficient condition to reassure anyone that it will continue to perform well in future. What might lead you to believe that the strategy Nam found here (or alternatively any other stock, ETF or whatever) that performed well in the past is at all likely to continue to be useful going forward? Hi Tony Morland, I appreciate your point. I think that nobody can "predict" the future. That is why we need to look deeply into the past because that is all we got. Whether to call it a "strategy" or not, I think it depends on your definition. To me a strategy is any reasonable hypothesis that can be tested and duplicated easily. Nam there isn't an easy way to incorporate taxes in Quantopian. However, you can approximate taxes \begin{align} annual\ returns = (1 + 7.36)^{1/15} = 1.152 \\ approximate\ returns\ after\ taxes = .152(1-taxrate) \end{align} With 40% tax rate you make 9% a year or 264% in 15 years vs. 305.88% in SPY ETF Hi Nam, Yes, i believe you're right, no-one can actually predict the future. Most who claim to are charlatans, and if anyone can, then they sure aren't telling us :)) Therefore I also agree with the corollary that, as you say: "we need to look deeply into the past because that is all we got". The semantics of what we call a "strategy" is not really a key issue here, and i certainly have no argument with your definition. However what i am really trying to do is to elicit discussion, whether from you or from anyone else, about HOW can we best go about looking at the past so as to form what are likely to be the most useful (i.e. successful going forward) sorts of trading strategies? Here are some "for examples": Do we have any understanding of the process and/or the reasons why price might have behaved in a certain way in the past and why that might or might not continue be applicable going forward? Putting this another way, if we have some sort of underlying conceptual model then does this help us to believe that our strategy might be robust? Did we (you, Nam, in this case) actually have an idea FIRST and then test it with UNSEEN data, or simply look at a bunch of past data? Yes you are right in a sense that the past is all we have, but the way we choose to handle this is potentially likely to make a difference to the quality of our conclusions and therefore to strategy or trading system development. Please allow me to illustrate with an amusing story, a Trader's joke: Three old friends go to a casino in the Australian outback where an illegal gambling game called "Two-Up" is being played, with betting based on the outcome of tossing some coins. The 3 friends watch in amazement as the tossed coins come up 14 Heads in a row. The first friend is a bartender and he says: "OK, now i'm gonna bet on Tails. The Law of Averages says that 14 Heads in a row is nearly impossible so the next throw has GOTTA come up Tails, just by the Law of Averages!" The 2nd friend is a Statistics Professor and he says: " No, no, you are wrong and you are making a very common mistake. The individual coin tosses are independent trials and the next outcome has no dependence whatsoever on prior outcomes. So the chance of H or T being next is 50/50, irrespective of however many of anything just came up in a row beforehand". The 3rd friend is a Trader. He says: "Nah, you're both wrong and i'm gonna bet on Heads. No way that its an unbiased coin!!" :)) OK, so who of them is right, based on the observed data that they have? Moral of the story: Be careful what we conclude from our data! What else might be going on? Maybe some "hidden variables" for example? Hi Tony Morland, The hidden variable here, I think, is the characteristics of sectors/industries. There are a lot of books/papers out there that give advice on how to filter out the best stocks based on some fundamental data, while discarding how those ratios apply differently to different sector. Now, here is what I think is an underlying conceptual model to develop ANY STRATEGY: 1) Form a reasonable hypothesis - for instance: RESPECTABLE tech companies that have low dividend payout ratio reinvest their money and will have higher returns in the future. 2) Choose some factors / ratios that may express that hypothesis. 3) Write code/ develop strategies and backtest over at least 1 bull and 1 bear market. 4) Tweak and combine that factor with other factors to see whether it is influenced by something else and not actually the "elementary" factor at play I did not look at a bunch of data. This strategy I was inspired by a book. Looking to test every single ratio out there or coming up with new factors (as a lot of traders do with technical indicators) is simply ineffective and wasteful. Thank you for the story. I am trying to use quantitative finance in a new direction - fundamental analysis. Besides, I think Quantopian's contest algorithm and their risk metrics can only apply to big funds. They are forcing us to use long/short strategy and that's a shame. Here is the thing: if you have an opportunity to long a good stock, why bother shorting a bad one? Best, Nam Hi Nam, Yes, i agree that many fundamental ratios definitely apply in different ways to different Sectors. Within any given sector, it may often be very helpful to normalize or compare individual company ratios with that of the sector median value. Your conceptual model for strategy development makes good sense. With regard to item 1) "respectable tech companies", and fundamental ratios, a good case-study example is Amazon. Based on PE ratios in the past, Amazon has been "expensive". However Amazon's profits were relatively low COMPARED to what they could have been for one very good reason: Amazon was plowing (= ploughing, depending on where you come from :)) a lot of its earnings back into well-considered R&D expenditure. So although Amazon LOOKED "expensive", what it was really doing was making a conscious choice in setting itself up very carefully for the strongest possible long-term future, rather than maximizing profits in the short-term. Smart CEO there! Would you care to share with us what was the book that inspired you? Maybe some of us have read it too.... Regarding your comments on Q's contest, equity long/short, etc, the fact is this: Q is running a fund, they want to get a diverse range of algos they can use for the fund, and that's the purpose of the contest. The people who invest in Q's fund want stable returns with very low drawdowns (DD) which are uncorrelated with movements of the general market. This can be achieved most easily with a L/S strategy, so that's why they use it and why it forms the basis of the contest. The rationale behind going Long a good stock and simultaneously Shorting a bad one is to remain market neutral, just in case the whole market takes an unexpected dive! On the other hand, for strictly personal use, you might have a much higher tolerance for DDs and for returns that are correlated with the overall market, especially if you are using s system that you developed yourself, tested carefully, and confident about. Just to share with you my own situation, i enjoy entering Q's contests from time to time, and i also write trading systems for my own personal use. The two different types (for Q vs for myself) are very, very different in character. The ones for Q are equity L/S, and the ones for myself are not. No problem. Sometimes the comparisons between the two different types are quite interesting. Cheers, best wishes, Tony Hi Tony Morland, The book I'm using is called "The Lazy Fundamental Analyst" by Fred Piard. I am wondering if these strategies are so simple, have they been used substantially already in the market? Let me know if you find something. Also, I have noticed that you are a great contributor to Quantopian's forum. Are you involved with Quantopian in any way? Have you won any contest? Why are you so committed - I'm curious... Nam Hi Nam, I haven't seen that book but i will check it out. Thanks. There are some good modern books on using Fundamental Analysis in trading. In particular, i would definitely recommend the following as being what i consider to be among some of the best. I have coded up a lot of the ideas in them for use in my own personal trading systems for stocks (which is not here in Q and is not in python, which i am not really very skilled is using). Recommended books: -- "Quantitative Value" by Wesley Gray & Tobias Carlisle, 2013 (Wiley). -- "Your Complete Guide to factor-Based Investing" by Andrew Berkin & Larry Swedroe, 2016 (BAM Alliance Press). Yes, i believe all of the strategies are substantially and widely used, but are still quite sound and effective, and so definitely worth looking at. Also, if you have any background or skills related to understanding corporate financial statements, then that can help a lot to assist you to know how to read between the lines a bit. Companies are not always 100% honest with their financial reporting, and there are lots of different ways for them to "cook the books", especially with regard to reported Earnings. That is, i believe, the main reason why any calculations involving PE ratios are not always as successful as we might hope ... but there are ways around that problem. Thank you for your kind words about my contributions to Q's forum. I am not involved with Quantopian (Q) at all in the sense of working for them. I am just an individual trader, trading my own personal account, very much in my own ways. Sometimes i look at Q's forums, and sometimes i don't look for months because i am busy with other things. Yes, I have some received some small cash winnings from several of Q's contests, although i am not really a regular with them and sometimes i don't bother to even look to see what my entries are doing! I have not (yet :)) received an allocation for Q for licensing the use of any of my algos in their fund. Actually my "committment" here is somewhat sporadic in terms of time, but when i do write to the forum here, my efforts in what i write are indeed often quite intense.

Here is an honest statement of what i think of Q and of the forum and the people who write here:
I believe that Q is genuine in its stated intention to "democritize finance", and people like Delaney McKenzie an Max Magenot, to name just 2 of them, are doing a great job, as well as being very fine people who i have met several times at workshops in Singapore. As to how well the whole concept will work, only time will tell, but Q is certainly providing some excellent free education & tools for people to use.

I think that most of the people who write on the forum here are "dabblers", maybe smart but often either lacking practical experience in trading or too "academic" in their outlook, and there are some people with whom i will not waste my time. Nevertheless there is a small handful of contributers here who are smart, skilled, original thinkers, and very practically oriented with regard to trading. Some of these people have become "online friends" for me here in the forum, even though i have never met them. It is mostly to/for them that i write, as well as for any potential new friends.

Most traders, like most people, tend to just do the same familiar things over and over again and often simply repeat like parrots what they have read without much critical thinking or active investigation of their own. So, just as most trading books are repetitive, sometimes wrong, and often not worth reading, similarly for a lot of the people who talk about trading. I am always hoping to find or meet new people who are intelligent, inquisitive and innovative. If by sharing my ideas openly with like-minded people here, we can help each other to generate just one or two good, innovative new trading ideas a year, then the effort is definitely worthwhile. In a way, my "commitment" here in the Q forum is really just self-interest :)) Does that answer your question? Feel welcome to ask more if you want to. Best wishes, Tony.

Hi Tony,

Thank you for your thoughtful response! I am very impressed with what you are doing and your intent to help others on the forum.

I have gotten and read through about 30% of the book "Your Complete Guide to Factor-based Investing" by Andrew Berkin & Larry Swedroe that you suggested. I think I should repeat the most important message of the book here, which is what makes a "factor" good:

1. Persistent - the factor returns premiums over long periods and across different economic regimes.
2. Pervasive - it holds across countries, sectors, asset classes.
3. Investable - it holds even after trading costs etc
4. Robust - it holds for various, related definitions built on the same theme.
5. Intuitive - it has some sort of logical or behavioral explanation.

I think these 5 criteria are very important to keep in mind when finding a strategy. This will help us to avoid data-mining and over-fitting.

To that end, I re-tested my algorithm but I have found a couple issues that I'd like to consult you.

1) When I backtested the same consumer staple from only 2015-2018, the algorithm has returns below the benchmark. I have tried and looked up the positions, and it seems like the 15-year one and the 3-year one both hold the same stocks from 2015-2018. What is the right way to look at this? Does my algorithm pass the "persistent" test because it generates some premiums over a long time, or is it invalid because for the last 3 years it has been underperforming?

2) I also went and backtested strategies of different factors with screener as different sectors. Namely, I used fundamental factors like PE, PS, PB, PFCF, EPS growth 1Y, Sales Growth Q/Q, Gross Mragin, ROA, ROE, Current Ratio, Payout ratio, etc. Each strategy only used 1 factor as the one I listed above. The goal is to eliminate noises and scientifically control variables.

Some factors work really well with certain sector and some don't. For instance low payout ratio works extremely well with Tech sector while PE works well with Healthcare. Here is the link to my result spreadsheet: https://docs.google.com/spreadsheets/d/1qBKQ6IEJlNSzQpWRPnHRsYuCNoTlP-bSK41JXHCUygw/edit?usp=sharing

I'd love for you to look at this and together think about what's the next step of combining different factors. If you are free, I'd prefer us to have a Skype call to learn more from each other. Message me on Quantopian :)

43
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
import quantopian.optimize as opt
import quantopian.algorithm as algo
from quantopian.pipeline.data import Fundamentals, factset
from quantopian.pipeline.filters import QTradableStocksUS, Q500US
from quantopian.pipeline.classifiers.fundamentals import Sector
from quantopian.pipeline.data.quandl import rateinf_inflation_usa
from odo import odo

MAX_GROSS_LEVERAGE = 1.0
TOTAL_POSITIONS = 10
def initialize(context):
schedule_function(func = rebalance,
date_rule = date_rules.every_day(),
time_rule = time_rules.market_open(),
)
attach_pipeline(make_pipeline(),'CONSUMER_DEFENSIVE')

set_slippage(slippage.FixedBasisPointsSlippage(basis_points=5))

def make_pipeline():
POR = factset.Fundamentals.pay_out_ratio_af.latest
NPM = Fundamentals.net_margin.latest
PE = Fundamentals.pe_ratio.latest
NAME = Fundamentals.legal_name.latest

sp_500 = Q500US()

universe = Q500US() & Sector.eq(Sector(), Sector.CONSUMER_DEFENSIVE) #& (POR <= 0.0000000000001)
#filter1 = PFCF.bottom(20, universe)
longs = PE.bottom(10, universe)
return Pipeline(
columns={
#'POR': POR,
'longs': longs,
'sector': Sector(),
'PE': PE,
'NAME': NAME,
},
screen =  universe & longs & sp_500
)

context.pipeline_output = pipeline_output('CONSUMER_DEFENSIVE')
print context.pipeline_output
context.longs = context.pipeline_output[context.pipeline_output['longs']].index

def rebalance(context,data):
my_positions = context.portfolio.positions
long_weight = 1.0/TOTAL_POSITIONS

for security in my_positions:
if security not in context.longs and data.can_trade(security):
order_target_percent(security, 0)

for security in context.longs:
log.info("Didn't open position")

format: plain


text:
GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 11 Dec 2018, 04:26

### 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 December
PrevNext
SuMoTuWeThFrSa
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
Open Detailed Calendar
• ### Free GMAT Prep Hour

December 11, 2018

December 11, 2018

09:00 PM EST

10:00 PM EST

Strategies and techniques for approaching featured GMAT topics. December 11 at 9 PM EST.
• ### The winning strategy for 700+ on the GMAT

December 13, 2018

December 13, 2018

08:00 AM PST

09:00 AM PST

What people who reach the high 700's do differently? We're going to share insights, tips and strategies from data we collected on over 50,000 students who used examPAL.

# If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll

Author Message
TAGS:

### Hide Tags

Manager
Joined: 13 May 2017
Posts: 101
Location: Finland
Concentration: Accounting, Entrepreneurship
GPA: 3.14
WE: Account Management (Entertainment and Sports)
If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll  [#permalink]

### Show Tags

27 Nov 2018, 11:28
4
00:00

Difficulty:

55% (hard)

Question Stats:

62% (02:32) correct 38% (02:06) wrong based on 86 sessions

### HideShow timer Statistics

If x is a number such that $$x^2$$−4x+3 < 0 and $$2x^2$$−9x+10 < 0, which of the following can be the value of x?

A. 2.3
B. 2.5
C. 2.6
D. 3.0
E. 3.2
Senior Manager
Joined: 18 Jul 2018
Posts: 484
Location: India
Concentration: Finance, Marketing
WE: Engineering (Energy and Utilities)
Re: If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll  [#permalink]

### Show Tags

27 Nov 2018, 23:44
1
2
Solving the equation $$x^2-4x+3<0$$ = $$(x-1)(x-3)<0$$

Using Wavy curve method we get $$1<x<3$$

Similarly solving equation $$2x^2-9x+10<0$$ = $$(x-2)(2x-5)<0$$

Using Wavy curve method we get $$2<x<2.5$$

Only possible value of x is 2.3

_________________

When you want something, the whole universe conspires in helping you achieve it.

Intern
Joined: 22 Sep 2018
Posts: 19
Re: If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll  [#permalink]

### Show Tags

01 Dec 2018, 04:48
Afc0892 wrote:
Solving the equation $$x^2-4x+3<0$$ = $$(x-1)(x-3)<0$$

Using Wavy curve method we get $$1<x<3$$

Similarly solving equation $$2x^2-9x+10<0$$ = $$(x-2)(2x-5)<0$$

Using Wavy curve method we get $$2<x<2.5$$

Only possible value of x is 2.3

Hi Afc0892
thank you.
Senior Manager
Joined: 18 Jul 2018
Posts: 484
Location: India
Concentration: Finance, Marketing
WE: Engineering (Energy and Utilities)
Re: If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll  [#permalink]

### Show Tags

01 Dec 2018, 04:53
poojasingavi wrote:
Afc0892 wrote:
Solving the equation $$x^2-4x+3<0$$ = $$(x-1)(x-3)<0$$

Using Wavy curve method we get $$1<x<3$$

Similarly solving equation $$2x^2-9x+10<0$$ = $$(x-2)(2x-5)<0$$

Using Wavy curve method we get $$2<x<2.5$$

Only possible value of x is 2.3

Hi Afc0892
thank you.

Hey poojasingavi, sure.

A detailed post about the wavy curve method is posted here.

https://gmatclub.com/forum/wavy-line-method-application-complex-algebraic-inequalities-224319.html#p1727247

Hope this helps.
_________________

When you want something, the whole universe conspires in helping you achieve it.

Intern
Joined: 22 Sep 2018
Posts: 19
Re: If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll  [#permalink]

### Show Tags

01 Dec 2018, 05:07
Afc0892 wrote:
poojasingavi wrote:
Afc0892 wrote:
Solving the equation $$x^2-4x+3<0$$ = $$(x-1)(x-3)<0$$

Using Wavy curve method we get $$1<x<3$$

Similarly solving equation $$2x^2-9x+10<0$$ = $$(x-2)(2x-5)<0$$

Using Wavy curve method we get $$2<x<2.5$$

Only possible value of x is 2.3

Hi Afc0892
thank you.

Hey poojasingavi, sure.

A detailed post about the wavy curve method is posted here.

https://gmatclub.com/forum/wavy-line-method-application-complex-algebraic-inequalities-224319.html#p1727247

Hope this helps.

Afc0892 Thank you so much
VP
Joined: 09 Mar 2016
Posts: 1208
If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll  [#permalink]

### Show Tags

01 Dec 2018, 06:25
$$x^2-4x+3<0$$ ---> $$(x-1)(x-3)<0$$

$$x=1$$

$$x=3$$

$$1<x<3$$

$$2x^2-9x+10<0$$

$$(2x^2-4x)-(5x+10)<0$$

$$2x(x-2)-5(x-10)<0$$

$$(2x-5)(x-2)<0$$

$$2x=5$$ ---> $$x =2.5$$

$$x-2$$ ---> $$x=2$$

$$2<x<2.5$$

A
If x is a number such that x2−4x+3<0and2x2−9x+10<0, which of the foll &nbs [#permalink] 01 Dec 2018, 06:25
Display posts from previous: Sort by


text:
# Canonical transformations

682
Do canonical transformations simply transform the coordinates of a particular system, leaving the physics unchanged? or can they transform between physically different systems? I haven't seen any evidence which shows that they keep the physics the same, but I don't see their usefulness otherwise.

2. ### Ben Niehoff

1,753
They do both, actually. In other words, they establish a link between different physical systems, such that one can be described in terms of the other.

For example, one canonical transformation can describe a damped harmonic oscillator in terms of variables that behave like an undamped oscillator (obviously, the transformation equations must be time-dependent for this to work). This allows us to talk about one problem in terms of another, perhaps simpler, problem.

3. ### dx

2,009
Canonical transformations are important for classical mechanics for the same reason linear transformations are important for vector space theory. The important structure on a vector space is its linear structure, and linear transformations are transformations that preserve this. The important structure on phase space is the symplectic structure, and canonical transformations preserve this.

Similarly, diffeomorphims are important in the theory of smooth manifolds, and conformal transformations are important in complex analysis and Riemann surface theory, and Unitary transformations are important in quantum mechanics. All these transformations preserve the relevant structure. The structure is usually defined by an algebra on the set, like multilinear/tensor algebra on vector spaces, or the Poisson bracket algebra on phase space for classical mechanics, or the inner product on quantum mechanical Hilbert spaces. But another point of view of thinking about the structure of sets was pioneered by Felix Klein, i.e. defining the structure of the sets by giving the transformations that preserve that structure. This is the idea behind the Erlangen program.

Last edited: Mar 11, 2009

682
So canonical transformations are changes of coordinate sytems and the transformed system is the same as the old but viewed in the new coordinates?
The fact that they are canonical is what preserves the symplectic structure and hence ensures we are still looking at the same system. Is this correct?

5. ### dx

2,009
Symplectic structure is not structure of any particular system, its the structure of phase space itself for all systems.


text:
# This question shows a method to compute the sum of the first 100 natural numbers ns1+ 2+3 + 4 + .+99

This question shows a method to compute the sum of the first 100 natural numbers ns1+ 2+3 + 4 + .+99 100 First write down the sum, then on the line below it write the sum backwards as shown 1 + 2+ 3 + 4+ + 99 100 10099 98 + 97 + ..+ 2+ 1 Now add the two lines together (without a calculator). If you add vertically, something nice will happen allowing you to write the answer as a product of two numbers 10100 Now use the above answer to find the original sum 100 n5050 Generalize the above method to find a formula that computes the sum of the first N natural numbers IN nn 1

## Plagiarism Checker

Submit your documents and get free Plagiarism report

Free Plagiarism Checker


text:
1. Nov 19, 2007

wowolala

A casino roulette wheel is set spinning with an initial angular speed of 15 rad/s. The ball is set spinning in the opposite direction with a constant angular speed of 20 rad/s as the
"00" passed by. If friction makes the wheel slow down with an angular acceleration of 5 rad/s^2, How many times does the ball pass by the "00" after 3 seconds? ( Ignore the slowing down of the ball due to friction. )

thx so much... could somebody help me to solve this quesion?

2. Nov 20, 2007

azatkgz

$$\omega_b=15 rad/s$$

$$\omega_r=(20-5t)rad/s$$

Now imagine,you're sitting on the roulette.You'll see that roulette is not moving.And ball is moving with velocity

$$v'=\omega'R=(\omega_b+\omega_r)R$$

3. Nov 20, 2007

wowolala

thx , i still don't quite understand.

you wrote the angular speed for the ball is 15 rad/s, but the question says the wheel is 15 rad/s , is something wrong.

in your last step, how can we find the R, since R is unknown.

finally, please tell me how many times the ball passes by "00", now, i am so confused..

thx

4. Nov 20, 2007

azatkgz

Ok.

$$\omega_b=20 rad/s$$

$$\omega_r=(15-5t) rad/s$$

as I said that

$$\omega'R=(\omega_r+\omega_b)R$$

we just eliminate R

$$\omega'=\omega_r+\omega_b$$

Original formula is $$d\theta=\omega dt$$
so we use this formula

$$d\theta=\omega'dt=(20+15-5t)dt$$

after integrating
$$\theta=20t+15t-\frac{5t^2}{2}=20\times 3+15\times 3-\frac{5\times 3^2}{2}=82.5 rad$$
$$2\pi$$ is one cycle,so it passes

$$N=\frac{82.5}{2\pi}=13$$ times

5. Nov 21, 2007

wowolala

thx so much

THank YOU, YOu are so smart....


text:
# What programming strategies can I take for easily modifying algorithm parameters?

Developing scientific algorithms is a highly iterative process often involving changing lots of parameters that I will want to vary either as part of my experimental design or as part of tweaking algorithm performance. What strategies can I take for structuring these parameters so that I can easily change them between iterations and so that I can easily add new ones?

It is cumbersome for the user to specify every aspect of an algorithm. If the algorithm allows nested components, then no finite number of options would be sufficient. Therefore, it is critical that options do not necessarily "bubble up" to the top level, as in the case of explicit arguments or template parameters. This is sometimes called the "configuration problem" in software engineering. I believe PETSc has a uniquely powerful system for configuration management. It is similar to the Service Locator pattern in Martin Fowler's essay on inversion of control.

PETSc's configuration system works through a combination of user-specified configuration managed by the solver objects (with get and set queries) and the Options Database. Any component of the simulation can declare a configuration option, a default value, and a place to put the result. Nested objects have prefixes which can be composed, such that every object that needs configuration can be addressed independently. The options themselves can be read from the command line, environment, configuration files, or from code. When an option is declared, a help string and man page are specified, so that the -help option is understandable and so that a properly linked GUI can be written.

The user calls a SetFromOptions method to make an object configure itself based on command line options. Calling this function is optional, and may not be called if the user (person writing code that calls PETSc) is exposing the options through some other interface. We highly recommend that the user expose the options database because it gives the end user (person running the application) a great deal of power, but it is not required.

A typical configuration, called via

PetscObjectOptionsBegin(object); /* object has prefix and descriptive string */
PetscOptionsReal("-ts_atol",                                      /* options database key */
"Absolute tolerance for local truncation error", /* long description */
"TSSetTolerances",                               /* function and man page on topic */
ts->atol,                                       /* current/default value *?
&ts->atol,                                      /* place to store value */
&option_set);                                   /* TRUE if the option was set */
PetscOptionsList("-ts_type","Time stepping method","TSSetType",TSList,
defaultType,typeName,sizeof typeName,&option_set);
/* ... many others */
/* ... the following is only called from implicit implementations */
SNESSetFromOptions(ts->snes);                                     /* configure nonlinear solver. */
PetscOptionsEnd();

Notes:

• PetscOptionsList() presents the user with a choice from a dynamic list. There is a plugin architecture which new implementations can use to expose themselves as first-class to callers. (These implementations can be placed in shared libraries and used as first-class without recompiling programs.)
• SNESSetFromOptions() recursively configures the linear solvers, preconditioners, and any other components that need configuration.

I've faced this problem several times when developing my own simulation codes from scratch: which parameters should go in an input file, which should be taken from the command line, etc. After some experimenting, the following turned out to be efficient. (It is not as advanced as PETSc.)

Instead of writing an experimental simulation 'program', I'm more inclined to write a Python package that contains all the functions & classes needed to run the simulation. The traditional input file is then replaced by small Python script with 5 to 10 lines of code. Some lines are typically related to loading data files and specifying output. Others are instructions for the actual computation. Good default values for optional arguments in the Python package make it doable for beginners to use the library for simple simulations, while the advanced user still has access to all the bells and whistles.

A few examples:

• This is great, but I think it is orthogonal to the configuration problem. If you need to specify a hierarchical or nested algorithm, then you have options to specify for many inner objects. The code calling those shouldn't really even know about their existence because the number of levels and the types of nesting may change. This is the problem of all those choices "bubbling up". With your high-level Python code, you can make it "easy" to specify those options, but you still have to specify them in code. I think that is generally not a good thing. Dec 3 '11 at 7:20
• xmonad uses this method for configuring their window manager for X. Dec 3 '11 at 15:23

As a first point, I would do the algorithm AND software as general as possible. I've learned this the hard way.

Let's say you start with a simple test case. You can do this faster. But then, if you made the software too specific (too few parameters) for this initial case, you'll loose more and more time adapting it every time you add a new degree of freedom. What I do now it's spend more time at the beginning making the thing pretty general, and increasing the variation of the parameters as I move forward.

This involves more testing from the beginning since you'll have more parameters from the starting point, but will mean that you can latter play a lot with the algorithm at zero or a very low cost.

Example: the algorithm involves calculating the surface integral the dot product of two vector functions. Don't assume from the beginning the size, geometry and discretization of the surface if in the future you may want to change that. Make a dot-product function, make the surface as general as possibly, calculate the integral in a nice formal way. You can test each function you make separately.

At the beginning, you can and start integrating over simple geometries and declaring may parameters at the start as constants. As time goes by, if you want to change the geometry, you can do it easily. Had you made assumptions at the beginning, you would have to change the whole code every time.