text:
# Strange failure of Series and Derivative

I just spend three hours and posted two Questions trying to figure something out, and it turned out all the confusion was caused by this mysterious quirk. I want to expand g[x,v] in v at v=0, using this relation to convert the derivative wrt v into derivatives wrt x:

$$\frac{dg[x,v]}{dv}=\frac{1}{2}\frac{d^{2}g}{dx^{2}}+\frac{1}{2}\left(\frac{dg}{dx}\right)^{2}$$

When I use the following Derivative definition, Series does not perform the conversion and leaves the result in terms of derivative wrt $v$:

Derivative[q_, Except[0, n_]][g][x, v] :=  D[(D[g[x, v], {x, 2}] + D[g[x, v], x]^2), {x, q}, {v, n - 1}]/2;
Series[g[x, v], {v, 0, 4}]

$g(x,0)+v g^{(0,1)}(x,0)+\frac{1}{2} v^2 g^{(0,2)}(x,0)+\frac{1}{6} v^3 g^{(0,3)}(x,0)+\frac{1}{24} v^4 g^{(0,4)}(x,0)+O\left(v^5\right)$

But if I perform the binomial expansion of the derivative of $g'^2$ by hand and use the following Derivative definition instead, Series works perfectly:

Derivative[m_, Except[0, n_]][t][x_, v_] := ( Derivative[2 + m, n - 1][t][x, v] + Sum[Binomial[n - 1, k] Binomial[m, j]*Derivative[m - j + 1, n - 1 - k][t][x, v]*Derivative[j + 1, k][t][x, v], {k, 0, n - 1}, {j, 0, m}])/2;
Series[t[x, v], {v, 0, 2}]

$t(x,0)+\frac{1}{2}v\left(t^{(1,0)}(x,0)^2+t^{(2,0)}(x,0)\right)+\frac{1}{8} v^2 \left(4 t^{(2,0)}(x,0)t^{(1,0)}(x,0)^2+4t^{(3,0)}(x,0) t^{(1,0)}(x,0)+2t^{(2,0)}(x,0)^2+t^{(4,0)}(x,0)\right)+O\left(v^3\right)$

