text:
# Optimisation problem¶

The equation describes the basic formulation of the optimal power flow problem. The pandapower optimal power flow can be constrained by either, AC and DC loadflow equations. The branch constraints represent the maximum apparent power loading of transformers and the maximum line current loadings. The bus constraints can contain maximum and minimum voltage magnitude and angle. For the external grid, generators, loads, DC lines and static generators, the maximum and minimum active resp. reactive power can be considered as operational constraints for the optimal power flow. The constraints are defined element wise in the respective element tables.

$\begin{split}& min & \sum_{i \ \epsilon \ gen, sgen, load, extgrid }{f_{i}(P_i)} \\ & subject \ to \\ & & Loadflow \ equations \\ & & branch \ constraints \\ & & bus \ constraints \\ & & operational \ power \ constraints \\\end{split}$

Generator Flexibilities / Operational power constraints

The active and reactive power generation of generators, loads, dc lines and static generators can be defined as a flexibility for the OPF.

 Constraint Defined in $$P_{min,i} \leq P_{g} \leq P_{max,g}, g \ \epsilon \ gen$$ net.gen.min_p_mw / net.gen.max_p_mw $$Q_{min,g} \leq Q_{g} \leq Q_{max,g}, g \ \epsilon \ gen$$ net.gen.min_q_kvar / net.gen.max_q_kvar $$P_{min,sg} \leq P_{sg} \leq P_{max,sg}, sg \ \epsilon \ sgen$$ net.sgen.min_p_mw / net.sgen.max_p_mw $$Q_{min,sg} \leq Q_{sg} \leq Q_{max,sg}, sg \ \epsilon \ sgen$$ net.sgen.min_q_kvar / net.sgen.max_q_kvar $$P_{max,g}, g \ \epsilon \ dcline$$ net.dcline.max_p_mw $$Q_{min,g} \leq Q_{g} \leq Q_{max,g}, g \ \epsilon \ dcline$$ net.dcline.min_q_from_kvar / net.dcline.max_q_from_kvar / net.dcline.min_q_to_kvar / net.dcline.max_q_to_kvar $$P_{min,eg} \leq P_{eg} \leq P_{max,eg}, eg \ \epsilon \ ext_grid$$ net.ext_grid.min_p_mw / net.ext_grid.max_p_mw $$Q_{min,eg} \leq Q_{eg} \leq Q_{max,eg}, eg \ \epsilon \ ext_grid$$ net.ext_grid.min_q_kvar / net.ext_grid.max_q_kvar $$P_{min,ld} \leq P_{ld} \leq P_{max,ld}, ld \ \epsilon \ load$$ net.sgen.min_p_mw / net.sgen.max_p_mw $$Q_{min,ld} \leq Q_{ld} \leq Q_{max,ld}, ld \ \epsilon \ load$$ net.sgen.min_q_kvar / net.sgen.max_q_kvar

Note

Defining operational constraints is indispensable for the OPF, it will not start if contraints are not defined.

Network Constraints

The network constraints contain constraints for bus voltages and branch flows:

 Constraint Defined in $$V_{min,j} \leq V_{g,i} \leq V_{min,i}, j \ \epsilon \ bus$$ net.bus.min_vm_pu / net.bus.max_vm_pu $$L_{k} \leq L_{max,k}, k \ \epsilon \ trafo$$ net.trafo.max_loading_percent $$L_{l} \leq L_{max,l}, l \ \epsilon \ line$$ net.line.max_loading_percent $$L_{l} \leq L_{max,l}, l \ \epsilon \ trafo_{3w}$$ net.trafo3w.max_loading_percent

The defaults are 100% loading for branch elements and +-0.1 p.u. for bus voltages.

## Cost functions¶

The cost function is specified element wise and is organized in tables as well, which makes the parametrization user friendly. There are two options formulating a cost function for each element: A piecewise linear function with $n$ data points.

$\begin{split}f_{pwl}(p) = f_{\alpha} +(p-p_{\alpha}) \frac{f_{\alpha + 1}-f_{\alpha}}{p_{\alpha + 1}-p_{\alpha}} \ , \ (p_{\alpha},f_{\alpha}) \ =\begin{cases} (p_{0},f_{0}) \ , \ & p_{0} < p <p_{1}) \\ ...\\ (p_{n-1},f_{n-1}) \ , & \ p_{n-1} < p <p_{n}) \end{cases} \\ \\ f_{pwl}(q) = f_{1} +(q-q_{1}) \frac{f_{2}-f_{1}}{q_{2}-q_{1}}\end{split}$

Piecewise linear cost functions can be specified using create_piecewise_linear_costs():

The other option is to formulate a n-polynomial cost function:

$\begin{split}f_{pol}(p) = c_n p^n + ... + c_1 p + c_0 \\ f_{pol}(q) = c_2 q^2 + c_1 q + c_0\end{split}$

Polynomial cost functions can be speciefied using create_polynomial_cost():

Note

Please note, that polynomial costs for reactive power can only be quadratic, linear or constant. Piecewise linear cost funcions for reactive power are not working at the moment with 2 segments or more. Loads can only have 2 data points in their piecewise linear cost function for active power.

Active and reactive power costs are calculted seperately. The costs of all types are summed up to determine the overall costs for a grid state.

## Visualization of cost functions¶

Minimizing Generation

The most common optimization goal is the minimization of the overall generator feed in. The according cost function would be formulated like this:

pp.create_polynomial_cost(net, 0, 'sgen', np.array([-1, 0]))
pp.create_polynomial_cost(net, 0, 'gen', np.array([-1, 0]))
pp.create_polynomial_cost(net, 0, 'ext_grid', np.array([-1, 0]))
pp.create_piecewise_linear_cost(net, 0, "sgen", np.array([[net.sgen.min_p_mw.at[0], 1000], [0, 0]]))
pp.create_piecewise_linear_cost(net, 0, "gen", np.array([[net.gen.min_p_mw.at[0], 1000], [0, 0]]))
pp.create_piecewise_linear_cost(net, 0, "ext_grid", np.array([[-1e9, 1e9], [1e9, -1e9]]))

It is a straight with a negative slope, so that it has the highest cost value at p_min_mw and is zero when the feed in is zero:

Maximizing generation

This cost function may be used, when the curtailment of renewables should be minimized, which at the same time means that the feed in of those renewables should be maximized. This can be realized by the following cost function definitions:

pp.create_polynomial_cost(net, 0, 'sgen', np.array([1, 0]))
pp.create_polynomial_cost(net, 0, 'gen', np.array([1, 0]))
pp.create_piecewise_linear_cost(net, 0, "sgen", np.array([[net.sgen.min_p_mw.at[0], -1000], [0, 0]]))
pp.create_piecewise_linear_cost(net, 0, "gen", np.array([[net.gen.min_p_mw.at[0], -1000], [0, 0]]))
pp.create_piecewise_linear_cost(net, 0, "ext_grid", np.array([[-1e9, -1e9], [1e9, 1e9]]))

It is a straight with a positive slope, so that the cost is zero at p_min_mw and is at its maximum when the generation equals zero.

In case that the load should be maximized, the cost function could be defined like this:

pp.create_polynomial_cost(net, 0, 'storage', np.array([-1, 0]))
pp.create_piecewise_linear_cost(net, 0, "sgen", np.array([[0, 0], [net.load.max_p_mw.at[0], -1000]]))
pp.create_piecewise_linear_cost(net, 0, "gen", np.array([[net.storage.min_p_mw.at[0], 1000], [net.storage.max_p_mw.at[0], -1000]]))


text:
# Symmetric Group

## Homework Statement

Let $G=S_6$ acting in the natural way on the set $X = \{1,2,3,4,5,6\}$.

(a)(i) By fixing 2 points in $X$, or otherwise, identify a copy of $S_4$ inside $G$.

(ii) Using the fact that $S_4$ contains a subgroup of order 8, find a subgroup of order 16 in $G$.

(b) Find a copy of $S_3 \times S_3$ inside $S_6$. Hence, or otherwise, show that $G$ contains a subgroup of order 9.

(c) Find a subgroup of order 5 in $G$.

## The Attempt at a Solution

How do I find a subgroup of S6 which is isomorphic to S4 by fixing 2 elements of X?

For (a)(i) I know:

$S_4 = \{ e, (12), (13), (14), (23), (24), (34), (123), (132), (142),$
$\;\;\;\;\;\;\;\;\;\;\;\;(124), (134), (143), (234), (243), (1234), (1243), (1324),$
$\;\;\;\;\;\;\;\;\;\;\;\;(1342), (1423), (1432) , (12)(34) , (13)(24) , (14)(23) \}$

As written, this can be regarded as a subgroup of S6.

Now, if I want to fix 5 and 6, what permutations in S6 does that leave me with? And conversely, if I write S4 as I've done above, what is the action of each element of S4 on 5 and 6?

For (a)(ii) I know that the following is a subgroup of $S_4$ of order 8: $$\{ e, (24), (13), (12)(34), (14)(23), (1432), (1234), (1324) \}$$

How do I find the subgroup of order 16 by building it up from this subgroup of order 8?

Last edited:

Dick
Homework Helper
If you regard the elements of your S4 as acting on the elements {1,2,3,4} of S, then the don't act on {5,6} at all. 5 and 6 are fixed. You could take your subgroup of order 8 and add a permutation to it that doesn't fix {5,6} to make a larger group.

If you regard the elements of your S4 as acting on the elements {1,2,3,4} of S, then the don't act on {5,6} at all. 5 and 6 are fixed. You could take your subgroup of order 8 and add a permutation to it that doesn't fix {5,6} to make a larger group.

Yeah I see how to do it.

For (b) what are the elements of the direct product $S_3 \times S_3$ ?

Dick
Homework Helper
Yeah I see how to do it.

For (b) what are the elements of the direct product $S_3 \times S_3$ ?

You found a copy of S4 inside of S6. Try and find a copy of S3 inside of S6 in the same way. Now try and find two copies of S3 in S6 that act on disjoint subsets of {1,2,3,4,5,6}.

Last edited:
You found a copy of S4 inside of S6. Try and find a copy of S3 inside of S6 in the same way. Now try and find two copies of S3 in S6 that act on disjoint subsets of {1,2,3,4,5,6}.

Well a copy of $S_3$ in $S_6$ is $$\{ e, (12), (23), (13), (123), (132) \}$$

$S_3 \times S_3 = \{ (a,b) : a,b \in S_3 \}$ with operation $(a,b)(c,d)=(ac,bd)$

I'm not getting how to express cyclic permutations of $S_3 \times S_3$

Last edited:
Dick
Homework Helper
Well a copy of $S_3$ in $s_6$ is $$\{ e, (12), (23), (13), (123), (132) \}$$

$S_3 \times S_3 = \{ (a,b) : a,b \in S_3 \}$ with operation $(a,b)(c,d)=(ac,bd)$

I'm not getting how to express cyclic permutations of $S_3 \times S_3$

That's one S3. Try using {4,5,6} as elements to permute to get the second S3 in the cross product.

That's one S3. Try using {4,5,6} as elements to permute to get the second S3 in the cross product.

OK so $$S_3 \times S_3 = \{ e, (12), (23), (13), (123), (132) \} \times \{ e, (45), (56), (46), (456), (465) \}$$

Dick
Homework Helper
OK so $$S_3 \times S_3 = \{ e, (12), (23), (13), (123), (132) \} \times \{ e, (45), (56), (46), (456), (465) \}$$

Yes, both of your S3 groups act on {1,2,3,4,5,6} and it's a direct product because they don't interfere with each other. They commute.

Yes, both of your S3 groups act on {1,2,3,4,5,6} and it's a direct product because they don't interfere with each other. They commute.

So is this a copy of $S_3 \times S_3$ in $S_6$?

How do I find a subgroup of order 9 from this?

Dick
Homework Helper
So is this a copy of $S_3 \times S_3$ in $S_6$?

How do I find a subgroup of order 9 from this?

Yes, it is. Use the same sort of idea you used to get a subgroup of order 16 from a subgroup of order 8. Think about it.

Yes, it is. Use the same sort of idea you used to get a subgroup of order 16 from a subgroup of order 8. Think about it.

Well what is the order of $S_3 \times S_3$?

Deveno
the order of S3 x S3 is 36. perhaps if you picked a subgroup of order 3 from each "factor", you might have a subgroup of order ___?

the order of S3 x S3 is 36. perhaps if you picked a subgroup of order 3 from each "factor", you might have a subgroup of order ___?

So can I just say that $A=\{ e, (12), (23) \}$ is a subgroup of $S_3$ and so is $B=\{ e, (45), (56)\}$.

Then $A \times B$ is a subgroup of $S_3 \times S_3$ which in turn is a subgroup of $S_6$ of order 9?

Last edited:
Dick
Homework Helper
So can I just say that $A=\{ e, (12), (23) \}$ is a subgroup of $S_3$ and so is $B=\{ e, (45), (56), \}$.

Then $A \times B$ is a subgroup of $S_3 \times S_3$ which in turn is a subgroup of $S_6$ of order 9?

$A=\{ e, (12), (23) \}$ is not a subgroup.

Deveno
A is not a subgroup of S3, neither is B.

neither one of these 3-element sets is closed under multiplication. for example:

(1 2)(2 3) = (1 2 3) (applying (2 3) first), which is not in A.

$A=\{ e, (12), (23) \}$ is not a subgroup.

The alternating group $A_3$ is a subgroup:

$A=\{ e, (123), (132) \}$

$B=\{ e, (456), (465) \}$

So $A \times B < S_3 \times S_3 < S_6$

So $A \times B < S_6$

How do I go about finding a subgroup of order 5?

Dick
Homework Helper
The alternating group $A_3$ is a subgroup:

$A=\{ e, (123), (132) \}$

$B=\{ e, (456), (465) \}$

So $A \times B < S_3 \times S_3 < S_6$

So $A \times B < S_6$

How do I go about finding a subgroup of order 5?

Well can I do something similar to the previous 2 parts? i.e. identify a copy of a certain group inside S6 and deduce a subgroup of order 5? I can't think of any groups to use though!

Dick
Homework Helper
Well can I do something similar to the previous 2 parts? i.e. identify a copy of a certain group inside S6 and deduce a subgroup of order 5? I can't think of any groups to use though!

It's not very similar to the other parts. Does S6 have an element of order 5?

It's not very similar to the other parts. Does S6 have an element of order 5?

(12345)(6) is an element of order 5

Dick
Homework Helper
(12345)(6) is an element of order 5

Ok, so what's the order of the subgroup it generates?

Ok, so what's the order of the subgroup it generates?

Also 5. But how do I find the subgroup it generates?

Dick
Homework Helper
Also 5. But how do I find the subgroup it generates?

The group is generated by the powers of a=(12345). Find the powers of a! a^2, a^3, etc.

The group is generated by the powers of a=(12345). Find the powers of a! a^2, a^3, etc.

I've just thinking about the previous part.

$S_3 \times S_3 = \{ e, (12), (23), (13), (123), (132) \} \times \{ e, (45), (56), (46), (456), (465) \}$

is not a copy of $S_3 \times S_3$ inside $S_6$ because it is not a subgroup of $S_6$ (subgroups of $S_6$ consist of elements of $S_6$).

How can I convert the pairs of elements into elements of $S_6$?

Dick
Homework Helper
I've just thinking about the previous part.

$S_3 \times S_3 = \{ e, (12), (23), (13), (123), (132) \} \times \{ e, (45), (56), (46), (456), (465) \}$

is not a copy of $S_3 \times S_3$ inside $S_6$ because it is not a subgroup of $S_6$ (subgroups of $S_6$ consist of elements of $S_6$).

How can I convert the pairs of elements into elements of $S_6$?

Multiply the two elements of the pair to get an element of S6. The product of the two subgroups is isomorphic to the direct product. Why?

format: plain


text:
Faculty Profile

WAN Shaolong
 Department£º Department of Modern Physics Mailing Address£º USTC,96 Jinzhai Road, Hefei, Anhui 230026, P.R.China Postal Code£º 230026 Phone£º +86-551-63603081 Fax£º 86-551-63601164 Homepage£º

Research Profile

  Shaolong Wan, born in January 1958, is a professor and doctoral supervisor at the University of Science and Technology of China (USTC). He received his Doctorate in Theoretical Physics from USTC and conducted his postdoctoral study and research in theoretical physics at the University of Oxford. Prof. Wan has either studied or worked as a visiting fellow successively in the International Centre for Theoretical Physics (Italy), ¡°Galileo¡± Department of Physics at the University of Padova (Italy), Sub-Department of Theoretical Physics at the University of Oxford (UK), Department of Physics at Stanford University (USA), Department of Physics at the Chinese University of Hong Kong, and Department of Physics at the Hong Kong Baptist University, etc. His research is primarily focused on theoretical physics including quantum field theory, particle theory and quantum many particle theory. He has presided over projects supported by the National Natural Science Foundation of China. He has had a total of over 100 research papers published in academic journals indexed by SCI such as Phys. Rev. A£¬B£¬C£¬D£¬E£¬Letters. Some of his research findings have been cited by the world-renowned International Cooperation Group on Particle Physics, CLEO Collaboration, to serve as theoretical predictions and theoretical model for contrastive purposes. Besides, part of his scientific payoffs has been quoted for multiple times by Review of Particle Physics published by the internationally prestigious Particle Data Group (http://pdg.lbl.gov/). Interesting Research Fields: 1) Quantum and Non-Commutative Field Theory£»2) Quantum Many Particle Theory£»3) Spin Glass Theory and Beyond£»4£©Fractional and Non-Albelian Statistics. Recently Interesting Physical Systems: 1£©Graphene, Bilayer Graphene£»2) (Fractional)Topological Insulator£¨Superconductor)£»3) Macroscopic Quantum States and Topological States£»4) Ultracold Atomic Systems.

Selected Publications
1) Tunneling Magnetoresistance in Junctions Composed of Ferromagnets and Time-Reversal Invariant Topological Superconductors , New J.Phys. , 2016 , Vol.18,023031
2) Valence-quark distribution functions in the kaon and pion , Phys.Rev.D , 2016 , Vol.93,074021
3) A General Time-Periodic Driving Approach to Realize Topological Phases in Cold Atomic Systems , Sci.Rep. , 2015 , Vol.5,16197
4) Measuring the Spin Polarization of a Ferromagnet: an Application of Time-Reversal Invariant Topological Superconductor , EuroPhys.Lett. , 2015 , Vol.111,No.4,47002
5) Topological Superfluid and Majorana Zero Modes in Synthetic Dimension , Sci.Rep. , 2015 , Vol.5,15927
6) Elastic and Transition Form Factors of the Delta(1232) , Few Body Syst. , 2014 , Vol.55,No.1,1-33
7) Long-range Order in One-dimensional Spinless Fermi Gas with Attractive Dipole-Dipole Interaction , J.Phys.B , 2014 , Vol.47,135302
8) Study on the Tunneling Spectroscopy of N-pS Junction and N-hS Junction , New J.Phys. , 2014 , Vol.16,093004
9) Topological Phases, Topological Flat Bands, and Topological Excitations in a one-dimensional Dimerized Lattice with Spin-orbit Coupling , EuroPhys.Lett. , 2014 , Vol.107,No.4,47007
10) Chiral Viscosity Response in Weyl-Semimetals , EuroPhys.Lett. , 2014 , Vol.108,No.3,37007
11) A New Non-Abelian Topological Phase of Cold Fermi Gases in Anisotropic and Spin-Dependent Optical Lattices , J.Phys.B , 2013 , Vol.46,025301
12) Supersolid in Bose-Bose-Fermi Mixtures subjected to a Square Lattice , J.Phys.B , 2013 , Vol.46,055302
13) Features and Flaws of a Contact Interaction Treatment of the Kaon , Phys.Rev.C , 2013 , Vol.87,045207
14) Surface Spectral Function of Momentum-dependent Pairing Potentials in a Topological Insulator: Application to Cu_xBi_2Se_3 , J.Phys.:Cond.Matter , 2013 , Vol.25,215702 CoverPage
15) Topological Superfluid in One-dimensional Ultracold Atomic System with Spin-Orbit Coupling , Eur.Phys.J.B , 2013 , Vol.86,No.8,347
16) Insights into the gamma^* N to Delta Transition , Phys.Rev.C, , 2013 , Vol.88,032201(R)
17) Incomplete Rationality vs. Incomplete Strategy in Minority Game Model , Adv.Mat.Res. , 2013 , Vol.629,735
18) Topological Phase Separation in Trapped Ultracold Fermionic Gases , J.Phys.B , 2012 , Vol.45,065301
19) Phase Diagram of Two-dimensional Polarized Fermi Gas with Spin-Orbit Coupling , Phys.Rev.A , 2012 , Vol.85,023633
20) Critical Surface Band Gap of Repulsive Casimir Interaction between Three Dimensional Topological Insulators at Finite Temperature , Phys.Rev.B , 2012 , Vol.85,115102
21) Fractional Charge and Statistics in the Fractional Quantum Spin Hall Effect , J.Phys.:Cond.Matter , 2012 , Vol.24,165503
22) Quantum Anomalous Hall Effect on Star Lattice with Spin-Orbit Coupling and Exchange Field , J.Phys.:Cond.Matter , 2012 , Vol.24,325502
23) Spectrum of Hadrons with Strangeness , Few Body Syst. , 2012 , Vol.53, No.3-4,293
24) Topological superfluid of spinless Fermi gases in p-band honeycomb optical lattices with on-site rotation , EuroPhys.Lett. , 2012 , Vol.100,No.2,26003
25) Magnetic Impurities in Two-Dimensional Superfluid Fermi Gas with Spin-Orbit Coupling , Eur.Phys.J.B, , 2012 , Vol.85,No.12,417
26) Generalized Quantization Condition for Topological Insulators , Phys.Rev.B , 2011 , Vol.83,205109
27) Orbital Diamagnetism of Weak-doped Bilayer Graphene in Magnetic Field , J.Phys.:Cond.Matter , 2011 , Vol.23,215306
28) Casimir Interaction between Topological Insulators with Finite Surface Band Gap , Phys.Rev.B , 2011 , Vol.84,075149
29) BCS-BEC Crossover in Mix-dimensional Fermi Gases , Eur.Phys.J.B , 2011 , Vol.83,No.4,445
30) Mott Insulator-Superfluid Phase Transition in p-band Triangle Optical Lattices with on-site Rotation , Eur.Phys.J.B , 2011 , Vol.83, No.4, 475
31) Screening-Induced Transport at Finite Temperature in Bilayer Graphene , Phys.Rev.B , 2010 , Vol.81,195409
32) Bose-Hubbard Phase Transition with Two- and Three-Body Interaction in a Magnetic Field , Phys.Lett.A , 2010 , Vol.374,4364
33) Failsafe modes in Incomplete Minority Game , Phys.A , 2009 , Vol.388,3892
34) Incomplete Strategy Effect in Mminority Game , Phys.A , 2009 , Vol.388,935
35) Conclusive and Perfect Quantum State Transfer with a Single Spin Chain , Phys.Lett.A , 2008 , Vol.372,No.3,185
36) Renormalization of Non-Commutative Phi^3_6 Field Theory in x Space , Annales Henri Poincare , 2008 , Vol.9,No.1,65
37) Optimal 1 \rightarrow M Universal Quantum Cloning via Spin Networks , Phys.Rev.A , 2007 , Vol.76,034302
38) X(1835) as a Baryonium State with QCD Sum Rules , J.Phys.G:Nucl.Part.Phys. , 2007 , Vol.34,505
39) Analysis of the Vvector Form Factors f^{+}_{K \pi} (Q^{2}) and f^{-}_{K \pi} (Q^{2}) with Light-Cone QCD Sum Rules , Eur.Phys.J.C , 2007 , Vol.50,781
40) Paraconductivity and Magnetoconductivity Approaches to Superconducting Fluctuations in La_{1.6-x} Nd_{0.4}Sr_{x}CuO_{4} Films , J.Phys.:Cond.Matter , 2007 , Vol.19,6213
41) Collective Modes in a Uniform Fermi Gas with Feshbach Resonances , Phys.Rev.A , 2007 , Vol.75,053608
42) Structure and Decay Constant of the rho Meson with Bethe-Salpeter Equation , Phys.Rev.C , 2007 , Vol.76,025207
43) Magnetic Moment of the Pentaquark theta+(1540) as Diquark-diquark-antiquark state with QCD Sum Rules , Eur.Phys.J.C , 2006 , Vol.45,201
44) Scalar Form-Factor of Proton with Light-Cone QCD Sum Rules , Phys.Rev.D , 2006 , Vol.73,094011
45) Structure of the D_{s0}(2317) and the Strong Coupling Constant g_{D_{s0}DK} with the Light-cone QCD Sum Rules , Phys.Rev.D , 2006 , Vol.73,094020
46) Axial Form-Factor and Induced Pseudoscalar Form-Factor of the Nucleons , Eur.Phys.J.C , 2006 , Vol.47,375
47) Analysis of the Vertexes D^{*}D_{s}K, D^{*}_{s}DK, D_{0}D_{s}K and D_{s0}DK with the Light-cone QCD Sum Rules , Phys.Rev.D , 2006 , Vol.74,014017
48) D_{s}(2317) as a Tetraquark State with QCD Sum Rules in Heavy Quark Limit , Nucl.Phys.A , 2006 , Vol.778,22
49) Magnetic Moment of the Pentaquark Theta^{+}(1540) with QCD Sum Rules , J.Phys.G:Nucl.Part.Phys , 2005 , Vol.31,No.7,703
50) Decay Constant of the Pseudoscalar Charmonium and Bottomoniun , Phys.Lett.B , 2005 , Vol.615,79
51) Analysis the 0^{++} Nonet Mesons as Four-Quark States with the QCD Sum Rules , J.Phys.G:Nucl.Part.Phys , 2005 , Vol.31, No.8,971
52) Decay Width of the Pentaquark State theta^{+}(1540) with QCD Sum Rules , Phys.Rev.D , 2005 , Vol.72,034012
53) Decay Constant of the pion and B Mesons with Bethe-Salpeter Equation , Phys.Lett.B , 2004 , Vol.584,71
54) Decay constants of the pseudoscalar mesons in the framework of the coupled Schwinger -Dyson equation , Nucl.Phys.A , 2004 , Vol.744,156
55) Structures of the f0(980), a0(980) mesons and the strong coupling constants with the light-cone QCD , Eur.Phys.J.C , 2004 , Vol.37,223
56) Directional Ordering of Fluctuations in a 2-dimensional Compass model , Phys.Rev.Lett. , 2004 , 93,207201
57) Dynamical Symmetry Breaking and Confinement with Flat Bottom Potential , Phys.Lett.B , 2002 , Vol.536,241
58) Nonlocal Quark Vacuum Condensate , Phys.Lett.B , 2001 , Vol.498,195
59) An Analytical Systemate Method of Two-State Dissipative System , Phys.Rev.E , 2000 , Vol.61,Part A,4795
60) Ground-state Description of Polarons in Quantum wells , J.Phys.:Cond.Matter , 1998 , Vol.10,6565
61) Ground-state Description of Polarons in Quantum Wells , J.Phys.:Cond.Matter , 1998 , Vol.10,8103
62) Calculations on Some Properties of the Kaon , Z.Phyk.C , 1997 , Vol.73,141
63) Calculations on Some Properties of the Pion in the Framework of Schwinger-Dyson and Bethe-Salpeter E , J.Phys.G:Nucl.Part.Phys. , 1996 , Vol.22,1287
64) Calculations of the Ground-state Energy for Strong- and Intermediate-coupling Exciton-phonon System , Phys.Rev.B , 1996 , Vol.54,1463
65) General Properties for Polaron in Motion , Phys.Rev.B , 1996 , Vol.54,12852
66) General Properties for Two-dimensional Polarons with Non-zero Momentum , Phys.Lett.A , 1996 , Vol.220,131
67) Two- and Three-dimensional Polarons with Extended Coherent States , Phys.Rev.B , 1996 , Vol.53,11296
68) Polaron Effective Masses with Extended Coherent States , J.Phys.:Cond.Matter , 1996 , Vol.8,3391
69) A New Variational Calculation for N-dimensional Polarons in the Strong-coupling Limit , J.Phys.:Cond.Matter , 1996 , Vol.8,7139
70) A Concise Approach to Calculate Polaron Ground-state Energy , Phys.Lett.A , 1994 , Vol.185,216
71) Variational Calculation for Large Bipolarons in the Strong-coupling Limit , Phys.Rev.B , 1994 , Vol.50,164
72) Concise Calculations of the Ground-state Energy for Strongly Bound Exciton-phonon System , Phys.Rev.B , 1994 , Vol.50,14583
73) An Extensive Calculation of the Properties of a One-dimensional Polaron , J.Phys.:Cond.Matter , 1994 , Vol.6,6599
74) Relation Between Faddeevian and Usual Regularization in Chiral Schwinger Model , J.Phys.G:Part.Phys. , 1993 , Vol.19,2177
75) Phenomenological Model for 0^{-} Mesons , Phys.Rev.D , 1993 , Vol.47,2098