What gives? What design quirk is making MMa not able to calculate and substitute that derivative? I would like to NOT spend this much time fixing this problem again! :-(

I'll post a possible explanation later, but here's how to make it work: replace v with v_, change the point about which you are expanding by a variable, and then replacing that variable with 0 later:

Derivative[q_, Except[0, n_]][g][x, v_] :=  D[(D[g[x, v], {x, 2}] + D[g[x, v], x]^2), {x, q}, {v, n - 1}]/2;
Series[g[x, v], {v, a, 2}] /. a -> 0

This makes it so that Series will evaluate derivatives about a symbolic point a, and then the rule that you've created will evaluate with a in place of v (which is why I replaced v with the pattern v_). It seems like the problem with Series in the original case is that there's no intermediate evaluation where g[x, v] and derivatives appears: it jumps immediately to g[x, 0] and derivatives. Consider:

Trace[Series[g[x, v], {v, 0, 2}]]

• Hey, thanks. I kinda suspected it was something like that, but I couldn't figure out a way to hack around such a problem even to test the theory. This seems like a genuine MMa design "quirk" if we're not ready to use such strong words as "bug". – Jerry Guern Oct 13 '15 at 4:40
• @JerryGuern. Could be, but if you actually peek under the hood at how the "data structure" of Series is defined, things make a little more sense (try to FullForm the result of a Series and you'll see what I mean). In any case, the order in which and the method by which things are evaluated will be at times "quirky" in whatever language you use. In this case, I imagine Series does some pattern matching first, then just puts the matched quantities directly into the "data structure". – march Oct 13 '15 at 4:43
• Yes, that's a fair point. And thanks for the intro to FullForm, which does shed some light on the problem. I guess what I'm really looking for is insight into those quirks so that I can craft work-arounds for them without wasting hours. Even the fellow who gave me the binomial expansion solution that worked didn't know why it worked when my approach didn't. That was frustrating, to put it mildly. – Jerry Guern Oct 13 '15 at 5:16

The issue here is the way Derivative works, as it (effectively) represents the derivative of a pure function with regards to its parameters, based purely on position. In order to make this work, you can return a pure function, using Evaluate to pre-evaluate the derivative, like so:

Derivative[q_, Except[0, n_]][g] := Function[{x, v},
Evaluate[
D[(D[g[x, v], {x, 2}] + D[g[x, v], x]^2), {x, q}, {v, n - 1}]/2]];

Now Series[g[x, v], {v, 0, 2}] yields $$g(x,0)+\frac{1}{2} v \left(g^{(1,0)}(x,0)^2+g^{(2,0)}(x,0)\right)+\frac{1}{8} v^2 \left(4 g^{(2,0)}(x,0) g^{(1,0)}(x,0)^2+4 g^{(3,0)}(x,0) g^{(1,0)}(x,0)+2 g^{(2,0)}(x,0)^2+g^{(4,0)}(x,0)\right)+O\left(v^3\right)$$


text:
Solved Problems-5

Problems-5
Using superposition theorem, calculate the current through the Î© impedance branch of the circuit shown in the figure below.

Solution
Case I. 30 V source is acting alone

Impedance,

âˆ´

Case II. 20 V source is acting alone

Impedance,

âˆ´

By superposition theorem, total current flowing through the  impedance is,

format: plain


text:
# Find transfer function and step function for this circuit

Can someone help me to find the transfer function of this circuit (i want to have the tension through the capacitor I think) and the step response in order to get the voltage in the function of the time?

I have a comparator (the block to the right with " ??? ") and it compares the tension between V1 (voltage divider) and V2 (tension I try to express with respect to time) and I want to know WHEN V1 = V2.

V1 is obtained by a voltage divider then it's a constant voltage

V2 can be expressed with respect to time but the circuit is too complex for me (Simulink seems to calculate this tension with the diode D7, R12, R10 and maybe R6 and R 100k...). Could someone help me to find the transfer function and also the step function because I can't find the constant of time?

(t= 0.497s when V1=V2) I'm sorry if I made mistakes as I'm not English (and I'm not an engineer either)

Here are the pictures -

The Circuit:

V2:

And V1 (I can express the voltage divider and find by myself the tension given by Matlab):

And at t=0.497 reached (with V3), the voltage is zero as you can see before the diode because of the comparators and the block "NOT" with the MOSFET in the right corner:

• Welcome to EE SE! Use the system identification app or tftest to estimate a transfer function. – Unknown123 Apr 15 '19 at 19:42
• Thanks for the system identification app but i can't export my workspace variable (i have a scope which logs the data to a variable in the workspace) because the format is incorrect (not an IDDATA nor IDFRD variable). – YuGo Apr 16 '19 at 9:08
• So you've got a vector. Then use tfestimate function instead. – Unknown123 Apr 16 '19 at 16:55
• Ok it doesn't work well then is there any chance to get the SYMBOLICAL differential equation of my circuit solved by simulink ? I just want to know which resistance is processed to get the tension V2 – YuGo Apr 16 '19 at 20:55
• What do you mean by doesn't work well? You can derive the differential equation easily using Inverse Laplace Transform if you have the Transfer Function. See Transfer Function to Single Differential Equation. – Unknown123 Apr 20 '19 at 13:14

You cannot find a "transfer function" of this circuit as a whole, because it's NOT linear. Even the part directly involved on the $$\V_2\$$ generation isn't linear because it contains a diode.
You have to reason otherwise: The circuit generating $$\V_2\$$ is an envelope detector which, if designed correctly, will obtain the envelope of the $$\V_3\$$ voltage. The value of that envelope is what it's compared by the comparator with the $$\V_1\$$ voltage obtained by the voltage divider.
If $$\V_1 > V_2\$$, the comparator's output will be LOW, so the inverter output will go HIGH turning the MOSFET ON. Then, presumabily (the whole circuit isn't visible) a positive voltage vill be applied at the upper input of the first "???" block (which I presume it's another comparator identical to the second one), so perhaps its output will go HIGH generating a step that will be detected with the second comparator, which will turn its output ON, which will turn the MOSFET OFF, deactivating the output of the first comparator, making $$\V_1 > V_2\$$ again but ONLY AFTER SOME TIME....


text:
# zbMATH — the first resource for mathematics

Control theorems of coherent sheaves on Shimura varieties of PEL type. (English) Zbl 1039.11041
Given a reductive algebraic group $$G$$ defined over $$\mathbb Q$$, a Shimura variety $$\text{Sh}_K$$ can be constructed by using a compact open subgroup $$K$$ of $$G (\mathbb A)$$. This paper deals with coherent sheaves on Shimura varieties which carry canonical families of abelian varieties with PEL structure. The groups producing such Shimura varieties include inner forms of GSp$$(2g)$$ over totally real fields and inner forms of unitary groups GU$$(m,n)$$ relative to a CM field. As is well known, each Shimura variety is defined over a reflex field inside the algebraic closure $$\overline{\mathbb Q}$$ of $$\mathbb Q$$ in $$\mathbb C$$. Given a prime $$p$$, if $$K$$ is of level prime to $$p$$, the associated Shimura variety $$\text{Sh}_K$$ extends canonically to a scheme faithfully flat over a $$p$$-adic valuation ring of the reflex field.
In this paper the author proves an exact control theorem for nearly ordinary $$p$$-adic automorphic forms on symplectic and unitary groups over totally real fields when the algebraic group is split over $$p$$. In particular, he shows that a given nearly ordinary holomorphic Hecke eigenform can be lifted to a family of holomorphic Hecke eigenforms indexed by weights of the standard maximal split torus of the groups. Their $$q$$-expansion coefficients are Iwasawa functions on the Iwasawa algebra of $$\mathbb Z_p$$-points of the split torus. The method is applicable to any reductive algebraic groups yielding Shimura varieties of PEL type under certain assumptions on the existence of integral toroidal compactification of the variety.

##### MSC:
 11G18 Arithmetic aspects of modular and Shimura varieties 11F41 Automorphic forms on $$\mbox{GL}(2)$$; Hilbert and Hilbert-Siegel modular groups and their modular and automorphic forms; Hilbert modular surfaces 11F33 Congruences for modular and $$p$$-adic modular forms 11F30 Fourier coefficients of automorphic forms 14G35 Modular and Shimura varieties
Full Text:


text:
# Maxwell Laws Summary Diagram - Suggestions that I am missing? [closed]

I have been going through a summary book of Maxwell's equations and hope I have organised this correctly but I think perhaps I am missing things important prompts that I could add? Image below

Also, you might add charge conservation: $$\nabla \cdot \mathbf{J}=-\frac{\partial \rho}{\partial t}$$ this one should fit your way of organizing a summary and slicing the knowledge about Maxwell's equations.


text:
# Research articles for the 2021-02-18

A Core of E-Commerce Customer Experience based on Conversational Data using Network Text Methodology
Andry Alamsyah,Nurlisa Laksmiani,Lies Anisa Rahimi
arXiv

E-commerce provides an efficient and effective way to exchange goods between sellers and customers. E-commerce has been a popular method for doing business, because of its simplicity of having commerce activity transparently available, including customer voice and opinion about their own experience. Those experiences can be a great benefit to understand customer experience comprehensively, both for sellers and future customers. This paper applies to e-commerces and customers in Indonesia. Many Indonesian customers expressed their voice to open social network services such as Twitter and Facebook, where a large proportion of data is in the form of conversational data. By understanding customer behavior through open social network service, we can have descriptions about the e-commerce services level in Indonesia. Thus, it is related to the government's effort to improve the Indonesian digital economy ecosystem. A method for finding core topics in large-scale internet unstructured text data is needed, where the method should be fast but sufficiently accurate. Processing large-scale data is not a straightforward job, it often needs special skills of people and complex software and hardware computer system. We propose a fast methodology of text mining methods based on frequently appeared words and their word association to form network text methodology. This method is adapted from Social Network Analysis by the model relationships between words instead of actors.

A New Take on Voice: The Influence of BlackRockâ€™s 'Dear CEO' Letters
Pawliczek, Andrea,Skinner, A. Nicole,Wellman, Laura
SSRN
We examine whether broad-based public engagement by institutional investors influences the behavior of portfolio firms. We investigate this question in the context of BlackRockâ€™s annual â€œDear CEOâ€ letter, which in recent years has called for portfolio firms to acknowledge and quantify the impact of environmental and regulatory factors on their firms. We find that portfolio firmsâ€™ disclosures reflect topics similar to those discussed in the letters during the post-letter period, controlling for a variety of firm and disclosure characteristics, and the occurrence of private engagements. Moreover, BlackRock appears to value these additional disclosures, as it more often votes with management on shareholder proposals during subsequent annual shareholder meetings. Finally, motivated by BlackRockâ€™s attempts to mobilize firms toward its specific policy recommendations, we also provide some evidence that firmsâ€™ lobbying efforts become more aligned with the issues highlighted in the letter during the post-letter period, especially when firmsâ€™ share BlackRockâ€™s policy preferences ex ante. Taken together, our evidence suggests that portfolio firms are responsive to BlackRockâ€™s public engagement efforts.

A maximum entropy model of bounded rational decision-making with prior beliefs and market feedback
Benjamin Patrick Evans,Mikhail Prokopenko
arXiv

Bounded rationality is an important consideration stemming from the fact that agents often have limits on their processing abilities, making the assumption of perfect rationality inapplicable to many real tasks. We propose an information-theoretic approach to the inference of agent decisions under Smithian competition. The model explicitly captures the boundedness of agents (limited in their information-processing capacity) as the cost of information acquisition for expanding their prior beliefs. The expansion is measured as the Kullblack-Leibler divergence between posterior decisions and prior beliefs. When information acquisition is free, the \textit{homo economicus} agent is recovered, while in cases when information acquisition becomes costly, agents instead revert to their prior beliefs. The maximum entropy principle is used to infer least-biased decisions, based upon the notion of Smithian competition formalised within the Quantal Response Statistical Equilibrium framework. The incorporation of prior beliefs into such a framework allowed us to systematically explore the effects of prior beliefs on decision-making, in the presence of market feedback. We verified the proposed model using Australian housing market data, showing how the incorporation of prior knowledge alters the resulting agent decisions. Specifically, it allowed for the separation (and analysis) of past beliefs and utility maximisation behaviour of the agent.

Causal Campbell-Goodhart's law and Reinforcement Learning
Hal Ashton
arXiv

Campbell-Goodhart's law relates to the causal inference error whereby decision-making agents aim to influence variables which are correlated to their goal objective but do not reliably cause it. This is a well known error in Economics and Political Science but not widely labelled in Artificial Intelligence research. Through a simple example, we show how off-the-shelf deep Reinforcement Learning (RL) algorithms are not necessarily immune to this cognitive error. The off-policy learning method is tricked, whilst the on-policy method is not. The practical implication is that naive application of RL to complex real life problems can result in the same types of policy errors that humans make. Great care should be taken around understanding the causal model that underpins a solution derived from Reinforcement Learning.

Corporate Social Responsibility and Corporate Governance: A cognitive approach
Rania Béji,Ouidad Yousfi,Abdelwahed Omri
arXiv

This chapter aims to critically review the existing literature on the relationship between corporate social responsibility (CSR) and corporate governance features. Drawn on management and corporate governance theories, we develop a theoretical model that makes explicit the links between board diversity, CSR committees' attributes, CSR and financial performance. Particularly, we show that focusing on the cognitive and demographic characteristics of board members could provide more insights on the link between corporate governance and CSR. We also highlight how the functioning and the composition of CSR committees, could be valuable to better understand the relationship between corporate governance and CSR.

Customer Perception on Alternative Delivery Channel (ADC) of Banks in Bangladesh
sadique, shahed,Shohrowardhy, Hossain Shahid,Hassan, H.M. Kamrul
SSRN
This paper aims at understanding the level of customerâ€™s perception on alternative delivery channel of different commercial schedule banks of Bangladesh. Considering the significant development in technology and for sustainability, banking industry in Bangladesh has expanded banking operation through offering different ADCs to attract customers which are ultimately changing the perception of customers in the long run. Based on this reality, data were collected from a survey and a usable sample of 134 was taken for analysis. KAPPA test and multiple regression model is used to analyze the overall consistency of respondentâ€™s responses and measurement of consumersâ€™ perception. The results of the survey show that visibility, availability, self-security, confidential transaction ability, easiness and simplicity in the procedure of ADC makes it more attractive to consumer. The findings also suggest that security of physical establishment of ADC is vital though banks have given less importance to it. From the study, it is found that in order to change perception and to attract more users to banking; it is not going to be enough to make the system easy to interact with. Banks should develop more secured and private alternative delivery channels that will be reliable to their customers. Thus, management attention might be effectively focused on the development of such sectors that have been properly identified in this research.

Desarrollo teÃ³rico y evidencia empÃrica de la polÃtica de dividendos: una revisiÃ³n de literatura en IberoamÃ©rica (Theorical Development and Empirical Evidence of Dividend Policy: A Review of Ibero-American Literature)
SSRN

Dynamic Asset (Mis)Pricing: Build-up vs. Resolution Anomalies
van Binsbergen, Jules H.,Boons, Martijn,Opp, Christian C.,Tamoni, Andrea
SSRN
We classify asset pricing anomalies into those that exacerbate existing mispricing (build-up anomalies) and those that resolve it (resolution anomalies). To this end, we compute the dynamics of price wedges for a large number of well-known asset pricing anomalies (the factor zoo). We find that several prominent anomalies like momentum and profitability push prices even further away from fundamental value. Generally, this mispricing build-up is faster than the subsequent resolution, suggesting the potential for material real economics consequences. Our results suggest that financial intermediaries chasing build-up anomalies in fact negatively affect price efficiency and associated real capital allocation.

Dynamics, behaviours, and anomaly persistence in cryptocurrencies and equities surrounding COVID-19
Nick James
arXiv

This paper uses new and recently introduced methodologies to study the similarity in the dynamics and behaviours of cryptocurrencies and equities surrounding the COVID-19 pandemic. We study two collections; 45 cryptocurrencies and 72 equities, both independently and in conjunction. First, we examine the evolution of cryptocurrency and equity market dynamics, with a particular focus on their change during the COVID-19 pandemic. We demonstrate markedly more similar dynamics during times of crisis. Next, we apply recently introduced methods to contrast trajectories, erratic behaviours, and extreme values among the two multivariate time series. Finally, we introduce a new framework for determining the persistence of market anomalies over time. Surprisingly, we find that although cryptocurrencies exhibit stronger collective dynamics and correlation in all market conditions, equities behave more similarly in their trajectories, extremes, and show greater persistence in anomalies over time.

Foreign Investment under the Spotlight of Home Media
Liu, Wai-Man,Yu, Jing,Zhang, Bohui
SSRN
Foreign investorsâ€™ information disadvantage is often viewed as a key impediment to their investment. This study questions whether foreign investorsâ€™ home media mitigates this information barrier by investigating the relation between U.S. mutual fund ownership and U.S. media coverage of local stocks in their host countries. Using a large sample of 38 host countries, we document a positive association between U.S. mutual fund ownership in a local stock and the coverage of U.S. major news providers on that stock. We find that home media-covered stocks incur lower information acquisition costs and gain greater investor awareness from U.S. investors. The home media effect is most salient in host countries with low quality information environments, supporting a novel home media effect that foreign investors tend to rely on their home market media coverage as an information source. The home media effect helps explain the prominent international finance anomaly regarding the dependence of firm returns on home and foreign market factors.

Hierarchical random effects model for insurance pricing of vehicles belonging to a fleet
Desjardins, Denise,Dionne, Georges,Lu, Yang
RePEC
We propose a hierarchical random effect model for the posterior insurance ratemaking of vehicles belonging to a ﬂeet by allowing random effects for ﬂeet, vehicle, and time. The model is an alternative to the gamma-Dirichlet model of Angers et al (2018), which does not allow for a closed form posterior ratemaking formula. Our theoretical extension derives a simple and tractable closed form ratemaking formula based on a hierarchical random effects speciﬁcation. We estimate the corresponding econometric model and compute insurance premiums in relation to the past experience of both the vehicle and the fleet. Our econometric model can also be applied to any other dynamic count modeling application with random individual, time, and common effects, such as labor contracting, chirurgical accidents, or any other random event implying principals and many agents.

Integrating prediction in mean-variance portfolio optimization
Andrew Butler,Roy H. Kwon
arXiv

Many problems in quantitative finance involve both predictive forecasting and decision-based optimization. Traditionally, predictive models are optimized with unique prediction-based objectives and constraints, and are therefore unaware of how those predictions will ultimately be used in the context of their final decision-based optimization. We present a stochastic optimization framework for integrating regression based predictive models in a mean-variance portfolio optimization setting. Closed-form analytical solutions are provided for the unconstrained and equality constrained case. For the general inequality constrained case, we make use of recent advances in neural-network architecture for efficient optimization of batch quadratic-programs. To our knowledge, this is the first rigorous study of integrating prediction in a mean-variance portfolio optimization setting. We present several historical simulations using global futures data and demonstrate the benefits of the integrated approach in comparison to the decoupled alternative.

Italia 3 Trim 2020: Pil, Debito & Co (Italy 3Q 2020: GDP, Debt & Co.)
Mazziero, Maurizio,Lawford, Andrew,Serafini, Gabriele
SSRN
Italian Abstract: Ricerca sulla situazione economica italiana basata sui dati economici ufficiali; vengono analizzati e confrontati con il passato il debito pubblico, le riserve ufficiali, il PIL, l'inflazione e la disoccupazione. English Abstract: Research into the state of the Italian economy based on official economic data; the current Sovereign Debt, Official Reserves, GDP, Inflation and Unemployment situation is presented and and compared with the past.

Price mediated contagion through capital ratio requirements with VWAP liquidation prices
Tathagata Banerjee,Zachary Feinstein
arXiv

We develop a framework for price-mediated contagion in financial systems where banks are forced to liquidate assets to satisfy a risk-weight based capital adequacy requirement. In constructing this modeling framework, we introduce a two-tier pricing structure: the volume weighted average price that is obtained by any bank liquidating assets and the terminal mark-to-market price used to account for all assets held at the end of the clearing process. We consider the case of multiple illiquid assets and develop conditions for the existence and uniqueness of clearing prices. We provide a closed-form representation for the sensitivity of these clearing prices to the system parameters, and use this result to quantify: (1) the cost of regulation, in stress scenarios, faced by the system as a whole and the individual banks, and (2) the value of providing bailouts to consider when such notions are financially advisable. Numerical case studies are provided to study the application of this model to data.

Salud financiera en crÃ©ditos hipotecarios mexicanos [The Financial Health of Mexican Mortgage Loans]
SSRN
Spanish Abstract: Si se desea adquirir un patrimonio familiar, la adquisiciÃ³n de crÃ©dito hipotecario conlleva una gran responsabilidad y un anÃ¡lisis previo, , pues la persona debe tener muy claras las condiciones y los factores que influyen cuando las entidades hipotecarias privadas, como las instituciones bancarias, o pÃºblicas, como el Instituto del Fondo Nacional de la Vivienda para los Trabajadores (INFONAVIT) y el Fondo de la Vivienda del Instituto de Seguridad y Servicios Sociales de los Trabajadores del Estado (FOVISSSTE) le otorguen el crÃ©dito. El principal riesgo se presenta en no poder cumplir con el pago delos intereses periÃ³dicos debido al bajo salario mensual que percibe el cliente. El objetivo de este artÃculo es examinar la salud financiera en crÃ©ditos hipotecarios mexicanos - pÃºblicos y privados - a partir de un estudio de mercado con datos reales del 2015. El mÃ©todo empleado fue cuantitativo experimental y la metodologÃa usada fue de amortizaciÃ³n con periodicidad de pagos mensuales. El principal hallazgo de esta investigaciÃ³n se dio a travÃ©s de evidencia empÃrica, donde se mostrÃ³ que la poblaciÃ³n de clase media baja puede tener un alto riesgo de incumplimiento en sus crÃ©ditos hipotecarios, dado a que su ingreso mensual va desde $2103 MXN hasta$6309 MXN. Por este motivo, la investigaciÃ³n buscÃ³ dar a conocer a este tipo de poblaciÃ³n los factores de riesgo a la hora de adquirir un crÃ©dito hipotecario. La conclusiÃ³n es que Ãºnicamente en cuatro escenarios analizados, donde el interÃ©s total a pagar es menor al 50 % del valor de la propiedad, el cliente debe destinar al pago de su crÃ©dito hipotecario la cantidad de $10 000 MXN que, a marzo de 2015, equivalÃa aproximadamente a 4.75 salario mÃnimo vigente en el Distrito Federal (SMVDF).English Abstract: When building a family patrimony, obtaining a mortgage loan takes great responsibility and a previous analysis. Mortgage borrowers should be very clear about the conditions and factors that influence the approval or rejection decisions of private mortgage lenders, such as banking institutions, or public ones; for example, in Mexico, the Fondo Nacional de la Vivienda para los Trabajadores (INFONAVIT) and the Fondo de la Vivienda del Instituto de Seguridad y Servicios Sociales de los Trabajadores del Estado (FOVISSSTE). The main risk is that customers may not be able to pay the periodic interest rate due to their low income. This article aims to examine the financial health of (public and private) Mexican mortgage loans based on a market analysis conducted using real data of 2015. Adopting a quantitative experimental approach, this study implemented a methodology of amortization with periodic monthly installments. The main finding was revealed by empirical evidence, which showed that lower-middle income borrowers may be at a great risk of missing their mortgage payments because their monthly income ranges from MXN$2,103 to MXN $6,309. For this reason, the goal of this article is to raise the awareness of this type of customers about the risk factors they should consider when they request a mortgage loan. In conclusion, in only four of the scenarios analyzed in this article, where the total interest to be paid is under 50% the property value, customers should devote MXN$10,000 to the pay the mortgage. As of March 2015, this amount would be approximately 4.75 times the minimum monthly wage in Mexicoâ€™s Federal District.

Supportive 5G infrastructure policies are essential for universal 6G: Evidence from an open-source techno-economic simulation model using remote sensing
Edward J. Oughton,Ashutosh Jha
arXiv

Work has now begun on the sixth generation of cellular technologies (6G) and cost-efficient global broadband coverage is already becoming a key pillar. Indeed, we are still far from providing universal and affordable broadband connectivity, despite this being a key part of the Sustainable Development Goals (Target 9.c). Currently, both Mobile Network Operators and governments still lack independent analysis of the strategies that can help achieve this target with the cellular technologies available (4G and 5G). Therefore, this paper provides quantitative evidence which demonstrates how current 5G policy affects universal broadband, as well as drawing conclusions over how 4G and 5G decisions made now affect future evolution to 6G. Using a method based on an open-source techno-economic codebase, combining remote sensing with least-cost network algorithms, performance analytics are provided for different 4G and 5G universal broadband strategies. As an example, the assessment approach is applied to India, the world`s second-largest mobile market and a country with notoriously high spectrum prices. The results demonstrate the trade-offs between technological decisions. This includes demonstrating how important current infrastructure policy is, particularly given fiber backhaul will be essential for delivering 6G quality of service. We find that by eliminating the spectrum licensing costs, full 5G population coverage can viably be achieved using fiber backhaul. In conclusion, supportive 5G infrastructure policies are essential in providing a superior foundation for evolution to 6G.

Sustainable and Resilient Systems for Intergenerational Justice
Sahar Zandi
arXiv

Rawls' theory of justice aims at fairness. He does not only think of justice between exiting parties in existing society, but he also thinks of it between generations intergenerational justice problem. Rawls' solution to this problem is the saving principle, and he says that we are responsible for being just with the next generations. Wolf thinks of our responsibility for future generations as a kind of financial debt that we have to pay. He also develops the meaning of "saving" and says that it is not restricted to the monetary one. Wolf extends the definition of "saving" such that it includes investment on behalf of the next generations as well. In this paper, I want to extend the meaning of "saving" to "using the resources for sustainable and resilient systems." By referring to the problem of time, I show that our decision on behalf of the next generations will be rational only if we entirely use the natural resources and wealth to produce sustainable and resilient systems.

The 'Matthew Effect' and Market Concentration: Search Complementarities and Monopsony Power
FernÃ¡ndez-Villaverde, JesÃºs,Mandelman, Federico,Yu, Yang,Zanetti, Francesco
SSRN
This paper develops a dynamic general equilibrium model with heterogeneous firms that face search complementarities in the formation of vendor contracts. Search complementarities amplify small differences in productivity among firms. Market concentration fosters monopsony power in the labor market, magnifying profits and further enhancing high-productivity firmsâ€™ output share. Firms want to get bigger and hire more workers, in stark contrast with the classic monopsony model, where a firm aims to reduce the amount of labor it hires. The combination of search complementarities and monopsony power induces a strong â€œMatthew effectâ€ that endogenously generates superstar firms out of uniform idiosyncratic productivity distributions. Reductions in search costs increase market concentration, lower the labor income share, and increase wage inequality.

The Gender Pay Gap Revisited with Big Data: Do Methodological Choices Matter?
Anthony Strittmatter,Conny Wunsch
arXiv

The vast majority of existing studies that estimate the average unexplained gender pay gap use unnecessarily restrictive linear versions of the Blinder-Oaxaca decomposition. Using a notably rich and large data set of 1.7 million employees in Switzerland, we investigate how the methodological improvements made possible by such big data affect estimates of the unexplained gender pay gap. We study the sensitivity of the estimates with regard to i) the availability of observationally comparable men and women, ii) model flexibility when controlling for wage determinants, and iii) the choice of different parametric and semi-parametric estimators, including variants that make use of machine learning methods. We find that these three factors matter greatly. Blinder-Oaxaca estimates of the unexplained gender pay gap decline by up to 39\% when we enforce comparability between men and women and use a more flexible specification of the wage equation. Semi-parametric matching yields estimates that when compared with the Blinder-Oaxaca estimates, are up to 50\% smaller and also less sensitive to the way wage determinants are included.

The Information and Liquidity Effects of Mutual Fund Flows: Evidence From International Spillovers
Rakowski, David A.,Diltz, John David,Nguyen, Anh Tuan
SSRN
We decompose mutual fund flowâ€"driven price pressure into liquidity and information components by measuring the extent to which mutual fund flow-driven trading spills over from the United States (US) to 44 international markets. Our procedure shows that liquidity barriers are greater than information barriers between markets, in that non-US stock returns are more strongly associated with US stock returns than with US-based mutual fund price pressure. By using suitably flow-adjusted non-US returns of cross-listed stocks as instruments for US stock returns in the absence of mutual fund price pressure, our procedure shows that mutual fund flow-driven price pressure varies considerably across different markets, stocks, funds, and types of flows. A simple characterization of some mutual fund flows as â€œfire salesâ€ fails to capture many sources of variation in the relative proportion of information and liquidity components of fund flows.

The Small World Phenomenon and Network Analysis of ICT Startup Investment in Indonesia and Singapore
Farid Naufal Aslam,Andry Alamsyah
arXiv

The internet's rapid growth stimulates the emergence of start-up companies based on information technology and telecommunication (ICT) in Indonesia and Singapore. As the number of start-ups and its investor growth, the network of its relationship become larger and complex, but on the other side feel small. Everyone in the ICT start-up investment network can be reached in short steps, led to a phenomenon called small-world phenomenon, a principle that we are all connected by a short chain of relationships. We investigate the pattern of the relationship between a start-up with its investor and the small world characteristics using network analysis methodology. The research is conducted by creating the ICT start-up investment network model of each country and calculate its small-world network properties to see the characteristic of the networks. Then we compare and analyze the result of each network model. The result of this research is to give knowledge about the current condition of ICT start-up investment in Indonesia and Singapore. The research is beneficial for business intelligence purposes to support decision-making related to ICT start-up investment.

The impacts of foreign exchange reserves intervention under the case of capital control in China
ZHOU, CHENG
SSRN
This paper studies the impacts of foreign exchange reserves intervention under the economic structures of China that feature capital controls, managed floating exchange rate and partially sterilized intervention. The central bank transacts government bonds to sterilely intervene the foreign exchange market in order to maintain a managed float regime. The results show that under the managed float regime, compared with capital account liberalization, a higher degree of capital controls may increase output and consumption and stabilize exchange rate and foreign exchange reserves in the short term. But under the case of the fixed exchange regime and capital controls, the impacts of full sterilization intervention and non-sterilization intervention are almost the same. Relative to the full floating exchange rate regime, the implementation of a managed floating exchange rate for the Chinaâ€™s central bank may stabilize the fluctuation of the nominal exchange rate, but it may expand the economic fluctuations, fluctuations in the scale of foreign assets held by the central bank and the scale of government bonds held the private.

Time-varying Media Coverage and Stock Returns
Zheng, Hannan
SSRN
I show that news editors have state-dependent preference for different types of firms. Using the New York Times data and natural language processing techniques, I estimate the loadings of media coverage on eight common features of firms and construct the corresponding editor preference. I find that firms with higher editor preference earn higher returns than those with lower preference on average. It is consistent with the theory that if investors delegate their information selection to news editors, the state-dependent coverage decisions signal risky features and hence related firms are required more risk compensation. This excess return cannot be explained by mainstream risk factors and has an annualized alpha around 12%. Although this excess return is robust among more firms that are out of the scope of news data, it is bound to a short time horizon.

Understanding algorithmic collusion with experience replay
Bingyan Han
arXiv

In an infinitely repeated pricing game, pricing algorithms based on artificial intelligence (Q-learning) may consistently learn to charge supra-competitive prices even without communication. Although concerns on algorithmic collusion have arisen, little is known on underlying factors. In this work, we experimentally analyze the dynamics of algorithms with three variants of experience replay. Algorithmic collusion still has roots in human preferences. Randomizing experience yields prices close to the static Bertrand equilibrium and higher prices are easily restored by favoring the latest experience. Moreover, relative performance concerns also stabilize the collusion. Finally, we investigate the scenarios with heterogeneous agents and test robustness on various factors.

Widowed Before Retirement: Social Security Benefit Claiming Strategies
Shuart, Amy N.,Weaver, David,Whitman, Kevin
SSRN
Financial planners should be aware of Social Security program rules unique to widows approaching retirement.This paper examines these rules and their implications for benefit claiming strategies, complementing recent studies on Social Security claiming decisions.


text:
Institute of Technology Publications

Title

On the Behavior of the Distributed Coordination Function of IEEE 802.11 With Multirate Capability Under General Transmission Conditions

10-21-2007

Article

Abstract

The aim of this paper is threefold. First, it presents a multi-dimensional Markovian state transition model characterizing the behavior of the IEEE 802.11 protocol at the Medium Access Control layer which accounts for packet transmission failures due to channel errors modeling both saturated and non-saturated traffic conditions. Second, it provides a throughput analysis of the IEEE 802.11 protocol at the data link layer in both saturated and non-saturated traffic conditions taking into account the impact of both the physical propagation channel and multirate transmission in Rayleigh fading environment. The general traffic model assumed is M/M/1/K. Finally, it shows that the behavior of the throughput in non-saturated traffic conditions is a linear combination of two system parameters; the payload size and the packet rates, $\lambda^{(s)}$, of each contending station. The validity interval of the proposed model is also derived. Simulation results closely match the theoretical derivations, confirming the effectiveness of the proposed models.

Publication Title

IEEE Transactions on Wireless Communications

Version

pre-print, post-print

This document is currently not available here.

COinS


text:
Finding two linearly independent solutions (power series)

• April 24th 2013, 03:57 PM
LinearOperator
Finding two linearly independent solutions (power series)
for (x^2+2)y'' +3x-y = 0 about the ordinary point x = 0

my guess was y = sum c_nx^n

I think that I did my sum correctly but if someone can double check it for me, that would be great.

• April 24th 2013, 04:35 PM
topsquark
Re: Finding two linearly independent solutions (power series)
$\sum_{n=2}^{\infty}n(n-1)c_nx^n @plus; 2 \sum_{ n=0}^{ \infty}(n@plus;2)(n@plus;1)c_{n@plus;2}x^{n}@plus; 3 \sum_{ n=1}^{\ \infty} nc_nx^n-\sum_{ n=0}^{ \infty} c_nx^n=0" target="_blank">$

Wrap it in [tex] tags. Fix it and we can see exactly what you're up to.

-Dan
• April 24th 2013, 06:17 PM
LinearOperator
Re: Finding two linearly independent solutions (power series)
Ok here is my work that I have. The part that I am most unsure about is the part where I have to factor out terms. And also getting the solution(s).

So my guesses were $y=\sum_{n=0}^{\infty}c_nx^n$ and their derivatives which I won't go into doing. Then I got this:
$(x^2+2)\sum_{n=2}^{\infty}n(n-1))c_nx^{n-2}+3x \sum_{n=1}^{\infty} nc_nx^{n-1}-\sum_{n=0}^{\infty}c_nx^n$

I distributed and shifted them down so they could ann be at $x^n$:

$\sum_{n=2}^{\infty}n(n-1)c_nx^{n}+2 \sum_{n=0}^{\infty} (n+2)(n+1)c_{n+2}x^n+ 3\sum_{n=1}^{\infty}nc_nx^n-\sum_{n=0}^{\infty}c_nx^n$

I pulled out n=0 and n=1 from series #2 (starting series number one is on the far left and 4 is the end right) i am not sure if that is correct in doing so. and then i pulled out n = 1 from series 3 and n= 0 and 1 from series #4. Is this correct so far what I am doing?
• April 24th 2013, 06:21 PM
LinearOperator
Re: Finding two linearly independent solutions (power series)
Essenntially, my recusrsive set that I got was: $c_{n+2}=\frac{c_n(1-2n-n^2)}{2(n+2)(n+1)}$
which is where I am also unsure about.


text:
# Binomial test for nested data

I have 100 subjects who were scored on their performance in a series of trials (binary outcome for each trial: "hit" or "miss"). I want to find out whether overall there are more "hit" than "miss" trials. Since the trials are repeated for each individual (each subject has 4 trials), then the data may not be independent. If so, do I still use a binomial test? Or is there are other analysis I can use?

Thank you very much. Any help is deeply appreciated.

• Are you comparing groups or controlling for covariates? Jan 29 '16 at 17:05
• Nope I am not. It's a pilot study so we just want to find out if frequency of hits and misses differ. Jan 29 '16 at 17:14
• You refer to "hits" & "misses". Was this a signal detection study? Jan 29 '16 at 17:31

$Y_{s,t} \sim Bernoulli(p_s), \quad p_s = logit(\theta + \beta_s), \quad \beta_s \sim N(0,\sigma_s^2)$.


text:
# how to properly solve these two coupled convex optimizations?

i have the following two general convex optimization problems: $$\min_X \sum_i f_i(x_i,D)$$ $$\min_{D.W} \sum_i g_i(x_i,W,D)$$ $X,D,W$ are parameter matrices and $Y$ is the data samples matrix. $f,g$ are convex functions and deferentiable respect to the above matrices.

As you see these problems are coupled and the solution to one can effect the other. For example finding optimum $X$ for the first problem provides different set of $g_i$ functions (for instance imagine $g_i=x_iWD$).

I like to find the optimum point $X^*,D^*,W^*$ for the whole problem. However the 2nd optimization is the main goal of the problem, so maybe we can call it a bilevel optimization, but not sure about it!

I tried a solution as follow:

1- Finding best $X^*$ matrix based on the first problem.

2- Finding best $W^*$ matrix based on the 2nd problem.

3- Finding best $D^*$ matrix based on the 3rd problem.

and repeating 1-3 until convergence. The problem is that the result is sub-optimal as i tried it with toy-data and it failed to find the better optimum point that exist.

also i'm not sure if the whole strategy is properly chosen to solve the above problem.

• So which solution are you looking for? Minimal sum of the two objectives, minimal product, just some kind of fixed pont etc. The problem is not well defined – Johan Löfberg Jul 19 '17 at 19:11
• Or is it a bilevel program you want to solve where $X$ is the inner variable and you want $X$ to be $\argmin$ of the first objective, and then you want to minimize the second (the order is important, $D$ and $W$ would then be the master variables and $X$ the follower) – Johan Löfberg Jul 19 '17 at 19:16
• You refer to a data samples matrix $Y$ that I do not see anywhere, and you have $x_i$ in the objective functions that seems not to be defined anywhere. Are they related? – prubin Jul 19 '17 at 20:07
• The 2nd optimization is the main goal of the problem, however the first one is important as the internal optimization. So maybe we can call it a bi-level optimization, but not sure about it! – Babak Jul 19 '17 at 23:22


text:
Web www.speedylook.com

Gravimetry is the science that studies the gravity. In Geomorphology interests the gravity and, particularly, the free fall and terrestrial isostasy .

isostasy was enunciated like principle at the end of century XIX. It is the condition of I balance that densidad presents/displays the terrestrial surface due to the difference of of its parts. It is solved in heaves ( epirogénicos ) and is based on Principle of Archimedes .

### Basic principle

terrestrial Crust floats on Mantle like Iceberg in the ocean; or, Sial floats on Sima like a iceberg in the ocean. The basic principle is that so that a body floats on another one, this one must be denser, and so it is placed underneath. The material that floats, sinks in a variable percentage, but always it has part of emerged him. Thus, the condition of bouyancy does not depend on the size, and when the emerged part loses volume and weight, the submerged part ascends to compensate it. Each individual block, or this one plate or a block delimited by Faults tend to reach this balance. The collapse produced in a river basin where they are settling material receives the name of Subsidence

The isostatic balance can break by a tectonic movement or the defrosting of Inlandsis . The isostasy is fundamental for the relief of Earth . The continents are less dense than the mantle, and also that oceanic Crust . When continental Crust is folded accumulates great amount of materials in a concrete region. Finished the ascent, the erosion begins. material deposits, in the long run, outside the mountainous chain, and so this one loses weight and volume. The roots ascend to compensate this loss leaving in surface the materials that been have put under a greater metamórfico process, and which they have become Granite . This promoted granite, forms rigid old massive Shields or, and that does not fold before new orogenia, but it is broken forming failed Relief . Each one of the blocks in which is broken Shield, of different sizes, also tend to reach the isostatic balance. The readjustments, ascents and collapses of blocks with respect to the other, generate small Earthquakes

## Isostatic models

In 1735, in a scientific expedition in Peru, Pierre Bouguer observed that Deflection of the vertical one was smaller to the awaited one being based on the visible topography of Andes . The same phenomenon was observed in a relief in India in charge of George Everest . From these observations the idea that arises certain compensation, with a negative resistance of densidad, must exist underneath the topography. This lead to the isostasy concept, that assumes balance of each certain Earth column until compensation level . The isostatic equilibrium condition considers like:

$\ int_ \left\{- T\right\} ^ \left\{H\right\} \ rho dz.$

Where $T$ is the depth of compensation, $H$ the height of the topography and $\ rho$ the densidad.

Since the densidades of the terrestrial interior are not known, two models were developed of almost simultaneous way. Henry Pratt proposed a depth of constant compensation $T_0$, consequently, the variations of the topography are associate to lateral changes in the densidad. On the other hand, George Airy assumed a constant densidad, which implies a depth of variable compensation.

At the moment three isostatic models exist:

### Model of Pratt-Hayford

The model of Pratt was developed for geodesic intentions by Hayford . The model assumes a depth of consante compensation $T_0$. The densidad in the absence of topography would be $\ rho_0$. The isostásico equilibrium condition for one given to column i will be:

In the continents:

$\ rho_i \left(T_0+H_i\right) = \ rho_0 T_0$

In the oceans:

$\ rho_i \left(T_0-d_i\right) + \ rho_w d_i= \ rho_0 T_0$

Where $\ rho_w$ is the densidad of the water of sea: $\rho_w=1030 kg/m^3$

### Model of Airy-Heiskanen

The model of Airy was developed for geodesic applications by Heiskanen . The Airy-Heiskanen model is similar to the one of a iceberg floating. Instead of ice we have cortical material of densidad $\ rho_c$ and instead of water of greater densidad we have material of the densidad mantle $\ rho_m$. If an elevation exists (like a mountain) on the surface, must exist corresponding root that is introduced within the mantle. As the cortical material is of smaller densidad than the material of the mantle, a towing traction force will exist that balances the gravitational attractive force of mountains. A similar mechanism takes place below the oceans. As the water of sea has minor densidad will induce a negative root, that is to say, one more a finer crust below the oceans.

In the continents:

$\left(\ rho_m- \ rho_c\right) t_i= \ rho_c H_i$

In the oceans:

$\left(\ rho_m- \ rho_c\right) t_i= \left(\ rho_c- \ rho_w\right) d_i$

### Model of Vening Meinesz

This model is more recent than the previous ones and was proposed in the decade of 1950 . The theory arises from studies that Vening Meinesz realizes in the Himalayas and from which it discovers that these mountains do not have roots of 80 km as it predicted the theory of Airy.

According to this theory, the crust acts as an elastic plate and its inherent rigidity distribute the topographic loads on a greater region.

## Local isostasy versus. regional isostasy

Ever since the isostasy concept extended, the predominant idea was that the isostatic balance was reached locally, in each column of terrestrial Crust, as if the bouyancy in each point of the crust was independent of the contiguous columns. That is to say, as if the movements necessary to readjust the isostatic balance were independent between two points any and they would not be transmitted laterally. Although in the decade of 1880 Grove Karl Gilbert proposed a rigid behavior of the crust in response to the disappearance of Bonneville Lake, the force and simplicity of the isostatic model local era like lasted until the works of Felix Andries Vening Meinesz in the decade of 1950, when Tectonic of plates mainly began to be adopted. Vening Meinesz showed that the oceanic crust is flexionada or doubled under the weight of marine volcanos of form similar to a thin plate, transmitting the collapse due to its weight beyond the own volcanic building.

Although the local isostatic model continues being used like first approach the calculation of isostatic movements in response to deglaciaciones, vulcanism or orogénesis, now is commonly accepted that the external Earth layer has certain rigidity and that behaves like a thin plate, elastic in first approach. To this process is called to him litosférica Flection . The flexural behavior of the lithospere essentially depends on elastic Thickness of the lithospere .

 Random links: Carduus pycnocephalus | Jose Manuel Puig Casauranc | Jose Maria Rodriguez | Pink Brown Rafael Valley | Tōkaidō Shinkansen

© 2007-2008 speedlook.com; article text available under the terms of GFDL, from fr.wikipedia.org


text:
Orthonormal basis

An orthonormal basis (ONB) or a complete orthonormal (VONS) is in the mathematical areas linear algebra and functional analysis a set of vectors of a vector space with scalar product ( inner product space ) formed on the length of one normalized , mutually orthogonal (hence ortho-normal basis ) and their linear hull is dense in vector space. In the finite-dimensional case this is a basis of the vector space. In the infinite-dimensional case it is not a matter of a vector space basis in the sense of linear algebra.

If one waives the condition that the vectors are normalized to the length one, one speaks of an orthogonal basis .

The concept of the orthonormal basis is of great importance both in the case of finite dimensions and for infinitely dimensional spaces, in particular Hilbert spaces .

Finite-dimensional spaces

In the following we assume a finite-dimensional inner product space, that is, a vector space over or with a scalar product . In the complex case it is assumed that the scalar product is linear in the second argument and semilinear in the first, i.e. ${\ displaystyle V}$${\ displaystyle \ mathbb {R}}$${\ displaystyle \ mathbb {C}}$${\ displaystyle \ langle {\ cdot}, {\ cdot} \ rangle}$

${\ displaystyle \ lambda \ langle v, w \ rangle = \ langle {\ bar {\ lambda}} v, w \ rangle = \ langle v, \ lambda w \ rangle}$

for all vectors and all . The norm induced by the scalar product is denoted by. ${\ displaystyle v, w \ in V}$${\ displaystyle \ lambda \ in \ mathbb {C}}$${\ displaystyle \ | {\ cdot} \ | = {\ sqrt {\ langle {\ cdot}, {\ cdot} \ rangle}}}$

Definition and existence

An orthonormal basis of a -dimensional interior product space is understood to be a basis of , which is an orthonormal system , that is: ${\ displaystyle n}$${\ displaystyle V}$${\ displaystyle B = \ {b_ {1}, \ ldots, b_ {n} \}}$${\ displaystyle V}$

• Every basis vector has the norm one:
${\ displaystyle \ | b_ {i} \ | = {\ sqrt {\ langle b_ {i}, b_ {i} \ rangle}} = 1}$for everyone .${\ displaystyle i \ in \ {1, \ ldots, n \}}$
• The basis vectors are orthogonal in pairs:
${\ displaystyle \ langle b_ {i}, b_ {j} \ rangle = 0}$for everyone with .${\ displaystyle i, j \ in \ {1, \ ldots, n \}}$${\ displaystyle i \ neq j}$

Every finite-dimensional vector space with a scalar product has an orthonormal basis. With the help of the Gram-Schmidt orthonormalization method, every orthonormal system can be supplemented to an orthonormal basis.

Since orthonormal systems are always linearly independent , an orthonormal system of vectors already forms an orthonormal basis in a -dimensional interior product space. ${\ displaystyle n}$${\ displaystyle n}$

Handedness of the base

Let an ordered orthonormal basis of . Then is the matrix${\ displaystyle B = ({b} _ {1}, \ ldots, {b} _ {n})}$${\ displaystyle V}$

${\ displaystyle Q = {\ begin {pmatrix} {b} _ {1} & {b} _ {2} & \ ldots & {b} _ {n} \ end {pmatrix}}}$

formed from the vectors noted as column vectors orthogonally and therefore has the determinant +1 or −1. If so , the vectors form a legal system . ${\ displaystyle {b} _ {i}}$ ${\ displaystyle \ operatorname {det} (Q) = + 1}$${\ displaystyle {b} _ {1}, \ ldots, {b} _ {n}}$

Examples

The orthonormal basis im and a vector represented by it${\ displaystyle {{\ vec {i}}, {\ vec {j}}, {\ vec {k}}}}$${\ displaystyle \ mathbb {R} ^ {3}}$${\ displaystyle {\ vec {r}} = 3 {\ vec {i}} + 2 {\ vec {j}} + 3 {\ vec {k}}}$
example 1
The standard basis of the , consisting of the vectors${\ displaystyle \ mathbb {R} ^ {3}}$
${\ displaystyle {\ vec {i}} = {\ vec {e}} _ {1} = {\ begin {pmatrix} 1 \\ 0 \\ 0 \ end {pmatrix}}, \ {\ vec {j} } = {\ vec {e}} _ {2} = {\ begin {pmatrix} 0 \\ 1 \\ 0 \ end {pmatrix}}, \ {\ vec {k}} = {\ vec {e}} _ {3} = {\ begin {pmatrix} 0 \\ 0 \\ 1 \ end {pmatrix}},}$
is an orthonormal basis of the three-dimensional Euclidean vector space (equipped with the standard scalar product ): It is a basis of , each of these vectors has the length 1, and two of these vectors are perpendicular to one another, because their scalar product is 0.${\ displaystyle \ mathbb {R} ^ {3}}$${\ displaystyle \ mathbb {R} ^ {3}}$
More generally, in coordinate space or , provided with the standard scalar product, the standard basis is an orthonormal basis.${\ displaystyle \ mathbb {R} ^ {n}}$${\ displaystyle \ mathbb {C} ^ {n}}$${\ displaystyle \ {e_ {1}, \ dots, e_ {n} \}}$
Example 2
The two vectors
${\ displaystyle {\ vec {b}} _ {1} = {\ begin {pmatrix} {\ tfrac {3} {5}} \\ [1ex] {\ tfrac {4} {5}} \ end {pmatrix }}}$   and   ${\ displaystyle {\ vec {b}} _ {2} = {\ begin {pmatrix} - {\ tfrac {4} {5}} \\ [1ex] {\ tfrac {3} {5}} \ end { pmatrix}}}$
together with the standard scalar product form an orthonormal system and therefore also an orthonormal basis of .${\ displaystyle \ mathbb {R} ^ {2}}$${\ displaystyle \ mathbb {R} ^ {2}}$

Coordinate representation with respect to an orthonormal basis

Vectors

If is an orthonormal basis of , then the components of a vector can be calculated particularly easily as orthogonal projections with respect to this basis . Has the representation regarding the base${\ displaystyle B = \ {b_ {1}, \ dots, b_ {n} \}}$${\ displaystyle V}$${\ displaystyle v \ in V}$${\ displaystyle v}$${\ displaystyle B}$

${\ displaystyle v = v_ {1} b_ {1} + \ dots + v_ {n} b_ {n} = \ sum _ {i = 1} ^ {n} v_ {i} b_ {i},}$

so applies

${\ displaystyle v_ {i} = \ langle b_ {i}, v \ rangle}$ For ${\ displaystyle i = 1, \ dots, n}$

because

${\ displaystyle \ langle b_ {i}, v \ rangle = \ left \ langle b_ {i}, \ sum _ {j = 1} ^ {n} b_ {j} v_ {j} \ right \ rangle = \ sum _ {j = 1} ^ {n} \ left \ langle b_ {i}, b_ {j} v_ {j} \ right \ rangle = \ sum _ {j = 1} ^ {n} \ left \ langle b_ { i}, b_ {j} \ right \ rangle v_ {j} = \ sum _ {j = 1 \ atop j \ neq i} ^ {n} \ underbrace {\ left \ langle b_ {i}, b_ {j} \ right \ rangle} _ {0} v_ {j} + \ left \ langle b_ {i}, b_ {i} \ right \ rangle v_ {i} = \ left \ langle b_ {i}, b_ {i} \ right \ rangle v_ {i} = v_ {i}}$

and thus

${\ displaystyle v = \ sum _ {i = 1} ^ {n} \ left \ langle b_ {i}, v \ right \ rangle b_ {i}.}$

In example 2 above, the following applies to the vector : ${\ displaystyle {\ vec {v}} = {\ begin {pmatrix} 2 \\ 7 \ end {pmatrix}}}$

${\ displaystyle \ left \ langle {\ vec {b}} _ {1}, {\ vec {v}} \ right \ rangle = {\ frac {3} {5}} \ cdot 2 + {\ frac {4 } {5}} \ cdot 7 = {\ frac {34} {5}}}$   and
${\ displaystyle \ left \ langle {\ vec {b}} _ {2}, {\ vec {v}} \ right \ rangle = - {\ frac {4} {5}} \ cdot 2 + {\ frac { 3} {5}} \ cdot 7 = {\ frac {13} {5}}}$

and thus

${\ displaystyle {\ vec {v}} = {\ frac {34} {5}} \, {\ vec {b}} _ {1} + {\ frac {13} {5}} \, {\ vec {b}} _ {2} = {\ frac {34} {5}} \, {\ begin {pmatrix} {\ tfrac {3} {5}} \\ [1ex] {\ tfrac {4} {5 }} \ end {pmatrix}} + {\ frac {13} {5}} \, {\ begin {pmatrix} - {\ tfrac {4} {5}} \\ [1ex] {\ tfrac {3} { 5}} \ end {pmatrix}}.}$

The scalar product

In coordinates with respect to an orthonormal basis, each scalar product has the form of the standard scalar product. More accurate:

Is an orthonormal basis of and have the vectors and with respect to the coordinate representation and , then applies ${\ displaystyle B = \ {b_ {1}, \ dots, b_ {n} \}}$${\ displaystyle V}$${\ displaystyle v}$${\ displaystyle w}$${\ displaystyle B}$${\ displaystyle v = v_ {1} b_ {1} + \ dots + v_ {n} b_ {n}}$${\ displaystyle w = w_ {1} b_ {1} + \ dots + w_ {n} b_ {n}}$

${\ displaystyle \ langle v, w \ rangle = v_ {1} w_ {1} + \ dots + v_ {n} w_ {n}}$

in the real case, resp.

${\ displaystyle \ langle v, w \ rangle = {\ bar {v}} _ {1} w_ {1} + \ dots + {\ bar {v}} _ {n} w_ {n}}$

in the complex case.

Orthogonal mappings

Is an orthogonal (in the real case) or a unitary transformation (in the complex case) and is an orthonormal basis of , as is the representation matrix of relative to the base an orthogonal or a unitary matrix . ${\ displaystyle f \ colon V \ to V}$${\ displaystyle B}$${\ displaystyle V}$${\ displaystyle f}$${\ displaystyle B}$

This statement is incorrect with regard to any base.

Infinite dimensional spaces

definition

Let be a Prehilbert space and let be the norm induced by the scalar product. A subset is called an orthonormal system if and for all with . ${\ displaystyle (V, \ langle \ cdot, \ cdot \ rangle)}$${\ displaystyle \ | \ cdot \ | = {\ sqrt {\ langle \ cdot, \ cdot \ rangle}}}$${\ displaystyle S \ subset V}$${\ displaystyle \ | e \ | = 1}$${\ displaystyle \ langle e, f \ rangle = 0}$${\ displaystyle e, f \ in S}$${\ displaystyle e \ neq f}$

An orthonormal system, the linear envelope of which lies close in space, is called an orthonormal basis or Hilbert basis of space.

It should be noted that in the sense of this section, in contrast to the finite dimension, an orthonormal basis is not a Hamel basis , i.e. not a basis in the sense of linear algebra. This means that an element from cannot generally be represented as a linear combination of finitely many elements from , but only with a countable infinite number, i.e. as an unconditionally convergent series . ${\ displaystyle V}$${\ displaystyle S}$

characterization

The following statements are equivalent for a Prehilbert dream: ${\ displaystyle H}$

• ${\ displaystyle S \ subset H}$ is an orthonormal basis.
• ${\ displaystyle S}$is an orthonormal system and Parseval's equation applies :
${\ displaystyle \ | x \ | ^ {2} = \ sum _ {v \ in S} | \ langle x, v \ rangle | ^ {2}}$for everyone .${\ displaystyle x \ in H}$

If it is even complete, i.e. a Hilbert space , this is also equivalent to: ${\ displaystyle H}$

• The orthogonal complement of is the null space, because in general for a subset that .${\ displaystyle S ^ {\ perp}}$${\ displaystyle S}$${\ displaystyle T}$${\ displaystyle {T ^ {\ perp}} ^ {\ perp} = {\ overline {\ operatorname {span} (T)}}}$
• More concretely: It applies if and only if the scalar product is for all .${\ displaystyle x = 0}$${\ displaystyle v \ in S}$${\ displaystyle \ langle x, v \ rangle = 0}$
• ${\ displaystyle S}$is a maximal orthonormal system with regard to inclusion, i. H. every orthonormal system that contains is the same . If a maximal were not an orthonormal system, then a vector would exist in the orthogonal complement; if this were normalized and added to , an orthonormal system would again be obtained.${\ displaystyle S}$${\ displaystyle S}$${\ displaystyle S}$${\ displaystyle S}$

existence

With Zorn's lemma it can be shown that every Hilbert space has an orthonormal basis: Consider the set of all orthonormal systems with the inclusion as a partial order. This is not empty because the empty set is an orthonormal system. Every ascending chain of such orthonormal systems with regard to inclusion is limited upwards by the union: If the union were not an orthonormal system, it would contain one non-normalized or two different non-orthogonal vectors, which should already have occurred in one of the combined orthogonal systems. According to Zorn's lemma, there is thus a maximal orthonormal system - an orthonormal basis. Instead of all orthonormal systems, one can only consider the orthonormal systems that contain a given orthonormal system. Then one obtains analogously that every orthonormal system can be supplemented to an orthogonal basis. ${\ displaystyle H}$${\ displaystyle H}$

Alternatively, the Gram-Schmidt method can be applied to or any dense subset and one obtains an orthonormal basis. ${\ displaystyle H}$

Every separable Prähilbert space has an orthonormal basis. To do this, choose a (at most) countable dense subset and apply the Gram-Schmidt method to this. Completeness is not necessary here, since projections only need to be carried out onto finite-dimensional subspaces, which are always complete. This gives a (at most) countable orthonormal basis. Conversely, every Prehilbert space is also separable with a (at most) countable orthonormal basis.

Development according to an orthonormal basis

A Hilbert space with an orthonormal basis has the property that for each the series representation${\ displaystyle (H, \ langle \ cdot, \ cdot \ rangle)}$${\ displaystyle S}$${\ displaystyle v \ in H}$

${\ displaystyle v = \ sum _ {u \ in S} \ langle u, v \ rangle u}$

applies. This series necessarily converges . If the Hilbert space is finite-dimensional, the concept of unconditional convergence coincides with that of absolute convergence . This series is also called a generalized Fourier series . If one chooses the Hilbert space of real-valued square-integrable functions with the scalar product ${\ displaystyle L ^ {2} ([0.2 \ pi])}$

${\ displaystyle \ langle f, g \ rangle = \ int _ {0} ^ {2 \ pi} f (x) g (x) \, \ mathrm {d} x,}$

then

${\ displaystyle S = \ {c_ {0} \} \ cup \ {c_ {n}, s_ {n} \ mid n \ in \ mathbb {N} \}}$

With

${\ displaystyle c_ {0} (x) = {\ frac {1} {\ sqrt {2 \ pi}}}, \ c_ {n} (x) = {\ frac {1} {\ sqrt {\ pi} }} \ cos (nx), \ s_ {n} (x) = {\ frac {1} {\ sqrt {\ pi}}} \ sin (nx)}$for and${\ displaystyle x \ in [0.2 \ pi]}$${\ displaystyle n \ in \ mathbb {N}}$

an orthonormal system and even an orthonormal basis of . Regarding this base are ${\ displaystyle L ^ {2} ([0.2 \ pi])}$

${\ displaystyle \ left \ langle f, c_ {0} \ right \ rangle = {\ frac {1} {\ sqrt {2 \ pi}}} \ int _ {0} ^ {2 \ pi} f (x) \, \ mathrm {d} x,}$
${\ displaystyle \ left \ langle f, c_ {n} \ right \ rangle = {\ frac {1} {\ sqrt {\ pi}}} \ int _ {0} ^ {2 \ pi} f (x) \ cos (nx) \, \ mathrm {d} x}$

and

${\ displaystyle \ left \ langle f, s_ {n} \ right \ rangle = {\ frac {1} {\ sqrt {\ pi}}} \ int _ {0} ^ {2 \ pi} f (x) \ sin (nx) \, \ mathrm {d} x, \ quad n \ in \ mathbb {N}}$

just the Fourier coefficients of the Fourier series of . Hence the Fourier series is the series representation of an element from with respect to the given orthonormal basis. ${\ displaystyle f}$${\ displaystyle L ^ {2} ([0.2 \ pi])}$

Further examples

Let be the sequence space of the square summable sequences. The set is an orthonormal basis of . ${\ displaystyle \ ell ^ {2}}$${\ displaystyle S = \ {e_ {n} \ colon n \ in \ mathbb {N} \}}$${\ displaystyle \ ell ^ {2}}$


text:
# Minimum Swaps To Make Sequences Increasing

We have two integer sequences A and B of the same non-zero length.

We are allowed to swap elements A[i] and B[i].  Note that both elements are in the same index position in their respective sequences.

At the end of some number of swaps, A and B are both strictly increasing.  (A sequence is strictly increasing if and only if A[0] < A[1] < A[2] < ... < A[A.length - 1].)

Given A and B, return the minimum number of swaps to make both sequences strictly increasing.  It is guaranteed that the given input always makes it possible.

Example:
Input: A = [1,3,5,4], B = [1,2,3,7]
Output: 1
Explanation:
Swap A[3] and B[3].  Then the sequences are:
A = [1, 3, 5, 7] and B = [1, 2, 3, 4]
which are both strictly increasing.

Note:

• A, B are arrays with the same length, and that length will be in the range [1, 1000].
• A[i], B[i] are integer values in the range [0, 2000].

dp[i][0] = min(dp[i][0], dp[i - 1][0]);

dp[i][1] = min(dp[i][1], dp[i - 1][0] + 1);

dp[i][0] = min(dp[i][0], dp[i - 1][1]);

dp[i][1] = min(dp[i][1], dp[i - 1][1] + 1);

class Solution {
public int minSwap(int[] A, int[] B) {
int lena = A.length, lenb = B.length;
int[][] record = new int[lena][2];
for(int[] it : record)
Arrays.fill(it, lena);
record[0][0] = 0;
record[0][1] = 1;
for(int i = 1; i < lena; i++){
if(record[i - 1][0] < lena && A[i] > A[i - 1] && B[i] > B[i - 1]){
record[i][0] = Math.min(record[i][0], record[i - 1][0]);
}
if(record[i - 1][0] < lena && B[i] > A[i - 1] && A[i] > B[i - 1]){
record[i][1] = Math.min(record[i][1], record[i - 1][0] + 1);
}
if(record[i - 1][1] < lena && A[i] > B[i - 1] && B[i] > A[i - 1]){
record[i][0] = Math.min(record[i][0], record[i - 1][1]);
}
if(record[i - 1][1] < lena && B[i] > B[i - 1] && A[i] > A[i - 1]){
record[i][1] = Math.min(record[i][1], record[i - 1][1] + 1);
}
}
return Math.min(record[lena - 1][0], record[lena - 1][1]);
}
}


text:
# Using q functions in a Pythonic way

For many users of PyKX the q programming language is not their language of choice when developing analytics and applications. However, when dealing with large volumes of kdb+ data or operations where vector analytic performance is of paramount importance they may desire or need to make use of q.

Functionality within the PyKX library makes the access and use of this functionality easier, this is known as the Context Interface

## The Context Interface

The Context Interface provided with PyKX provides an easy to use way of accessing q contexts (also known as namespaces when at the top level.) For more information about contexts/namespaces in q please refer to Chapter 12 of Q for Mortals.

This provides users who are unfamiliar with kdb+/q analytic development to gain from the expertise of domain experts in this area through the consumption of common libraries and utilities.

Both the embedded q instance at pykx.q, and pykx.QConnection instances, have attributes for q namespaces, which are exposed in Python as pykx.QContext objects. These context objects have attributes for their members, which can either be sub-contexts or K objects. For example:

• pykx.q.Q is a KdbContext instance for the builtin .Q context/namespace
• pykx.q.ctxA.ctxB is a KdbContext instance for the .ctxA.ctxB context
• pykx.q.ctxA.ctxB.kObject is a pykx.K instance for the .ctxA.ctxB.kObject K object

Just as in q, the .q context is accessible at the top-level, so for instance instead of accessing pykx.q.q.md5, you can access it as pykx.q.md5. Some q builtins cannot be accessed like this such as or and not as these result in Python syntax errors. Such functions can instead be accessed either with getattr, or by evaluating them as q code (e.g. pykx.q('not')).

Accessing attributes of pykx.q (or a pykx.QConnection instance) which do not correspond to a context that has been loaded in memory in q will result in it trying to find a script with a matching name. This process is detailed in the flowchart below:

graph LR
A([pykx.q.ctxA
is accessed.]);
B{Is .ctxA
defined in
memory in q?};
C{Is .ctxA
defined in
memory in q?};
D["Search for a
matching script
(details below)."];
E{Has a
matching script
been found?};
F([AttributeError
is raised.]);
G([QContext
is returned.]);
H["Switch to the
context .ctxA
(system "d .ctxA"),

execute the script,
then switch back."];

A --> B;
B --No--> D;
B --Yes--> G;
C --No--> F;
C --Yes--> G;
E --No--> F;
E --Yes--> H;
D --> E;
H --> C;

The fact that the context might not be defined even after the context interface changes the context and executes the script might be confusing. This can happen because the script can switch into other contexts, which overrides the context switch done by the context interface. Additionally the script might use fully qualified names for its definitions, which can bypass the effect of switching contexts.

Note that context switches persists across pykx.q calls (but not pykx.QConnection(...) calls). One should take care when switching contexts, as unexpectedly being in an different context can result in undesirable behaviour. QContext objects are Python context managers, which means they can be used with the with statement like so:

# q code here executes in the global context
with q.myctx:
# q code here executes in the .myctx context
pass
# q code here executes in the global context

If you would like to switch into a q context using a string for the context name, use getattr like so:

# q code here executes in the global context
with getattr(q, 'myctx'):
# q code here executes in the .myctx context
pass
# q code here executes in the global context

The following provides a number of examples of the context interface being used:

• Access a variety of functions for use from the .q, .Q and .j namespaces

>>> import pykx as kx
>>> kx.q.max
pykx.UnaryPrimitive(pykx.q('max'))
>>> kx.q.max([1, 2, 3])
>>>
>>> kx.q.mavg
pykx.Lambda(pykx.q('k){msum[x;0.0^y]%mcount[x;y]}'))
>>> kx.q.mavg(3, kx.q('til 10'))
pykx.FloatVector(pykx.q('0 0.5 1 2 3 4 5 6 7 8'))
>>>
>>> kx.q.Q
<pykx.ctx.QContext of .Q with [ajf0, k, K, host, addr, gc, ts, gz, w, res, addmonths, Xf, Cf, f, fmt, ff, fl, opt, def, qt, v, qp, V, ft, ord, nv, tx, tt, fk, t, ty, nct, fu, fc, A, a, n, nA, an, b6, Aa, id, j10, x10, j12, x12, btoa, sha1, prf0, l, sw, tab, t0, s1, s2, S, s, hap, hmb, hg, hp, a1, a0, IN, qa, qb, vt, bv, pm, pt, MAP, dd, d0, p1, p2, p, view, L, cn, pcnt, dt, ind, fp, foo, a2, qd, xy, x1, x0, x2, ua, q0, qe, ps, enxs, enx, en, ens, par, dpts, dpt, dpfts, dpft, hdpf, fsn, fs, fpn, fps, dsftg, M, chk, Ll, Lp, Lx, Lu, Ls, fqk, fql, btx, bt, sbt, trp, dr, dw, pl0, pl, jl8, srr, prr, lu, DL, dbg, err, BP, bp, bs, bu, bd, bc]>
>>> kx.q.Q.ty(np.array([1, 2, 3]))
pykx.CharAtom(pykx.q('"j"'))
>>>
>>> kx.q.j
<pykx.ctx.QContext of .j with [e, q, s, es, J, k, jd, j]>
>>> kx.q.j.j({'test': 2, 'dict' : [1, 2, 3]})
pykx.CharVector(pykx.q('"{\"test\":2,\"dict\":[1,2,3]}"'))
• Generate a script containing a context and make use of its functionality

• Generate the script saving it to QHOME
>>> demo_extension_source = '''
... \d .demo_extension
... N:100
... test_data:([]N?abc;N?1f;N?10;N?0b)
... test_function:{[data]
...   analytic_keys :max_x1avg_x2med_x3;
...   analytic_calcs:(
...     (max;x1);
...     (avg;x2);
...     (med;x3));
...   ?[data;
...     ();
...     k!k:enlist x;
...     analytic_keys!analytic_calcs
...     ]
...   }
... '''
>>>
>>> demo_extension_filename = kx.QHOME/'demo_extension.q'
>>> with open(demo_extension_filename, 'w') as f:
...     f.write(demo_extension_source)
• Access the defined context using the variables and functions defined
>>> kx.q.demo_extension
<pykx.ctx.QContext of .demo_extension with [N, test_data, test_function]>
>>> kx.q.demo_extension.test_data
pykx.Table(pykx.q('
x x1         x2 x3
------------------
c 0.2086614  2  0
a 0.9907116  1  1
a 0.5794801  8  1
b 0.9029713  8  0
a 0.2011578  1  0
..
'))
>>> kx.q.demo_extension.test_function
pykx.SymbolicFunction(pykx.q('.demo_extension.test_function'))
>>> kx.q.demo_extension.test_function(kx.q.demo_extension.test_data)
pykx.KeyedTable(pykx.q('
x| max_x1    avg_x2   med_x3
-| -------------------------
a| 0.9907116 4.74359  1
b| 0.9550901 4.580645 1
c| 0.9830794 4.433333 0
'))

## Script Search Logic

When the context interface cannot find a namespace (i.e. a top-level context) that is being accessed it attempts to find a q/k script that has a matching name. This process is done via a depth first search of a tree where each node corresponds to part of the path, and each leaf corresponds to a possible file. Only the first file found that exists is executed. If none of the files exist then an AttributeError is raised.

The layers of the tree are as follows:

• Each of the paths in pykx.q.paths/pykx.ipc.Connection(...).paths (which defaults to pykx.ctx.default_paths)
• . prefix or not
• The name of the attribute accessed (i.e. pykx.q.script -> script)
• .q or .k
• No trailing _ or a trailing _ (n.b. why a q/k script path would end with an underscore)

So for example if pykx.q.script was accessed, the context .script was not defined in memory in q, and paths was set to ['.', pykx.QHOME] (where pykx.QHOME == pathlib.Path('/opt/kdb')), then the following paths would be checked in order until one is found to exist, or they have all been checked:

1. ./.script.q
2. ./.script.q_
3. ./.script.k
4. ./.script.k_
5. ./script.q
6. ./script.q_
7. ./script.k
8. ./script.k_
9. /opt/kdb/.script.q
10. /opt/kdb/.script.q_
11. /opt/kdb/.script.k
12. /opt/kdb/.script.k_
13. /opt/kdb/script.q
14. /opt/kdb/script.q_
15. /opt/kdb/script.k
16. /opt/kdb/script.k_
Failure to find a script

Failure to find a script associated with your defined extension will result in an error being raised, the following error message provides a truncated example of this when attempting to retrieve a context test_extension:

>>> kx.q.test_extension
Traceback (most recent call last):
File "/usr/local/anaconda3/lib/python3.8/site-packages/pykx/__init__.py", line 118, in __getattr__
self.__getattribute__('_register')(name=key)
File "/usr/local/anaconda3/lib/python3.8/site-packages/pykx/__init__.py", line 189, in _register
path = _first_resolved_path([''.join(x) for x in it.product(
File "/usr/local/anaconda3/lib/python3.8/site-packages/pykx/__init__.py", line 47, in _first_resolved_path
raise FileNotFoundError(f'Could not find any of the following files:\n{unfound_paths}')
FileNotFoundError: Could not find any of the following files:
.test_extension.q
.test_extension.q_
/usr/local/anaconda3/lib/python3.8/site-packages/pykx/lib/test_extension.k
/usr/local/anaconda3/lib/python3.8/site-packages/pykx/lib/test_extension.k_

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

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/anaconda3/lib/python3.8/site-packages/pykx/__init__.py", line 122, in __getattr__
raise attribute_error from inner_error
File "/usr/local/anaconda3/lib/python3.8/site-packages/pykx/__init__.py", line 115, in __getattr__
return ctx.__getattr__(key)
File "/usr/local/anaconda3/lib/python3.8/site-packages/pykx/ctx.py", line 267, in __getattr__
raise AttributeError(
AttributeError: 'pykx.ctx.QContext' object has no attribute 'test_extension'

## Best Practices

To take full advantage of the automatic script loading one should ensure that every q/k script defines at most one public context. Ideally every q/k script should define exactly one context, and the name of the context should be equivalent to the name of the file without the file extension. For instance, script.q should place its definitions within the .script namespace. This ensures that when the context interface executes a script to load a context, it doesn't load in more contexts than intended. Furthermore the context name matching the file name ensures that when that file is executed because its name matches the desired context, that context will actually be defined.

When these best practices cannot be followed it may be impossible to use the automatic loading of scripts via the context interface. In that case we can resort to manually loading scripts either by executing the q code system "l <path to script>", or by calling pykx.q._register with the path to the script.

When switching contexts within a script, one should always save the context they were in prior to their context switch, and then switch back into it afterwards, rather than explicitly switching into the global context.

## Execution Contexts for Functions

Functions returned by the context interface are provided as pykx.SymbolicFunction instances.

These objects are symbol atoms whose symbol is a named function (with a fully-qualified name). They can be called like regular pykx.Function objects, but unlike regular pykx.Function objects, they will execute in the pykx.Q instance (also known as its "execution context") in which it was defined.

The following shows an example of the retrieval of a function from a context vs defining the function itself:

• Function retrieved via a context

>>> kx.q.extension.func
pykx.SymbolicFunction(pykx.q('.extension.func'))
>>> kx.q.extension.func(2)
pykx.LongAtom(pykx.q('3'))
• Function defined locally and retrieved

>>> qfunc = kx.q('{x+1}')
>>> qfunc
pykx.Lambda(pykx.q('{x+1}'))
>>> qfunc(2)
pykx.LongAtom(pykx.q('3'))


text:
What is a fiber bundle? (for non-mathematicians)

How can I explain the concept of a fiber bundle to someone with no mathematical background?

-

Draw a picture! For example you could use:

• the cylinder for a (trivial) $S^1$-bundle over $\mathbb{R}$
• the Möbius strip for a (non-trivial) $(0,1)$-bundle over $S^1$
• the volume between two spheres of different radius for a (trivial) $(0,1)$-bundle over $S^2$
• the torus for a (trivial) $S^1$-bundle over $S^1$

I think that those can already give some kind of intuition on what a fibre bundle is, in particular the Möbius strip is an easy non-trivial example. You can explain how it is different from the others by noticing that you cannot deform the Möbius strip into a cyilinder.

-
Also, it would be helpful to talk about a Cartesian product. Some examples might be best made physical -- like all the configurations of an hour hand and a minute hand on a clock as a "physical" $S^1 \times S^1$. –  Ryan Budney Aug 13 '13 at 17:27


text:
# Hard-core bosons and fermions - spinless?

The introduction to this paper about bosonic atoms expanding in an optical lattice says the following:

Are hard-core bosons mapped to spinless fermions?

Because this link shows the mapping procedure with spin-$1/2$...

This however corresponds to a spin $1/2$ model, where there are only 2 states occupied, 'up' or 'down'.


text:
# OpenGL Rotating around a vector (or arbitrary axis)

## Recommended Posts

Journey    126
I've been trying to rotate a vector about a certain axis but the functions I use implicitly rotate it about the vectors 1,0,0 (x) 0,1,0 (y) and 0,0,1 (z), the default ones. I know the openGL function glRotate() performs the rotation about a given vector. Anyone know how one would go about implementing one like that? These are the functions I'm using now

void C3DVector::RotateZ(double dDegrees_)
{

double dX = this->m_dX, dY = this->m_dY;

}// end void C3DVector::RotateZ(double dDegrees_)

void C3DVector::RotateY(double dDegrees_)
{

double dX = this->m_dX, dZ = this->m_dZ;

}// end void C3DVector::RotateY(double dDegrees_)

void C3DVector::RotateX(double dDegrees_)
{

double dY = this->m_dY, dZ = this->m_dZ;

}// end void C3DVector::RotateX(double dDegrees_)

##### Share on other sites
It's just one big conjugate transformation:

Rotate & translate everything so that the axis of rotation is mapped to one of the coordinate axes, rotate about this axis, then inverse-transform back to the original coordinate space.
You could do this in the three steps as described, or you could get out some paper, write out the overall transformation, simplify, and use this in your implementation, for a more efficient result.

At least, that's the way I'd do it, being a mathematician. I suppose the computer scientist's solution would be to Google for an existing solution and copy it [rolleyes].

Regards

##### Share on other sites
Zipster    2359
I found this through a Google search. I'm not at my work computer so I can't compare it against the code I've written before, but it looks correct.

##### Share on other sites
hplus0603    11347
Check the Matrix and Quaternion FAQ on this very site.

Or just generate the appropriate quaternion from axis/angle formulation, which is very easy (calculate angle / 2, take sin/cosine, multiply axis by that much and use the consine for the angle).

##### Share on other sites
jyk    2094
Quote:
 Original post by TheAdmiralI suppose the computer scientist's solution would be to Google for an existing solution and copy it [rolleyes].
Ouch - that's pretty cynical :-)

@The OP: The formula to rotate a vector about another (unit-length) vector is fairly straightforward. It looks like Zipster's link covers it, although the article does have a glaring error in that it confuses coordinate system handedness with vector orientation :-/

The vector rotation formula can also be expressed as a matrix-vector multiplication. This is what the OpenGL function glRotate() does - it constructs a matrix representing this operation and concatenates it with the matrix at the top of the currently active OpenGL matrix stack.

##### Share on other sites
Ashkan    451
Here is some code from my math library that returns the rotation matrix around an arbitrary axis.

Matrix4 Matrix4::MakeRotateArbitrary( Vector3& axis, float radian ) {	float fCos = Math::Cos( radian );	float fSin = Math::Sin( radian );	float fSum = 1.0f - fCos;	axis.Normalize();        Matrix4 m;	m[0][0] = ( axis.x * axis.x ) * fSum + fCos;	m[0][1] = ( axis.x * axis.y ) * fSum - ( axis.z * fSin );	m[0][2] = ( axis.x * axis.z ) * fSum + ( axis.y * fSin );	m[0][3] = 0.0f;			m[1][0] = ( axis.y * axis.x ) * fSum + ( axis.z * fSin );	m[1][1] = ( axis.y * axis.y ) * fSum + fCos;	m[1][2] = ( axis.y * axis.z ) * fSum + ( axis.x * fSin );	m[1][3] = 0.0f;	m[2][0] = ( axis.z * axis.x ) * fSum + ( axis.y * fSin );	m[2][1] = ( axis.z * axis.y ) * fSum + ( axis.x * fSin );	m[2][2] = ( axis.z * axis.z ) * fSum + fCos;	m[2][3] = 0.0f;	m[3][0] = 0.0f;	m[3][1] = 0.0f;	m[3][2] = 0.0f;	m[3][3] = 1.0f;        return m;}

## Create an account

Register a new account

• ### Similar Content

• By Zaphyk
I am developing my engine using the OpenGL 3.3 compatibility profile. It runs as expected on my NVIDIA card and on my Intel Card however when I tried it on an AMD setup it ran 3 times worse than on the other setups. Could this be a AMD driver thing or is this probably a problem with my OGL code? Could a different code standard create such bad performance?

• I'm trying to get some legacy OpenGL code to run with a shader pipeline,
The legacy code uses glVertexPointer(), glColorPointer(), glNormalPointer() and glTexCoordPointer() to supply the vertex information.
I know that it should be using setVertexAttribPointer() etc to clearly define the layout but that is not an option right now since the legacy code can't be modified to that extent.
I've got a version 330 vertex shader to somewhat work:
#version 330 uniform mat4 osg_ModelViewProjectionMatrix; uniform mat4 osg_ModelViewMatrix; layout(location = 0) in vec4 Vertex; layout(location = 2) in vec4 Normal; // Velocity layout(location = 3) in vec3 TexCoord; // TODO: is this the right layout location? out VertexData { vec4 color; vec3 velocity; float size; } VertexOut; void main(void) { vec4 p0 = Vertex; vec4 p1 = Vertex + vec4(Normal.x, Normal.y, Normal.z, 0.0f); vec3 velocity = (osg_ModelViewProjectionMatrix * p1 - osg_ModelViewProjectionMatrix * p0).xyz; VertexOut.velocity = velocity; VertexOut.size = TexCoord.y; gl_Position = osg_ModelViewMatrix * Vertex; } What works is the Vertex and Normal information that the legacy C++ OpenGL code seem to provide in layout location 0 and 2. This is fine.
What I'm not getting to work is the TexCoord information that is supplied by a glTexCoordPointer() call in C++.
Question:
What layout location is the old standard pipeline using for glTexCoordPointer()? Or is this undefined?

Side note: I'm trying to get an OpenSceneGraph 3.4.0 particle system to use custom vertex, geometry and fragment shaders for rendering the particles.

• Hi i am new to this forum  i wanted to ask for help from all of you i want to generate real time terrain using a 32 bit heightmap i am good at c++ and have started learning Opengl as i am very interested in making landscapes in opengl i have looked around the internet for help about this topic but i am not getting the hang of the concepts and what they are doing can some here suggests me some good resources for making terrain engine please for example like tutorials,books etc so that i can understand the whole concept of terrain generation.

• By KarimIO
Hey guys. I'm trying to get my application to work on my Nvidia GTX 970 desktop. It currently works on my Intel HD 3000 laptop, but on the desktop, every bind textures specifically from framebuffers, I get half a second of lag. This is done 4 times as I have three RGBA textures and one depth 32F buffer. I tried to use debugging software for the first time - RenderDoc only shows SwapBuffers() and no OGL calls, while Nvidia Nsight crashes upon execution, so neither are helpful. Without binding it runs regularly. This does not happen with non-framebuffer binds.
GLFramebuffer::GLFramebuffer(FramebufferCreateInfo createInfo) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); textures = new GLuint[createInfo.numColorTargets]; glGenTextures(createInfo.numColorTargets, textures); GLenum *DrawBuffers = new GLenum[createInfo.numColorTargets]; for (uint32_t i = 0; i < createInfo.numColorTargets; i++) { glBindTexture(GL_TEXTURE_2D, textures[i]); GLint internalFormat; GLenum format; TranslateFormats(createInfo.colorFormats[i], format, internalFormat); // returns GL_RGBA and GL_RGBA glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, createInfo.width, createInfo.height, 0, format, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); DrawBuffers[i] = GL_COLOR_ATTACHMENT0 + i; glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, textures[i], 0); } if (createInfo.depthFormat != FORMAT_DEPTH_NONE) { GLenum depthFormat; switch (createInfo.depthFormat) { case FORMAT_DEPTH_16: depthFormat = GL_DEPTH_COMPONENT16; break; case FORMAT_DEPTH_24: depthFormat = GL_DEPTH_COMPONENT24; break; case FORMAT_DEPTH_32: depthFormat = GL_DEPTH_COMPONENT32; break; case FORMAT_DEPTH_24_STENCIL_8: depthFormat = GL_DEPTH24_STENCIL8; break; case FORMAT_DEPTH_32_STENCIL_8: depthFormat = GL_DEPTH32F_STENCIL8; break; } glGenTextures(1, &depthrenderbuffer); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, createInfo.width, createInfo.height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthrenderbuffer, 0); } if (createInfo.numColorTargets > 0) glDrawBuffers(createInfo.numColorTargets, DrawBuffers); else glDrawBuffer(GL_NONE); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "Framebuffer Incomplete\n"; glBindFramebuffer(GL_FRAMEBUFFER, 0); width = createInfo.width; height = createInfo.height; } // ... // FBO Creation FramebufferCreateInfo gbufferCI; gbufferCI.colorFormats = gbufferCFs.data(); gbufferCI.depthFormat = FORMAT_DEPTH_32; gbufferCI.numColorTargets = gbufferCFs.size(); gbufferCI.width = engine.settings.resolutionX; gbufferCI.height = engine.settings.resolutionY; gbufferCI.renderPass = nullptr; gbuffer = graphicsWrapper->CreateFramebuffer(gbufferCI); // Bind glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); // Draw here... // Bind to textures glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures[0]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textures[1]); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textures[2]); glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); Here is an extract of my code. I can't think of anything else to include. I've really been butting my head into a wall trying to think of a reason but I can think of none and all my research yields nothing. Thanks in advance!

• Hi everyone, I've shared my 2D Game Engine source code. It's the result of 4 years working on it (and I still continue improving features ) and I want to share with the community. You can see some videos on youtube and some demo gifs on my twitter account.
This Engine has been developed as End-of-Degree Project and it is coded in Javascript, WebGL and GLSL. The engine is written from scratch.
This is not a professional engine but it's for learning purposes, so anyone can review the code an learn basis about graphics, physics or game engine architecture. Source code on this GitHub repository.
I'm available for a good conversation about Game Engine / Graphics Programming

• 15
• 10
• 18
• 9
• 10


text:
# Math Help - Geometry Question

1. ## Geometry Question

If C is the curve parameterised by
t à (cost, sint, cosht):[-pi,pi] à reals ^3
Reparameterise C by arclength?

2. $
s=\int _{- \pi}^t \sqrt{x'^2t)+y'^2(t)+z'^2(t)}dt
$

$
s=\int _{- \pi}^t \sqrt{sin^2 p+cos^2 p+sinh^2 p} \; dp=\int _{- \pi}^t \sqrt{1+sinh^2 p} \; dp=\int _{- \pi}^t \; cosh (p) \; dp=
$

$
=sinh(t)-sinh(- \pi).
$

Now we need to express t as function of s

$
t=f(s)
$

and the curve becomes

$
( \; cos(f(s)), \; sin(f(s)), \; cosh(f(s)) \; ).
$