Recruitment information


text:
# Magnitude of average velocity [closed]

A particle is at the position with Cartesian components $(5.0 m, 4.0 m)$ and $5.0 s$ later it is at the position with components $(8.0 m, 0.0 m)$. What is the magnitude of its average velocity?

I know the answer is $1.0 m/s$.

-
 en.wikipedia.org/wiki/Pythagorean_theorem – Ignacio Vazquez-Abrams Sep 30 '12 at 1:13 Do I convert the Cartesian components to something else? Polar? – user42783 Sep 30 '12 at 1:58 No. You calculate $\Delta x$ and $\Delta y$. – Ignacio Vazquez-Abrams Sep 30 '12 at 2:01

## closed as too localized by Mark Eichenlaub, dmckee♦Sep 30 '12 at 2:07

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.


text:
# Maxwell Equations

### Basic Concepts and Principles

Maxwell's equations are partial differential equations governing electromagnetic phenomena in vacuum. These equations are
General Maxwell's Equations

1) $div\vec{E} = \frac{1}{\epsilon_{0}\rho}$
2) $div\vec{B} = 0$
3) $rot\vec{B} = \frac{\partial \vec{B}}{\partial t}$
4)$rot\vec{B} = \mu_{0}\vec{j}+\epsilon_{0}\mu_{0}\frac{\partial \vec{E}}{\partial t}$
In absence of electric charges and currents

1) $div\vec{E} = 0$
2) $div\vec{B} = 0$
3) $rot\vec{B} = \frac{\partial \vec{B}}{\partial t}$
4) $rot\vec{B} = \epsilon_{0}\mu_{0}\frac{\partial \vec{E}}{\partial t}$
Where E y B are the intensity of electric and magnetic fields respectively, j is the electric current density, ρ is the charge density, and ε0, μ0 are the constants

$$\epsilon_{0}=8,854.10^{-11} m^{-2}.N^{-1}.C^{2}$$ $$\mu_{0}=1,257.10^{-6} mk.C^{-2}$$

These two constants are related to the speed of light in vacuum, c, exactly

$$c^{2}=\frac{1}{\epsilon_{0}\mu_{0}}$$
If we take Maxwell's equations in a vacuum, we can obtain the wave's equation as follows: first, we derive for t in last one and substituting in the second, this provides

$$\epsilon_{0} \mu_{0} \frac{\partial^{2} \vec{E}}{\partial t^{2}} = rot \: rot \vec{E}$$

Using the relation
$$\Delta \vec{F} = \triangledown (div\vec{F}) - rot \: rot \vec{F} \Rightarrow rot \: rot \vec{F} = \triangledown (div\vec{F}) -\Delta \vec{F}$$
So we obtain
$$\epsilon_{0} \mu_{0} \frac{\partial^{2} \vec{E}}{\partial t^{2}} = \triangledown (div\vec{E}) -\Delta \vec{E}$$
Applying the first of equations (in vacuum) we finally obtain the wave's equation

$$\epsilon_{0} \mu_{0} \frac{\partial^{2} \vec{E}}{\partial t^{2}} = c^{2} \Delta \vec{E}$$
From the above, if for an observer the speed of light is not c then Maxwell's equations could not be hold for him.

Suppose now two inertial observers, called A and B. Suppose A moving uniformely to half speed of light in a radial direction to B and assume that B observer turns on a flashlight directed to A.

B notes that the the ray of light away from him at a speed c = 300.000 km/s.

Logically, A should measure the ray of light travels at a speed

$$c - \frac{c}{2} = \frac{c}{2} = 150.000 km/s (aprox.)$$

This would mean that for observer A, Maxwell's equations fails, at least as way we have seen before, because ligth-speed is not c. However, A observer might say that he is no moving at all. Who is moving is B in opposite direction!!.

Moreover, if A were moving to B he could measure the speed of light even higher than c!!!

In an attempt to explain this discrepancy, scientists of the nineteenth century created the "ether light" theory . On This theory speed of light in vacuum would only make sense respect to ether, this, in an analogy with the sound on earth whose speed of 340m / s is only meaningful relative to air.
Several experiments (like Michelson-Morley experiment in 1887) showed that this substance could not exist. Thus, classical mechanics and in particular the kinematics should be reviewed.

The special relativity theory was born to solve these (and other) questions, teaching us that there is no (inertial) observer privileged and for they all, speed of light is invariantly equals to 300.000km / s.

We will see the formulas in detail, but anticipating we will say now that time becomes relative to observer who measure it. As we moving approaching speed of light, our clocks goes moving slower, ie the time dilates and space coordinates suffer a expansion.

Post here


text:
zbMATH — the first resource for mathematics

Harmonic forms on compact symplectic 2-step nilmanifolds. (English) Zbl 1033.53078
Mladenov, Ivaïlo M. (ed.) et al., Proceedings of the 4th international conference on geometry, integrability and quantization, Sts. Constantine and Elena, Bulgaria, June 6–15, 2002. Sofia: Coral Press Scientific Publishing (ISBN 954-90618-4-1/pbk). 257-270 (2003).
If $$(M,\omega)$$ is a $$2m$$-dimensional symplectic manifold, one can define the space $$\mathcal{H}_{\omega}^k(M)$$ of all harmonic $$k$$-forms on $$M$$ and the symplectic harmonic $$k$$-th cohomology group $$H_{\omega\text{-}hr}^k(M):=\mathcal{H}_{\omega}^k(M)/B^k(M)\cap\mathcal{H}_{\omega}^k(M)$$ [see J. Brylinski, J. Differ. Geom. 28, 93–114 (1988; Zbl 0634.58029)]. Assume that $$M$$ is a $$2$$-step compact nilmanifold $$G/\Gamma$$ (i.e. $$G$$ is a simply connected $$2m$$-dimensional Lie group, whose Lie algebra $$\mathfrak{g}$$ is $$2$$-step nilpotent and $$\Gamma$$ is a discrete subgroup of $$G$$ such that $$G/\Gamma$$ is compact) and $$\omega$$ a $$G$$-invariant symplectic form on $$G/\Gamma$$. Let $$\mathcal{H}_{\omega}^k(\mathfrak{g})$$ be the space of all $$G$$-invariant harmonic $$k$$-forms on $$G/\Gamma$$ and $$H_{\omega\text{-}hr}^k(\mathfrak{g}):=\mathcal{H}_{\omega}^k(\mathfrak{g})/B^k(\mathfrak{g})\cap\mathcal{H}_{\omega}^k(\mathfrak{g})$$. The authors prove that $$B^3(\mathfrak{g})\subset \mathcal{H}_{\omega}^3(\mathfrak{g})$$ and some properties concerning $$\dim H_{\omega\text{-}hr}^{2m-2}(\mathfrak{g})$$ and $$\dim H_{\omega\text{-}hr}^{2m-1}(\mathfrak{g})$$. In particular, the dimension of $$H_{\omega\text{-}hr}^{2m-1}(\mathfrak{g})$$ does not depend on $$\omega$$ [see also the second author, Osaka J. Math. 39, 363–381 (2002; Zbl 1012.53076)]. Some examples are considered. Among them a $$2$$-step compact nilmanifold $$G/\Gamma\;(m\geq 6)$$ admitting symplectic structures $$\omega$$ such that the dimension of $$H_{\omega\text{-}hr}^3(\mathfrak{g})$$ varies [see also D. Yan, Adv. Math. 120, 143–154 (1996; Zbl 0872.58002)], for a question raised by Khesin and McDuff].
For the entire collection see [Zbl 1008.00022].

MSC:
 53D35 Global theory of symplectic and contact manifolds 57R17 Symplectic and contact topology in high or arbitrary dimension


text:
### OpenAL Exponential Falloff

Scripts and code that enhance the gameplay functionality of the engine.

#### OpenAL Exponential Falloff

marauder2k9
Posts: 315
Joined: Wed Feb 18, 2015 7:36 am
This resource will add the exponential falloff to torque3ds sound distance attenuation instead of the linear falloff that it uses as stock... ALOT OF CODE CHANGES INCOMING BACK UP YOUR SOURCE!!! These changes were tested on stock Torque3d 3.10.1 release.

Our first change of many:
in sfxCommon.h around line 152 you should see enum SFXDistanceModel

after SFXDistanceModelLogarithmic add:
SFXDistanceModelExponent,
then at line 189 after break; ad
case SFXDistanceModelExponent:
distance = getMax(distance, minDistance);
distance = getMin(distance, maxDistance);

gain = pow((distance / minDistance), (-rolloffFactor));
break;
Then in sfxDSDevice.cpp at line 203 you will see SFXDevice::setDistanceModel

in the switch below break at case SFXDistanceModelLogarithmic:

add
 case SFXDistanceModelExponent:
Con::errorf("SFXDSDevice::setDistanceModel - 'exponential' distance attenuation not supported by DirectSound");
break;
I'm not sure whether directsound has an exponential attenuation feature but just in case it doesnt i thought it best to sort it out with an error here.

Next in sfxALDevice.cpp find SFXALDevice::setDistanceModel under the case SFXDistanceModelLogarithmic break;

add:
case SFXDistanceModelExponent:
mOpenAL.alDistanceModel(AL_EXPONENT_DISTANCE_CLAMPED);
if (mUserRolloffFactor != mRolloffFactor)
_setRolloffFactor(mUserRolloffFactor);
break;
You could just copy and paste the logarithmic case here and change the values to be exponent but that would just be lazy...........

Next in sfxSystem.cpp

Find around line 94
{ SFXDistanceModelLogarithmic, "Logarithmic",
"Volume attenuates logarithmically starting from the reference distance and halving every reference distance step from there on. "
"Attenuation stops at max distance but volume won't reach zero." },

Below this add
 { SFXDistanceModelExponent, "Exponential",
"Volume attenuates exponentially starting from the reference distance and attenuating every reference distance step by the rolloff factor. "
"Attenuation stops at max distance but volume won't reach zero." },
Because we are using AL_EXPONENT_DISTANCE_CLAMPED the volume attenuation stops when the source reaches max distance.

Then load up your level in the world editor choose thelevelinfo from the mission group and scroll down to sound, under that change soundDistanceModel to Exponential. Done now any sound profiles that you have you can create an exponential rolloff attenuation rather than a linear rolloff.

#### Who is online

Users browsing this forum: No registered users and 4 guests


text:
# All Questions

10 views

### How to create prospective Bonds for a dynamic portfolio simulation?

The aim is to simulate and to compare different bond portfolio strategies for different interest rate scenarios over ten years. The rebalancing takes place on an annual basis. Hence, e.g. a bond with ...
24 views

### dollar neutral ratio vs beta hedged ratio

Hi guys i really hope you can help as i've been pulling out my hair for days on this!! OK so basically i understand the dollar neutral ratio, simply stocka/stockb = dollar neutral ratio. Works great ...
74 views

An increase in default correlation ceteris paribus increases the value of the equity tranche of a CDO. This I get. How then, do I make sense of the statement that as default correlation in the ...


text:
#161
kim jong un carries on the military resistance against white power and oversaw the development of the hydrogen bomb in a nation forced to make their textiles out of rock due to U$naval control around the peninsula. these are amazing technical feats by the class and its leadership. incredibly disrespectful thread but maybe 20% of the posters here are paid by the state to tarnish its enemies, and if that's an overestimate and people are disrespecting a class leader here for free then shame on you. peace between our nations means all amerikans out of korea and its waters. #162 id usually be tarnishing by this point but unfortunately i have been furloughed by the us government due to the coronavirus pandemic #163 He is fat and I hope he loses weight because he's a good diplomat and leader and I want him to be around for the reunification of the peninsula. I say this with no malice in my heart. #164 #165 This breaking news just in: Workers' Party chairman Kim Jong-un is still fat. #166 That's in accordance with DPRK law, by the way #167 well you dont see him at gym opening ceremonies do you #168 toyot posted: kim jong un carries on the military resistance against white power and oversaw the development of the hydrogen bomb in a nation forced to make their textiles out of rock due to U$ naval control around the peninsula. these are amazing technical feats by the class and its leadership. incredibly disrespectful thread but maybe 20% of the posters here are paid by the state to tarnish its enemies, and if that's an overestimate and people are disrespecting a class leader here for free then shame on you. peace between our nations means all amerikans out of korea and its waters.

Web site Posters with CIA backing are tarnishing kim jong un's prized silverware, and frankly, i'm sick of it

#169
let the confirmation of Marshal Kim Jong-un's good health and fatness act as fertilizer for our posting endeavours
#170
He's not scary fat. He's jolly fat. It's a very acceptable, and some believe beautiful, level of fat.
#171
some ignorants of it on this forum but when you Return the cloned receiver has non critical parameters.. weight, hair color. "sliders" so to speak, a few choices made recently speaking to self image & hidden benefits, in a certain person's life.
#172
congratulations to kim jong un on his recovery, i am glad to see him looking so healthy. my prime minister is so fat he cannot even ride a horse. here's to a better tomorrow, kim.
#173
duplicate


text:
# Tutorial :Error including image in Latex [closed]

### Question:

I am getting the following error while compiling my Latex File :

! LaTeX Error: Cannot determine size of graphic in tree.jpg (no BoundingBox).

Why do I get this error ? What has this to do with an .eps file ?

In fact, I could compile it fine with MacTex on my machine. But when I submit it online to a scientific journal for publication, it compiles it on the server and sends me the resultant PDF which has all these errors that prevent it from compiling.

I am using the following syntax for including the images :

\begin{figure}[!h]      \begin{center}          \scalebox{0.45}{              \includegraphics{tree.jpg}}      \end{center}              \caption{\small A sample}              \label{tree}  \end{figure}

What should I do ? Could it be that their server is using an old compiler ?

UPDATE : It finally worked. I converted the first image to PDF and the compilation happened perfectly. I guess it used the bounding box value from that PDF and applied it to all images.

### Solution:1

I've had the same problems including jpegs in LaTeX. The engine isn't really built to gather all the necessary size and scale information from JPGs. It is often better to take the JPEG and convert it into a PDF (on a mac) or EPS (on a PC). GraphicsConvertor on a mac will do that for you easily. Whereas a PDF includes DPI and size, a JPEG has only a size in terms of pixels.

( I know this is not the answer you wanted, but it's probably better to give them EPS/PDF that they can use than to worry about what happens when they try to scale your JPG).

### Solution:2

To include png and jpg, you need to specify the Bounding Box explicitly.

\includegraphics[bb=0 0 1280 960]{images/some_image.png}

Where 1280 and 960 are respectively width and height.

### Solution:3

Using .jpg files do not forget about compiling directly to .pdf (pdflatex) and use: graphicx package with pdftex option (\usepackage[pdftex]{graphicx}).

### Solution:4

If you have Gimp, I saw that exporting the image in .eps format would do the job.

### Solution:5

I use MacTex, and my editor is TexShop. It probably has to do with what compiler you are using. When I use pdftex, the command:

\includegraphics[height=60mm, width=100mm]{number2.png}

works fine, but when I use "Tex and Ghostscript", I get the same error as you, about not being able to get the size information. Use pdftex.

Incidentally, you can change this in TexShop from the "Typeset" menu.

Hope this helps.

### Solution:6

On a Mac (pdftex) I managed to include a png file simply with \includegraphics[width=1.2\textwidth]{filename.png}. But in order for that to work I had to comment out the following 2 packages:

%\usepackage[dvips]{epsfig}

%\usepackage[dvips]{graphicx}

...and simply use package graphicx:

\usepackage{graphicx}

It seems [dvips] is problematic when used with pdftex.

### Solution:7

I had the same problem, caused by a clash between the graphicx package and an inclusion of the epsfig package that survived the ages...

Please check that there is no inclusion of epsfig, it is deprecated.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »


text:
# How many relations are there between the set A and B?

$A =\{1,2,3\}$ and $B=\{a,b\}$

Based on the text, the number of relations between sets can be calculated using $2^{mn}$ where $m$ and $n$ represent the number of members in each set.

Given this, I calculated this number to be $2^{6}=64$ but this number seems too large.

Did I correctly calculate this value?

Yes, you did. There are $3 \cdot 2=6$ pairs of one element from $A$ and one from $B$. Each of these pairs can be in the relation or not, so you have six twofold choices that are independent. That gives $2^6=64$
For example: $$n(A) = p\\ n(B) = q\\ \implies n(AXB) = pq\\ Number\ of\ relations\ between\ A\ and\ B = 2^{pq}\\$$
Remember that if $n(T) = m$, then the number of subsets of set $T$ will be $2^{m}$


text:
## Sunday, 7 July 2013

### Variance Swap Replication in R.

As I was studying volatility derivatives I made some charts that represent some key features of replication. Say variance swap has a payoff function $$f=(\sigma - K_{VOL})$$, which means that $$K_{VOL}$$ will most likely be the forward volatility close to implied. To replicate this theory goes deep into maths and log-contracts that are not even traded on the market, however the idea is simple, buy a portfolio of options with equally distributed strike prices and weight them by reciprocal of squared strikes, i.e.$$1 \big/ K^2$$. Go for liquid ones, i.e. out of the money puts and out of the money calls. Then volatility or in this case variance is dependent on VEGA sensitivity of portfolio. The following graph gives an idea of how it is done. The code is included below:

X-Y - spot/time to maturity, Z - Vega $$\left(\frac{\partial C}{\partial \sigma}\right)$$.

Code:

vega <- function(S0=100, K=100, r=0.05, d=0.05, tau=1, vol=0.1){
d_1  <- (log(S0/K)+((r-d)+vol^2/2)*tau)/(vol*sqrt(tau));
S0*sqrt(tau)*(1/sqrt(2*pi)*exp(-d_1^2/2))*exp(-d*tau)}

vegaK <- function(K, t){
sapply(t, function(x){vega(S0=50:200, K=K, tau=x)/K^2}) }

my3d_plot <- function(mat, x, y, col, bgcol="slatergray", material="lines", add=FALSE, ...){
require(rgl);
if( missing(x) ){ x <- 1:nrow(mat) }; if( missing(y) ){ y <- 1:ncol(mat) }
if( missing(col) ){ col <- rev(rep(heat.colors(ncol(mat),alpha=0),each=nrow(mat))) }
if( !add ){ open3d(); material3d(color=bgcol) }

mat <- lapply(seq(60,180,15), vegaK, t=seq(1,0,length=20))
mat$sum <- Reduce("+", mat) my3d_plot(mat$sum, bgcol="white", col="grey", aspect=c(4, 3, 2))

## Wednesday, 26 June 2013

### Technical(and not technical) strategy testing

I got "hooked" on OOP approach of R in particular reference classes. And after my last little project on option scenario analysis I reconstructed my messy technical strategy testing code.

Now to begin I would like to reason why I have done this while there exist a nice "blotter" and "quantstrat" packages.

First of all "quantstrat" is faster than blotter, which is good. However it was not good enough for me. Once you have 1 minute data and you want to optimise a strategy on 1 year data you can leave your code running for a few days, what is not very convenient as your strategy could be worth absolutely nothing while spending so much time on it. I would also like to note, that the bigger the matrix, the slower the script runs, speaking in relative terms of course. And this is general tendency for R. So I found that 1 minute data is best to test on 1 month minute data without causing too much inconvenience. Of course you will not get away with it once you found a good strategy... and really hurts to see how your code slows down by a significant multiplier once you double the size of your observations. Solution might be to split your data into parts(which just came to my mind while writing this), but then you loose few trades and have to work out your reconstruction, which might be messy with a slight loss in testing "robustness".

Secondly, I want to tell what I think the advantages against Meta stock or other backtesting software are. Answer is simple: machine learning, garch, nlm, no limits. Disadvantages: loss of speed. Another idea which just came to my mind is to write the main loop in Cpp! And given my approach it is feasible!

And my approach is simple and similar to "quantstrat". Also I got few ideas from my friend who is using Meta Stock(in terms of structuring my code). The speed benefit comes from the fact that it is maintained as simple as possible to get the required result.

GIT REPOSITORY:

So lets see an example. Gist is embedded above, however I will explain it in some detail:

1. load your data with OHLC(column names will be converted to "open", "high", "open", "close" for simplicity.
data = dbase(0, 1)
X = to.minutes(data)["201201"]

> dim(X)
[1] 31680 4

2. initialise your reference main class:
stra = Strat(data=X)

args(Strat)
function (data, init = 10000, qty = 5 * init, spread = 2)
data - OHLC (xts class)

> class(stra)
[1] "tstrat"
23 methods, of which 11 are possibly relevant:
ind, l.entry, l.exit, names, plot, run, s.entry, s.exit, signal, time

time - on which weekdays and at what time you want to trade

> args(stra$time) function (from = 0, to = 23, days = 2:6) l.entry, l.exit, s.entry, s.exit - all have same arguments > args(stra$l.entry)
function (columns, true)
columns - names of columns of signals
true - vector of TRUE FALSE indicating which signals you prefer true, which false

stra$ind(fun=SMA, name="smaf", n=20, prefun=Cl) stra$ind(fun=SMA, name="smas", n=50, prefun=Cl)

stra$signal(name="crossup", type="cross", col1="smaf", col2="smas") stra$signal(name="crossdown", type="cross", col1="smas", col2="smaf")

stra$l.entry("crossup",1) stra$l.exit("crossdown",1)
stra$s.entry("crossdown",1) stra$s.exit("crossup",1)

6. Run the code! Note the dimensions of given "X" matrix.
stra$run() On my 3 year old macbook pro it took no more than 3 minutes(given that matlab inbuilt test rated my laptop performance to be lowest among all benchmarks it looks good. doesnt it?) This is a result of the fact that in the loop I used as little objects as possible and have split them to multiple matrices to reduce their size what makes R deal with them faster. 7. Plot results! stra$plot()

It contains:
a) charted series with red dots where trades has occurred
b) wealth index
c) position at the time

8. Your data with all indicators, returns, etc can be accessed:
stra$data str(stra$data)
ret = stra$data$ret

Good things(as Q&A):
1. How many lines I need to do all of this? 16(including 1 line to initialise and 2 lines to load the data).
2. Do I have numerous arguments for each function? No.
3. Does the framework work? Try yourself.

I lost 80% of my initial capital with this strategy.

That is about it. Looks simple, but you can do anything you want without complicated structures. What I mean is I liked "quantstrat", however it took me few days to grasp what is going. Also, it has a lot of functionality that I have not used and finally functionality that I wanted to use was not there, while now I have my simple code that I can manipulate.

source("/Users/Edu/core/Projects/fast_strat/0_fstrat_init.R") # load all
data       <- dbase(0, 1)       # my own written function for database
X          <- to.minutes(data)["201201"]
#### TEST ########################
stra <- Strat(data=X)       # initialise
stra$ind(fun=SMA, name="smaf", n=20, prefun=Cl) stra$ind(fun=SMA, name="smas", n=50, prefun=Cl)
stra$signal(name="crossup", type="cross", col1="smaf", col2="smas") stra$signal(name="crossdown", type="cross", col1="smas", col2="smaf")
stra$l.entry("crossup",1) stra$l.exit("crossdown",1)
stra$s.entry("crossdown",1) stra$s.exit("crossup",1)
stra$run() stra$plot()

My plans for future regarding this little project:
1. Add simple stop loss methods.
2. Make it more general in terms of defining tax and spread functions.
3. Include better position management
4. Edit the aggregation of terminal results: i.e. dealing with trading prices(close or next period open, which day P&L will it represent etc)
5. Refine the code to give the right errors in right places
6. Rewrite the terminal loop in Cpp. Loop currently contains 42 lines and might expand to, i think, 60 after stop loss inclusion. Cpp should not take more than 150 lines

Once again, feedback and comments are welcome.

## Sunday, 16 June 2013

### Scenario analysis and trading options using R

I present you with my restructured project on options trading and scenario analysis. You are more than welcome to try it out. Firstly, I will give a small presentation that will reveal what you can do with it and whether you need to continue reading. Then I will continue with dependencies, classes used and classes created along with methods defined. Finally, I will give some basic operations to show how you can use it yourself.

Lets say you are constructing a portfolio. You want to start with risk-reversal strategy(buy call high, sell put low). You are interested in payoff chart:

For some reason you decide to short a stock and add it to your portfolio:

You now realise that you must really have negative view on the market to trade this. You decide that this will be your view, but your neighbour tells you that a sharp price increase is possible. Decide to buy some digitals:

You are satisfied with your decisions and would like to check you profit and loss as up to now numbers on z axis just showed payoff. Remember as you shorted the stock, you've got some cash. In particular 100. But your digitals cost and sum of option prices should be slightly positive as both symmetrically out of the money:

While you are very happy with your decisions you also want to investigate some sensitivities. Say vega:

Now you're like:"Not trading this weird thing".

If you liked what you saw and you want to try it yourself or even contribute, continue reading.
"sa_work.R" is the file where you would normally work. It has only 1 line to call all you need:
source("~/core/Projects/scenario_analysis/0_sa_init.R")
This is the only line you need to change once you have repository downloaded. Just locate "0_sa_init.R" and it will do all. And by all I mean 2 things: load packages, load other scripts and couple of basic parameters.

Dependencies:
"quantmod" might be needed if you want to download some option or stock data from yahoo. "RQuantLib" is not currently used, but pricing functions might be taken from it later to price americans. "fields" was used in earlier version for interpolation over scatter and might be needed in later development. "rgl" - 3d graphics. "lubridate" is not essential, but it makes life easier when working with dates at user level. However all date objects are automatically converted to "timeDate" class.

File structure is simple:
"0_funs" folder with 2 scripts loaded from it "0_basic.R" that contains some basic functions - only 2 out of 5 are really needed. And "0_inst.R" - abbreviation for instruments, but now contains all the project within. Surprisingly only 500 lines of code. Went down twice after I drifted to OOP approach.
"2_structure_int.R", "2_structure_vol.R" will be used for interest rate structure and implied volatility surface implementation in the future and are currently not used.

Classes:
Classes used are S4 for outputs, some simple variables that needed formalisation and parameter objects. Reference classes are used for instruments.
S4:
"currency" inherits from "character" and Currency() function makes sure its of length 3 and creates new.
"gen.par" contains number of preferred working days in a year and list of interest rates.(later could be extended to interest rate structure).
"stock.par" contains all parameters that are stock specific and varies over time.
"scatter" inherits from "matrix". Contains output from reference classes: data, row and column variables.
Reference:
"security" superclass of all securities.
"spot", "forward" and "option" inherits from "security".
All of them have same methods: price, delta, gamma, theta, rho, rhoQ, vega. All of them have arguments: st(stock price), tVec(time), vol(volatility). "option" class has additional method: getiv.

Here is the list of functions you need:
time_seq(from, to, by = "hour", rng = c(9, 16), holiday = holidayNYSE(2013:2020), trading = TRUE)
- creates time sequence. All methods round the time to hourly so don't use higher frequency! Also, avoid using daily, just stick to default until you know what you are doing.

GenPar() - creates "gen.par" object named "gen.par" and assigns it to "gen.par" environment.
lsg() gets you gen.par object

StockPar() - analogous to GenPar, just names it paste0(ticker,".par")
lss() - lists objects in "stock.par" environment
rms() - clears "stock.par" environment

Spot(id, num=1, class="equity", cur="usd"),
Forward(id, underlying, maturity, K, num=1, class="equity", cur="usd"),
Option(id, underlying, maturity, K, put, ame=0, type="vanilla", num=1, extra=list(0), class="equity", cur="usd")
- creates security objects and assigns it to "securities" environment.
lsi() - lists objects in "securities" environment
rmi() - clears "securities" environment
vaSecurities() - collects all objects in "securities" environment in a list.

Good news. this is all you need. Few things to note. All strings are converted to CAPS including object names for instruments. Only security class is equity. Only 2 option types are available: "vanilla" and "binary"(cash-or-nothing). All options are european.

source("~/core/Projects/scenario_analysis/0_sa_init.R")
########################################################################
GenPar(
rates = list("USD"=0.05),
nyear = 252
)

StockPar(
ticker  = "aapl",   # ticker of the stock
s0  = 100,      # current price of the stock given time(date below)
vol = 0.3,      # yearly vol(numeric)
d   = 0,        #
date    = Sys.Date()    # converted "timeDate": you can enter this in many formats, say: 20120714
)

########################################################################
# Spot("AAPL")
# Forward("AAPLF", "AAPL", Sys.Date()+days(30), 110)
# Option("AAPLC", "AAPL", Sys.Date()+days(30), 100, 0, 0, type="binary", num=1)

Spot("AAPL", num= -1)
Option("AAPLC", "aapl", Sys.Date()+days(30), 120, 0, 0, type="vanilla", num= 1)
Option("AAPLP", "aapl", Sys.Date()+days(30), 80 , 1, 0, type="vanilla", num=-1)
Option("AAPLB", "aapl", Sys.Date()+days(30), 110 , 0, 0, type="binary", num=30)

t   <- time_seq(Sys.Date(),Sys.Date()+2)
s   <- seq(80,120,10)
v   <- seq(0.1,0.5,0.1)

AAPLC$price() # current price [1,] 0.05804536 AAPLC$delta()           # current delta
AAPLC$getiv(AAPLC$price())  # [1] 0.3000074

# say you observe the price higher in the market: 0.1!
AAPLC$getiv(0.1) # [1] 0.3263369 # assign it to stock parameter! AAPL.par@vol <- AAPLC$getiv(0.1)    # you have correct volatility now

p1 = AAPLC$price(st=s, tVec=t) # use st with tVec p2 = AAPLC$price(vol=v, tVec=t)     # or vol with tVec
p3 = AAPLC$price(vol=v, st=s) # DON'T use st with vol str(p1) # Formal class 'scatter' [package ".GlobalEnv"] with 4 slots # ..@ .Data: num [1:5, 1:8] 1.63e-06 8.97e-04 5.80e-02 8.34e-01 4.28 ... # ..@ rows : num [1:5] 80 90 100 110 120 # ..@ rows2: num 0.3 # ..@ cols : num [1:8] 0.0794 0.0789 0.0784 0.0779 0.0774 ... # the output is the same("scatter") from all methods except "getiv" class(p1) # scatter plot(p1) class(p1+20) # scatter b1 = AAPLP$price(st=s, tVec=t)
# sum the payoffs
class(p1+b1)        # matrix - not good
plot(p1+b1)     # not a good idea

class(sum(p1, b1))  # scatter - stick to this
plot(sum(p1, b1))
# sum creates new "scatter" object
# and all attributes are taken from 1st object!
# MEANS: never put a "spot" object first as due to the fact,
#       that it does not have maturity, time axis will be incorrect!

cost <- as.numeric(sum(AAPLC$price(), AAPLP$price(), AAPL$price(), AAPLB$price()))
cost    # [1] -96.04445 means you have cash!
port <- sum(AAPLC$price(s,t), AAPLP$price(s,t), AAPL$price(s,t), AAPLB$price(s,t))

plot(port-cost)     # here is your proffit and loss!

vega <- sum(AAPLC$vega(s,t), AAPLP$vega(s,t), AAPL$vega(s,t), AAPLB$vega(s,t))
plot(port-cost)     # and here is your vega

# make parameters longer and finer to generate nice graphs:
t     <- time_seq(Sys.Date(),Sys.Date()+30)
s   <- seq(80,120,1)
# and repeat

Try it out. Your opinions on flaws, mistakes or improvements are more than welcome.

## Thursday, 30 May 2013

### Scenario analysis for option strategies.

Introduction to the project I am working on at the moment. It is more a playground for option strategies than "project" at this stage.

The idea is to develop accurate scenario analysis on portfolio, which is based on a single underlying. In the past I have written some code on simply plotting the payoffs at maturity, then followed a small piece of code, which was improved in a way that specific date could have been chosen for which the payoff is plotted.

For my current project I think the output will be self explanatory. The code is just the running bit to give a feeling of what it does and how it does what it does:

######################## GEN PARAMETERS ###############################
gen.par  <- vaGenPar(date.start=Sys.Date(),
date.end=Sys.Date()+days(359),r=0.05, cal="UnitedStates")

######################## STOCK PARAMETERS #############################
AAPL   <- vaSPar("AAPL", s0=100, date=Sys.Date(), vol=0.3720573)
# AMZN   <- vaSPar("AMZN", s0=100, date=Sys.Date(), vol=0.4548506)
stock.par  <- vaStockPar(AAPL)

######################## INSTRUMENTS ##################################
rmi()
# equity_s("AAPL","USD", num=1)
# equity_f("AAPL_fut",  "AAPL", "USD", Sys.Date()+days(180), num=1)
equity_o("AAPL1", "AAPL", "USD", Sys.Date()+days(360), 80, 0, 0, "vanilla", num=1)
equity_o("AAPL2",  "AAPL", "USD", Sys.Date()+days(360), 100, 0, 0, "vanilla", num=-2)
equity_o("AAPL3",  "AAPL", "USD", Sys.Date()+days(360), 120, 0, 0, "vanilla", num=1)
instruments <- vaInstruments()

######################## RUN ###########################################
output <- main.aggregate(gen.par, stock.par, instruments, nsd=2, step=0.005, nstd=1.5)
play3d(spin3d(axis=c(0,0,1), rpm=5), duration=12)

The range of the stock values are 2 standard deviations that were plugged into GBM, which was obviously adjusted for risk neutrality as we are in pricing framework. The red line indicates 1.5 standard deviation line. "step" is increment of possible stock prices via volatility.
Furthermore, it returns a function which does an interpolation over the surface, so analysis at each time point can simply be done.

x=50:300
y=outfun(Sys.Date()+days(185), x)
plot(x,y,"l")

For now, the interest rates used are flat as well as implied volatility surface. However, the needed space was made so both can be easily implemented. Also, it is restructured in such way, that new pricing functions can be added effortlessly.

Implementing multiple assets can also be easily done, however I did not figure out, how to aggregate total pnl. One way to do it would be taking 1 stock as a reference, and using beta coefficients to sum the pnl. However, this would flaw the output via false assumption of constant beta with 0 variation.

Other derivatives in my mind are american options, powers, barriers or index linked notes that are possible to price via known pricing functions. In general, anything that could be priced without needing to calibrate model with more than one source of risk.


text:
### Fixing the Odds

You have two bags, four red balls and four white balls. You must put all the balls in the bags although you are allowed to have one bag empty. How should you distribute the balls between the two bags so as to make the probability of choosing a red ball as small as possible and what will the probability be in that case?

### Scratch Cards

To win on a scratch card you have to uncover three numbers that add up to more than fifteen. What is the probability of winning a prize?

### In a Box

Chris and Jo put two red and four blue ribbons in a box. They each pick a ribbon from the box without looking. Jo wins if the two ribbons are the same colour. Is the game fair?

# Win or Lose?

##### Age 14 to 16 Challenge Level:

A gambler bets half the money in his pocket on the toss of a coin, winning an equal amount for a head and losing his money if the result is a tail. He repeats this many times, each time betting half the total money he has. After $2n$ plays he has won exactly $n$ times. Has he more money, the same amount or less money than he started with?


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

# 2D material programming for 3D shaping

## Abstract

Two-dimensional (2D) growth-induced 3D shaping enables shape-morphing materials for diverse applications. However, quantitative design of 2D growth for arbitrary 3D shapes remains challenging. Here we show a 2D material programming approach for 3D shaping, which prints hydrogel sheets encoded with spatially controlled in-plane growth (contraction) and transforms them to programmed 3D structures. We design 2D growth for target 3D shapes via conformal flattening. We introduce the concept of cone singularities to increase the accessible space of 3D shapes. For active shape selection, we encode shape-guiding modules in growth that direct shape morphing toward target shapes among isometric configurations. Our flexible 2D printing process enables the formation of multimaterial 3D structures. We demonstrate the ability to create 3D structures with a variety of morphologies, including automobiles, batoid fish, and real human face.

## Introduction

Morphing thin sheets, or two-dimensional (2D) materials, into programmed 3D shapes is emerging as a paradigm in additive manufacturing1,2. 3D-shaped 2D materials abound in man-made and biological systems and play diverse functions3. Examples include flowers, leaves, organ epithelia, marine invertebrates, batoids, and bodies of vehicles. Living organisms attain a variety of morphologies of soft slender tissues and their motions through spatially controlled growth (expansion and contraction)2,3,4,5,6,7. Moreover, such shape-morphing materials can enable new technologies for broad applications, including soft robotics8, deployable systems9, microfluidics10, tissue engineering11, and biomimetic manufacturing1.

Inspired by biological morphogenesis and motions, in-plane growth-induced 3D shaping approaches have shown their unique capability to create shape-changing hydrogel structures with doubly curved morphologies and motions, commonly observed in living organisms but difficult to replicate in man-made structures2,3,4. In particular, with their physical properties similar to those of biological soft tissues, such hydrogel structures have great potential for bioinspired and biomedical applications2,12. However, to realize the full potential of 2D growth-induced 3D shaping, theoretical and experimental challenges remain to be addressed. Fundamental among these is how to quantitatively design 2D growth for arbitrary 3D shapes and physically realize the growth in space and time to form the target shapes. For example, previous studies have mostly formed 3D shapes based on radially symmetric growth patterns or those with relatively small Gaussian curvatures, restricting the accessible space of 3D shapes2,3,4. The limitation arises from the lack of a general theoretical framework to translate arbitrary 3D shapes into 2D growth, the limited range of growth of programmable materials, and complex processes for material programming2,3,4,13,14,15,16. Moreover, forming complex shapes, such as those with both positive and negative Gaussian curvatures or multiple modular components, requires additional strategies for shape selection among multiple isometric configurations (embeddings), as a metric, or growth, prescribes local Gaussian curvatures, but not necessarily configurations, and may thus adopt multiple embeddings in space2,4,13. From a technological perspective, a scalable 2D material programming method capable of simultaneously fabricating multiple 3D structures with custom design could translate the shaping principle into a scalable and customizable manufacturing technology, complementing existing additive manufacturing methods9,17,18.

Here, we show a 2D material programming approach for 3D shaping that transforms 2D materials to programmed 3D structures with doubly curved morphologies (Fig. 1, Supplementary Figs. 1 and 2). This approach prints temperature-responsive hydrogel sheets encoded with spatially controlled in-plane growth Ω, which induces the shape transformations. We determine Ω for 3D shapes by conformally flattening them to the 2D plane using the boundary first flattening (BFF) method19. We introduce the concept of cone singularities into the design of Ω to mitigate the physical limitation of material growth, significantly increasing the accessible space of 3D shapes. As an active strategy for shape selection, we encode shape-guiding modules in Ω that direct shape morphing toward a target shape among multiple isometric configurations. Our process can simultaneously print multiple 2D hydrogels with different Ω in a single step, typically within 3 min, and on demand transform the hydrogels to programmed shapes, thereby rendering our approach scalable, customizable, and deployable. Furthermore, our flexible 2D printing process allows for sequential printing of multiple materials, enabling multimaterial 3D structures.

## Results

### 2D material programming for 3D shaping

A key challenge in growth-induced 3D shaping is to translate arbitrary 3D shapes into 2D growth. We recast this problem as a differential geometry problem of conformally mapping a target shape (surface) M with metric g onto the plane C with metric $$\tilde g$$ (Fig. 1a, Supplementary Fig. 1)19. A map fM → C is conformal if $$\tilde g = \lambda ^2g$$ for a function λ2, where λ is the conformal factor (λ > 0). This definition implies that a conformal mapping only allows isotropic (uniform) scaling by λ while preserving angles, which is also the characteristic of isotropic materials (encoded with length growth λ). We thus postulated that (1) an inverse conformal mapping f−1C → M represents an in-plane growth-induced shape transformation of a 2D hydrogel C to a target 3D shape M (or an isometric embedding of M), as our hydrogels isotropically swell and shrink, and (2) λ−1 quantifies the length growth (shrinkage in this study) at each point on the 2D hydrogel required to induce the shape transformation (Fig. 1a). We defined area growth as Ω = −2, where c is a constant. Given target 3D shapes, we computed Ω using BFF19. We first validated our approach by computing Ω for geometric shapes with known axisymmetric metrics: spherical cap (K > 0), saddle (K < 0), and cone (K = 0) with constant Gaussian curvature K (Supplementary Fig. 3)2. The computed Ω quantitatively agree with the theoretical Ω (Supplementary Fig. 3).

We next physically realized f−1C → M with Ω using digital light 4D printing (DL4P) (Fig. 1, Supplementary Fig. 1, Supplementary Movie 1). DL4P encodes 2D hydrogels with Ω through spatial and temporal control of photopolymerization and cross-linking reactions with two types of crosslinkers with different lengths via digital light projection grayscale lithography2. This process increases the local density of polymer networks of hydrogels with light exposure time and thus decreases their local degrees of swelling and shrinkage, allowing for shape programming at both the swelled and shrunk states (Supplementary Figs. 4 and 5)2. As the thickness of a sheet vanishes, a growth-induced shape converges to an isometric embedding of a target metric20. The shape at the shrunk state can thus adopt a metric closer to the designed growth than one at the swelled state2,21. In addition, potential applications can benefit from the higher or more uniform mechanical properties of the resulting 3D structures at the shrunk state than the swelled state and the ability to form 3D shapes in physiological conditions (T = 37 °C) (Supplementary Fig. 5)2,22. We thus formed shapes at the shrunk state (Ω < 1). The resulting structures reversibly transform their shapes between M and N upon temperature change (Supplementary Fig. 2).

### Growth-induced 3D shaping

Figure 2 shows exemplary 3D structures created by our method. Given target shapes (Fig. 2a–d), we computed Ω (Fig. 2e–h) and printed structures using Ω (Fig. 2i–l, Supplementary Fig. 1). We first considered 3D shapes defined by a height function h(x, y) = a(xm + yn), where a, m, and n are constants (Fig. 2a, Supplementary Fig. 6). Figure 2a, i shows 3D shapes with a = 2.09, m = 3, and n = 2. We further formed various 3D structures, ranging from sea shell (Fig. 2j, Supplementary Fig. 7) and leaves (three leaves with the same shape but different size; Fig. 2k, Supplementary Fig. 8, Supplementary Movie 2) to automobile with open windows (Fig. 2l). Furthermore, to demonstrate a potential application of replicating real objects, we 3D scanned a model automobile and printed it (Fig. 2m). The experimentally printed structures (Fig. 2i–m) agree well with the target shapes (Fig. 2a–d, m), illustrating the ability to form structures with diverse morphologies. The shapes in Fig. 2 have a value of Ωr = Ωmaxmin < 2.15, where Ωmax and Ωmin are the maximum and minimum values of Ω, respectively. Ωr of Ω in Fig. 2e–h, m are 2.09, 2.14, 1.63, 2.14, and 1.87, respectively, within the accessible range of growth of our material systems (Ωr < 2.5).

### Cone singularities

The Riemann theorem suggests that our method can form any curved shapes of thin sheets by conformally morphing 2D hydrogels16,23. However, in practice, the accessible Ωr limits accessible 3D configurations2,4. To mitigate this limitation, we introduced the concept of cone singularities (Fig. 3). The idea is to first map a 3D shape on a cone surface (K = 0) and then unfold the cone surface to the 2D plane (without further area distortion) by cutting the surface through cone points, rather than directly mapping a shape to the plane (as shown in Fig. 2)19,24. This approach can significantly reduce Ωr, as a 3D shape can be conformally mapped to a cone surface with lower area distortion than to the plane and the cone surface can be isometrically flattened to the plane.

To demonstrate the concept of cone singularities, we first considered a hemisphere (Fig. 3a–f). A conformal mapping of a hemisphere gives Ω = c/[1+(r/R)2]2, where r/R is the normalized radial position and R is a constant2. This mapping yields the least area distortion, as Ω is constant along the boundary25. Forming a full hemisphere hence requires Ωr = 4, and we can form only a portion of a hemisphere using our materials with Ωr < 2.5 (Fig. 3a). For example, the maximum attainable portion with Ωr = 2.22 is a spherical cap with a cap angle φ = 70°, where φ is the polar angle from the pole of the cap to its base in a spherical coordinate system (Fig. 3a). Enhancing accessible Ωr of material systems to be 4 or higher can form a full hemisphere (φ = 90°), but this approach is practically inefficient (as discussed below)4. We instead used a cone singularity to reduce Ωr (Fig. 3b). Introducing a cone singularity at the pole with a cone angle θc = 60° (deficit angle of the cone surface) transforms Ω to have Ωr = 2.22, enabling the formation of an almost-complete hemisphere with φ = 85° (Fig. 3a, b, Supplementary Movie 3).

To further elucidate how cone singularities transform Ω, we computed Ω for a hemisphere with a cone singularity with different θc, thus with different cone metrics, and printed the maximum attainable portion (Fig. 3c, Supplementary Figs 912). The maximum value of Ω and the value of Ω around the cone singularity (r/R = 0) decrease with θc, decreasing Ωr with θc to reach the minimum Ωr = 2.22 at θc = 60° (Fig. 3c, d). Further increase in θc leads to Ω < 1 around r/R = 0, increasing Ωr with θc at θc > 60° (Fig. 3c, d). Morphing a cone surface with θc < 60° to a spherical shape requires smaller area distortion around its tip than a flat plane, thereby decreasing Ωr with θc. However, as it gets sharper, a cone surface with θc > 60° requires larger shrinkage to smooth the sharp tip to a spherical shape, thus increasing Ωr with θc. The experimental structures show a quantitative agreement with the computational predictions as shown in φ and K obtained with different θc (Fig. 3e, f, Supplementary Figs. 10 and 12). From a practical perspective, cone singularities extend accessible K for given printing areas and materials (Fig. 3f, Supplementary Fig. 12).

Increasing the number of cone singularities can further increase the accessible shape space. To demonstrate this capability, we attempted to form an almost-complete sphere (Fig. 3g–i). Directly morphing a 2D material to such a closed structure is inefficient, as it demands severe area distortion4. For instance, the sphere requires Ωr = 234.3, essentially impossible to achieve with available material systems, and Ωr = 25.9 with a cone singularity (Supplementary Figs. 13 and 14). To tackle this challenge, we increased the number of cone singularities to 12 and achieved Ω with Ωr = 2.12, within the accessible range of growth (Fig. 3i, Supplementary Fig. 14). Remarkably, despite its highly irregular boundary, Ω induces a sphere with well-matched cut edges, highlighting the accuracy of our approach (Fig. 3h, Supplementary Fig. 15). Beyond simple geometric shapes, the cone flattening enables us to create complex 3D structures with high K, difficult to attain without cone singularities. As an example, we printed a nose (Fig. 3j–l). Because of high K at its tip, the nose requires a large range of growth with Ωr = 7.22 (Supplementary Fig. 16). Cone flattening reduces the range to Ωr = 2.06, enabling the formation of the nose with high accuracy (Fig. 3k, l, Supplementary Fig. 16).

The use of cone singularities increases the accessible shape space, but the cuts in the resulting structures can limit their applications. A design principle that incorporates the placement of cone singularities into the function of shape-morphing structures can mitigate the limitation, which, however, requires further study24,26. In addition, post-printing crosslinking or surface coating processes can seal the cuts for applications that require enhanced mechanical properties.

### Shape selection

According to Gauss’s theorema egregium, Ω prescribes K of a growth-induced structure but not necessarily its configuration (unless there exist constraints). In general, Ω can thus induce multiple configurations (embeddings), for example, owing to its symmetric nature2,4. Our method uses the slight variations in shrinkage through the thickness of hydrogels as an inherent constraint for shape selection. This constraint reduces the number of possible isometric embeddings, sufficient to adopt target shapes for a broad range of geometries as shown in Figs. 2 and 3. This constraint breaks the up–down directional symmetry of Ω in space, directing all regions with K > 0 to deform in the same direction2. However, 3D shapes requiring complex morphing patterns, such as those with multiple K > 0 and K < 0 regions, may need additional constraints. One may predict the resulting shape by determining the embedding with minimum energy, as the metric should adopt the embedding with vanishing thickness of hydrogels20, but actively achieving target shapes remains largely unexplored.

As an active strategy for shape selection, we encoded shape-guiding modules in Ω (Fig. 4). The modules were designed to guide the direction of shape morphing toward target shapes while minimally altering the resulting shapes. To demonstrate this approach, we printed stingray structures at two different phases of undulatory swimming motion (Fig. 4a, Supplementary Fig. 17)27,28. Stingrays produce complex morphologies with K > 0 (central body) and K < 0 (pectoral fins) regions, as the undulating waves travel on their pectoral fins, difficult to replicate by other methods. Ω0 (Ω for the morphology at phase 0 in Fig. 4a) and Ω0.5 (Ω for the morphology at phase 0.5 in Supplementary Fig. 17) induced three and two different configurations, respectively, but mostly one type of primary configurations (presumably the embeddings with the lowest energy), different from the target shapes (Fig. 4a, Supplementary Figs. 17 and 18, Supplementary Table 1). By contrast, Ω0 and Ω0.5 with a shape-guiding module with K > 0 in the central body yielded only the target shapes out of 16 and 36 printed structures, respectively (Fig. 4a, Supplementary Figs. 17 and 19, Supplementary Movies 4 and 5).

The shape-guiding module has two functions: (i) it directs the central body (K > 0) to morph in the same direction (upward or k > 0, where k is the curvature) as the head (K > 0), owing to the inherent constraint (through-thickness variation in shrinkage), and (ii) it directs the pectoral fins (K < 0), or the principal curvatures of the fins along the direction of their major axes, to morph in the same direction as the central body along the interfaces of the body and the fins (k > 0), guiding the fins to morph into the target morphologies (Fig. 4b, Supplementary Fig. 20). The symmetric nature of the metrics of the fins results in two major modes of shape morphing that the pectoral fins can select, inducing two major types of fin configurations (Fig. 4b, c, Supplementary Fig. 20, Supplementary Movie 6). The metrics of the fins and their neighboring metrics, including that of the shape-guiding module, along with inherent constraints determine the energy required for each shape-morphing mode, allowing us to direct the shape selection using shape-guiding modules. Moreover, the shape-guiding module, such as one with low K in Fig. 4a and Supplementary Fig. 17, can only guide the direction of shape morphing essentially without altering the resulting shape (Supplementary Fig. 21).

Beyond 3D structures with single materials, our method can create multimaterial 3D structures (Fig. 4d). As a demonstration, we formed purple-spotted stingrays by sequentially printing the primary and gold nanoparticles (GNPs)-encapsulated hydrogels with Ω in the same layer (Fig. 4d). Furthermore, our method can print multilayer structures with single and multiple materials, highlighting its versatility (Supplementary Figs. 22 and 23). The ability to pattern functional materials in complex 3D structures could integrate multifunctionalities into them, broadening their potential applications.

Finally, to demonstrate the ability to create truly arbitrary 3D shapes, we replicated a real human face (Fig. 4e, Supplementary Movie 7). We 3D scanned a face of a colleague, computed Ω for the face with a cone singularity, reducing Ωr from 4.19 to 2.41, and printed the face (Fig. 4e, Supplementary Fig. 24). In particular, the elliptical region at the nose between eyes in Ω (white dotted line in Fig. 4e) inherently functions as a shape-guiding module. This module induces an elongated saddle-like shape with K < 0, aligning its principal directions at the center with the major and minor axes of the module (i.e., along and perpendicular to the long axis of the nose, respectively)2. The shaping of the saddle directs the left and right eye sockets (K > 0) and the nose and forehead (K > 0) to morph downward (k < 0) and upward (k > 0), respectively, coordinating overall shape morphing toward the target configuration. The eye sockets and the nose and forehead morph in the opposite directions, as they share the boundaries with the elongated saddle along the directions of its major and minor axes, which deform in the opposite directions2.

## Discussion

Inspired by biological morphogenesis and motion, we have demonstrated a 2D material programming approach to creating shape-morphing 3D structures with complex, doubly curved morphologies, often seen in living organisms but difficult to replicate with man-made materials. The ability to quantitatively design 2D growth for 3D shapes enables the creation of various 3D structures with complex morphologies. The concepts of cone singularities and shape-guiding modules further enhance the accessible space of 3D shapes and the ability to select target shapes among isometric configurations. However, our approach essentially programs 2D materials with K of a target shape but not directly the shape itself, although shape-guiding modules can alleviate this limitation. An approach that programs both K and mean curvature can address the limitation, including the shape selection problem, in a more general way, for example, by controlling both in-plane and through-thickness growth. In contrast to conventional additive manufacturing, which serially builds 3D structures via layer-by-layer deposition of materials, our method simultaneously prints multiple 2D materials encoded with individually customized design, without the need for printing nozzles or physical masks, and on demand morphs the 2D materials to programmed 3D structures in parallel. Our approach is thus scalable, customizable, and deployable, complementing existing additive manufacturing methods. Although this work shows the proof of concept using temperature-responsive hydrogels, the shaping principle is applicable to other programmable materials and stimuli over a range of length scales29,30,31 for broad applications1,8,9,10,11. Our 2D printable 3D-shaping approach capable of multimaterial printing, potentially integrable with well-developed planar fabrication methods and devices, could open up new strategies for the design and fabrication of shape-morphing engineering systems, including soft robots, deployable systems, and biomimetic devices.

## Methods

### Preparation of precursors

The precursor solution for poly(N-isopropylacrylamide) (pNIPAm) hydrogels was prepared by dissolving N-isopropylacrylamide (NIPAm, TCI America) (0.4 g), N,N′-methylene bisacrylamide (BIS, Sigma-Aldrich) (1 mol% of NIPAm), poly(ethylene glycol) diacrylate with an average molecular weight of ~700 g mol−1 (Sigma-Aldrich) (0.125 mol% of NIPAm), and diphenyl(2,4,6-trimethylbenzoyl)phosphine oxide (Sigma-Aldrich) (0.15 mol% of NIPAm) in 1 mL aqueous solutions (1:3 volume ratio of water and acetone). The precursor solution for pNIPAm hydrogels with GNPs (~40–60 nm in diameters) was prepared by adding GNPs to the precursor solution for pNIPAm hydrogels (0.05 mg mL−1). GNPs were synthesized by mixing aqueous solutions of chloroauric acid (Sigma-Aldrich) and sodium citrate (Sigma-Aldrich)32. GNPs were purified and concentrated by centrifugation (Centrifuge 5430, Eppendorf) before use. All materials were used as received.

### Formation of 3D structures

Target 3D structures were formed using DL4P as described below (Fig. 1, Supplementary Fig. 1)2. Given target 3D shapes, growth functions Ω were computed using BFF with custom MATLAB (MathWorks) code19. Ω were converted into grayscale 2D maps of light exposure time and then stereolithography (STL) files via custom MATLAB (MathWorks) code using the calibration curve of the areal shrinking ratios of pNIPAm hydrogels versus light exposure time (Supplementary Fig. 4). 2D gels encoded with Ω were prepared by polymerizing and cross-linking a precursor solution in a projection lithography cell with spatially and temporally controlled ultraviolet (UV) light using a digital light processing projector (Vivitek D912HD) with the STL files2. The projection lithography cell consists of a polydimethylsiloxane (PDMS) substrate, a PDMS spacer with a thickness of 400 μm (inner dimension of 57 × 32 mm), and a glass cover. For printing of large structures, fluorinated ethylene propylene film was used as a substrate and a cover to reduce the variations in the degrees of polymerization and crosslinking through the thickness of printed gels. After photopolymerization and photocrosslinking, the 2D gels were detached from the cell and immediately washed with isopropyl alcohol (IPA) and cold water (4 °C) three times each to remove uncrosslinked materials and photoinitiators and thus suppress further polymerization and crosslinking. To further remove uncrosslinked materials and photoinitiators, the gels were immersed in water at 4 °C for 16 h, exchanging the water at 1 h and 16 h after immersion. To form the target structures at the shrunk state, the temperature of the water was slowly increased to 35 °C in a temperature-controlled water bath. Food color dyes were introduced into some structures for better imaging.

### Construction of calibration curves

Homogeneous hydrogel disks, or hydrogel disks with constant Ω, with a diameter of 9 mm were prepared by uniformly exposing a precursor solution to UV light with different light exposure times of 8–70 s using DL4P as described above. To remove the possibly underexposed areas at the edges of the hydrogel disks, homogeneous hydrogel disks with a diameter of 7 mm were prepared by punching the hydrogel disks with a diameter of 9 mm using a biopsy punch (7 mm in inner diameter). The areas of the hydrogel disks with a diameter of 7 mm were measured at 35 °C. The areal shrinking ratios A/A0 of the hydrogel disks with different light exposure times were used to construct the calibration curve of A/A0 versus light exposure time (Supplementary Fig. 4), where A and A0 are the areas of the hydrogel disks at 35 °C and the areas of the hydrogel disks after punching, respectively.

### Measurement of mechanical properties

The dynamic mechanical properties of hydrogels prepared with different light exposure times were measured using a rheometer (DHR-2, TA Instruments) with a 20-mm plate geometry. The shear storage modulus G′ and loss modulus G′′ of the hydrogels at the swelled and shrunk states were measured by frequency sweeps of 0.05–10 Hz at an oscillatory strain of 1%. A Peltier plate temperature system integrated with the rheometer was used to maintain the temperature of the hydrogels at the swelled and shrunk states at 25 °C and 35 °C, respectively.

### Printing of 3D structures with multiple materials

3D structures patterned with GNPs were fabricated by sequentially printing primary pNIPAm and GNP-encapsulated pNIPAm hydrogels with Ω in the same layer. The primary pNIPAm gel regions were first printed using the pNIPAm precursor with Ω. This printing process attaches the printed gels to the cover of the projection lithography cell. The cover of the cell with the primary gels was opened while one side of the cover was attached to the cell by tape (Scotch tape, 3M), which worked as a hinge, to align the printed gels with the second printing, and the excess precursor was removed. After washing the primary gels and the cell with IPA three times, the second precursor containing GNPs was introduced into the cell. The cover of the cell with the primary gels was then closed. The GNP-encapsulated gel regions were then printed with Ω. After printing the two regions, target structures were formed as described above.

### Printing of multilayer 3D structures

Multilayer 3D structures were fabricated by sequentially printing the first layer and the second layer using two types of spacers with different thicknesses. The first layer was printed using a first precursor with Ω. This printing process attaches the printed gels to the cover of the projection lithography cell. The cover of the cell with the printed gels was opened while one side of the cover was attached to the cell by tape (Scotch tape, 3M), which worked as a hinge, to align the printed gels with the second printing, and the excess precursor was removed. The spacer of the cell (400 μm in thickness) was then replaced with a thicker spacer (typically 440–450 μm in thickness). After washing the printed gels and the cell with IPA three times, the second precursor was introduced into the cell. The cover of the cell with the printed gels was then closed. The second layer was then printed on top of the first-layer gels. After printing the two layers, target structures were formed as described above.

### 3D scanning

The model automobile in Fig. 2m was 3D scanned using a desktop 3D scanner (NextEngine) with the scanning resolution of 150 dots per inch (dpi) and dimensional accuracy of 380 μm. The face in Fig. 4e was 3D scanned using a handheld, portable 3D scanner (3D Systems) with the x–y resolution of 0.9 mm and depth resolution of 1 mm. Point cloud data created from 3D scanning were converted into triangle mesh models and smoothed. Triangle mesh models were then used to compute Ω. The authors affirm that human research participants provided informed consent for publication of the images in Fig. 4e.

## Data availability

The data that support the findings of this study are available within the paper and its Supplementary Information and from the corresponding author upon reasonable request.

## Code availability

BFF is available in ref. 19. Custom code is available in Supplementary Information.

## References

1. Gladman, A. S., Matsumoto, E. A., Nuzzo, R. G., Mahadevan, L. & Lewis, J. A. Biomimetic 4D printing. Nat. Mater. 15, 413–418 (2016).

2. Nojoomi, A., Arslan, H., Lee, K. & Yum, K. Bioinspired 3D structures with programmable morphologies and motions. Nat. Commun. 9, 3705 (2018).

3. Klein, Y., Efrati, E. & Sharon, E. Shaping of elastic sheets by prescription of non-Euclidean metrics. Science 315, 1116–1120 (2007).

4. Kim, J., Hanna, J. A., Byun, M., Santangelo, C. D. & Hayward, R. C. Designing responsive buckled surfaces by halftone gel lithography. Science 335, 1201–1205 (2012).

5. Dervaux, J. & Ben Amar, M. Morphogenesis of growing soft tissues. Phys. Rev. Lett. 101, 068101 (2008).

6. Liang, H. & Mahadevan, L. Growth, geometry, and mechanics of a blooming lily. Proc. Natl Acad. Sci. USA 108, 5516–5521 (2011).

7. Xu, F., Fu, C. & Yang, Y. Water affects morphogenesis of growing aquatic plant leaves. Phys. Rev. Lett. 124, 038003 (2020).

8. Park, S.-J. et al. Phototactic guidance of a tissue-engineered soft-robotic ray. Science 353, 158–162 (2016).

9. Felton, S., Tolley, M., Demaine, E., Rus, D. & Wood, R. A method for building self-folding machines. Science 345, 644–646 (2014).

10. Jamal, M., Zarafshar, A. M. & Gracias, D. H. Differentially photo-crosslinked polymers enable self-assembling microfluidics. Nat. Commun. 2, 527 (2011).

11. Hughes, A. J. et al. Engineered tissue folding by mechanical compaction of the mesenchyme. Dev. Cell 44, 165–178 (2018).

12. Erol, O., Pantula, A., Liu, W. & Gracias, D. H. Transformer hydrogels: a review. Adv. Mater. Technol. 4, 1900043 (2019).

13. Boley, J. W. et al. Shape-shifting structured lattices via multimaterial 4D printing. Proc. Natl Acad. Sci. USA 116, 20856–20862 (2019).

14. van Rees, W. M., Vouga, E. & Mahadevan, L. Growth patterns for shape-shifting elastic bilayers. Proc. Natl Acad. Sci. USA 114, 11597–11602 (2017).

15. Aharoni, H., Xia, Y., Zhang, X., Kamien, R. D. & Yang, S. Universal inverse design of surfaces with thin nematic elastomer sheets. Proc. Natl Acad. Sci. USA 115, 7206–7211 (2018).

16. Konaković, M. et al. Beyond developable: Computational design and fabrication with auxetic materials. ACM Trans. Graph. 35, 89 (2016).

17. Zhang, Y. et al. Printing, folding and assembly methods for forming 3D mesostructures in advanced materials. Nat. Rev. Mater. 2, 17019 (2017).

18. Callens, S. J. P. & Zadpoor, A. A. From flat sheets to curved geometries: origami and kirigami approaches. Mater. Today 21, 241–264 (2018).

19. Sawhney, R. & Crane, K. Boundary first flattening. ACM Trans. Graph. 37, 5 (2017).

20. Sharon, E. & Efrati, E. The mechanics of non-Euclidean plates. Soft Matter 6, 5693–5704 (2010).

21. Arslan, H., Nojoomi, A., Jeon, J. & Yum, K. 3D printing of anisotropic hydrogels with bioinspired motion. Adv. Sci. 6, 1800703 (2019).

22. Kamata, H., Akagi, Y., Kayasuga-Kariya, Y., Chung, U.-I. & Sakai, T. “Nonswellable” hydrogel without mechanical hysteresis. Science 343, 873–875 (2014).

23. do Carmo, M. P. Differential Geometry of Curves and Surfaces. (Dover Publications, New York, 2016).

24. Soliman, Y., Slepcev, D. & Crane, K. Optimal cone singularities for conformal flattening. ACM Trans. Graph. 37, 105 (2018).

25. Springborn, B., Schrder, P. & Pinkall, U. Conformal equivalence of triangle meshes. ACM Trans. Graph. 27, 77 (2008).

26. Sharp, N. & Crane, K. Variational surface cutting. ACM Trans. Graph. 37, 1–13 (2018).

27. Blevins, E. L. & Lauder, G. V. Rajiform locomotion: Three-dimensional kinematics of the pectoral fin surface during swimming by freshwater stingray Potamotrygon orbignyi. J. Exp. Biol. 215, 3231–3241 (2012).

28. Di Santo, V., Blevins, E. L. & Lauder, G. V. Batoid locomotion: Effects of speed on pectoral fin deformation in the little skate, Leucoraja erinacea. J. Exp. Biol. 220, 705–712 (2017).

29. Cangialosi, A. et al. DNA sequence–directed shape change of photopatterned hydrogels via high-degree swelling. Science 357, 1126–1130 (2017).

30. Pikul, J. H. et al. Stretchable surfaces with programmable 3D texture morphing for synthetic camouflaging skins. Science 358, 210–214 (2017).

31. Siéfert, E., Reyssat, E., Bico, J. & Roman, B. Bio-inspired pneumatic shape-morphing elastomers. Nat. Mater. 18, 24–28 (2018).

32. Kumar, S., Aaron, J. & Sokolov, K. Directional conjugation of antibodies to nanoparticles for synthesis of multiplexed optical contrast agents with both delivery and targeting moieties. Nat. Protoc. 3, 314–320 (2008).

## Acknowledgements

We thank R. Sawhney and K. Crane (Carnegie Mellon University) for discussions and assistance with BFF and H. Yang and S. Jose for discussions and technical assistance. This work was supported by the National Science Foundation (NSF) through the NSF CAREER award DMR-1848511.

## Author information

Authors

### Contributions

K.Y. conceived the research. A.N., J.J., and K.Y. designed the experiments. A.N. conducted the experiments. A.N. and K.Y. prepared the manuscript. A.N., J.J., and K.Y. contributed to the data analysis, discussed the results, and commented on the manuscript.

### Corresponding author

Correspondence to Kyungsuk Yum.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

Peer review information Nature Communications thanks David Gracias and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Peer reviewer reports are available.

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

## Rights and permissions

Reprints and Permissions

Nojoomi, A., Jeon, J. & Yum, K. 2D material programming for 3D shaping. Nat Commun 12, 603 (2021). https://doi.org/10.1038/s41467-021-20934-w

• Accepted:

• Published:

• DOI: https://doi.org/10.1038/s41467-021-20934-w

• ### Harnessing the power of chemically active sheets in solution

• Raj Kumar Manna
• Anna C. Balazs

Nature Reviews Physics (2022)

• ### Recent Progress in Shape-Transformable Materials and Their Applications

• Yu-Ki Lee
• Juhee Kim
• In-Suk Choi

Electronic Materials Letters (2022)


text:
mersenneforum.org QUestion about work to do
 Register FAQ Search Today's Posts Mark Forums Read

 2005-10-26, 01:52 #1 JuanTutors     Mar 2004 509 Posts QUestion about work to do I have a second question not related to the first: On primenet: Code: 34696### * 62 ----- 34879### F 62 ----- In worktodo.ini: Code: Test=34696###,62,0 Test=34879###,62,0 My question is, why does one display as a factoring job while the other displays with a "*"?
 2005-10-26, 02:42 #2 JHagerson     May 2005 Naperville, IL, USA 22·72 Posts The "*" indicates to factor, followed immediately by an LL primality test. The "F" might actually mean the same thing. The factor depth limits have been adjusted in the Prime95 application, but I am under the impression that they have not been adjusted on the Primenet server. Therefore, there are some exponents that a "current" Prime95 client (version 24.11 and later) returns as sufficiently factored that the server treats as needing further factoring. You have both exponents assigned to you for LL testing. You may first see a P-1 factoring test, but this will be followed by the LL primality test. The P-1 test attempts to actually find a factor; the LL test is Boolean, it returns not-Prime or Prime. The more memory you can assign to a P-1 test, the more likely the test is to find a factor. An LL test requires relatively little memory. The LL test is completely processor bound. Personal question: Are you dominicanpapi from Project Gutenberg? Either way, welcome aboard!
2005-10-26, 02:45   #3
Prime95
P90 years forever!

Aug 2002
Yeehaw, FL

7,489 Posts

Quote:
 Originally Posted by dominicanpapi82 My question is, why does one display as a factoring job while the other displays with a "*"?
The server reporting tools are pretty buggy.

2005-10-26, 03:08   #4
JuanTutors

Mar 2004

509 Posts

Quote:
 Originally Posted by JHagerson Are you dominicanpapi from Project Gutenberg?
No actually. I actually know over 10 people who have tried to get my name as an AOL/AIM screenname, but alas the name is taken by me!! So I wouldn't be surprised if there are dominicanpapis all over the place. (It was taken for gmail pretty quickly, for example.)

 Similar Threads Thread Thread Starter Forum Replies Last Post Fred PrimeNet 4 2016-04-23 21:47 dann corbit Information & Answers 2 2012-08-21 03:23 jasong NFSNET Discussion 5 2006-05-17 01:42 ixfd64 Hardware 4 2005-11-26 00:33 PhilF Software 7 2005-03-05 08:00

All times are UTC. The time now is 10:45.

Tue May 11 10:45:06 UTC 2021 up 33 days, 5:25, 1 user, load averages: 2.34, 1.79, 1.60