text:
Extension methods vs. Static Class Methods

I’ve taken on a Visual Studio C# project where my previous colleague used a lot of Extension Methods in static classes over multiple files depending on the uses.

In my previous experience I would be more selective when using Extension methods but instead use a public static method in a static class.

It got me thinking if one is better than the other or does it really just come down to flavor or an industry standard that I am unaware of?

Thanks,

iterator class using generator function

It is sometimes necessary for a generator function to expose state. In those situations it is advised to wrap the generator function as method `__iter__` in a class. Here is an example:

``class C:     def __init__(self):         self.next = self.__iter__().__next__     def __iter__(self):         for i in range(4):             yield i                         self.state = i ``

It is convenient to use this in a for loop since the for loop will call iter() on the object, however, the object itself is not an iterator, so you cannot do this:

``c = C() print(next(c)) ``

Which is inconvenient. To get around this inconvenience I have come up with the following class:

``class C:     def __init__(self):         self.next = self.__iter__().__next__     def __iter__(self):         for i in range(4):             yield i                         self.state = i     def __next__(self):         return self.next() ``

Usage example:

``c = C() while 1:     try:         num = next(c)         print(num)         if num == 2:             print("state:", c.state)     except Exception:         break ``

Is this the best way to design the class? I haven’t seen this technique used anywhere else so I’m wondering why everyone else isn’t using it, since the C objects can be used both as iterators and as iterables.

Include class oop php

Мне не совсем понятен один момент с ООП. Если я использую абстрактный класс, и пытаюсь в него подгрузить сторонний класс (не extends), находящийся в другом файле и делаю это через `__construct`, то мне выводится ошибка, `Class 'Foo' not found in ..`. А вот если подключаюсь к файлу в нужном методе, то все ок. Просто выглядит не очень красиво, если использовать по 10 раз в одном файле подключение к одному и тому же файлу, для 10 разных методов. Возможно ли использовать одно подключение в `__construct`-е?

Покажу на примере. Вот такой код выведет ошибку:

``abstract class Name {     public function __construct () {         require_once 'Foo.php';     }      public function func1 () {         \$  foo = new Foo;          // ..     }      public function func2 () {         \$  foo = new Foo;          // ..     }      // и т.д. } ``

А вот этот пример отлично отработает:

``abstract class Name {     public function __construct () {         // ..     }      public function func1 () {         require_once 'Foo.php';         \$  foo = new Foo;          // ..     }      public function func2 () {         require_once 'Foo.php';         \$  foo = new Foo;          // ..     }      // и т.д. } ``

Подскажите пожалуйста, в чем собственно причина?

The situation

I am porting a legacy library from `CoDeSys` to QT. As I frequently have to deal with hardware related stuff like CAN messages (or other stuff), that contain a byte field for payload, I used a well-working class in the legacy system that allows for a nice manipulation of bits and bytes. As a base I used a stupid array of bytes over there to store the bytes. I had numerous methods like `GetBoolOnBit()`, `SetRawByte()`, `SetByteOnBit()`, `SetU32()` and stuff like that to provide a very well-typed access to the storage.

I started to bring similar functionality to my `QT` library and am looking for some feedback on my approach. I want to store the Data in a `QByteArray` (unless no one has a better suggestion) and I have written two basic methods to access the data, namely `setByteOnBit()` as well as `getByteOnBit()`.

My concern(s)

Overall, handling of bits and bytes does look a bit complicated to me at the moment. I am not really unhappy with my code so far but where in CoDeSys I simply had to do some stupid bit shifting here and there, in Qt I need a slightly higher amount of lines of code. Maybe you have suggestions to thin my code a bit.

Code

Note that the code does not contain any input guards regarding sizes so far. This is intended as I first wanted to show my working outcome.

mybytecollection.h

``#ifndef MYBYTECOLLECTION_H #define MYBYTECOLLECTION_H  #include "myutilities_global.h"  class UTILSLIBSHARED_EXPORT MyByteCollection { public:     MyByteCollection(const int size);     ~MyByteCollection();      int size();      bool setByteOnBit(const int bitPosition, const quint8 value);     quint8 getByteOnBit(const int bitPosition);  private:     QByteArray* mBa = nullptr; };  #endif // MYBYTECOLLECTION_H ``

mybytecollection.cpp

``#include "mybytecollection.h" #include <QBitArray> #include <QDataStream>  MyByteCollection::MyByteCollection(const int size) {     mBa = new QByteArray(size, 0x00); }  MyByteCollection::~MyByteCollection() {     delete mBa;     mBa = nullptr; }  int MyByteCollection::size() {     return mBa != nullptr ? mBa->size() : 0; }  bool MyByteCollection::setByteOnBit(const int bitPosition, const quint8 value) {     if (mBa != nullptr) {         // bit manipulation in 16 bits to fit in. Manipulate two bitarrays and finally re-inserting         int byteIndex = bitPosition / 8;         int bitPositionInBitArray = bitPosition % 8;         QByteArray workingBytes(mBa->mid(byteIndex, 2));         quint16 mask = static_cast<unsigned short>(0xFFFFFFFF);         mask >>= bitPositionInBitArray;         mask <<= 8;         mask >>= 8 - bitPositionInBitArray;         mask = ~mask;          quint16 bits = value;         bits <<= bitPositionInBitArray;          // weird shifting, unable to shift the whole QbyteArray         quint16 lowByte = static_cast<quint16>(workingBytes[0]);         quint16 highByte = static_cast<quint16>(workingBytes[1]);         lowByte >>= bitPositionInBitArray;         highByte <<= 8 - bitPositionInBitArray;         quint16 result = static_cast<quint16>(lowByte | highByte);         result &= mask;         result |= bits;          workingBytes.clear();         QDataStream out(&workingBytes, QIODevice::WriteOnly | QIODevice::Append);         out.setByteOrder(QDataStream::LittleEndian);         out << result;         mBa->replace(byteIndex, 2, workingBytes);         return true;     }     return false; }  quint8 MyByteCollection::getByteOnBit(const int bitPosition) {     if (mBa != nullptr) {          // getting 16 bits from bytes and shifting magic to finally return a byte         int byteIndex = bitPosition / 8;         int bitPositionInBitArray = bitPosition % 8;         QByteArray workingBytes(mBa->mid(byteIndex, 2));          // weird shifting, unable to shift the whole QbyteArray         quint16 lowByte = static_cast<quint16>(workingBytes[0]);         quint16 highByte = static_cast<quint16>(workingBytes[1]);         lowByte >>= bitPositionInBitArray;         highByte <<= 8 - bitPositionInBitArray;         quint16 result = static_cast<quint16>(lowByte | highByte);         return static_cast<quint8>(result);     }     return 0; } ``

Base class for implementing IComparable

If I create a class that implements `IComparable<T>`, I must implement `CompareTo<T>`. It is also recommended that I implement `IEquatable<T>` and the non-generic `IComparable`. If I do all that, I am required or encouraged to:

• Override `GetHashCode()`
• Implement `CompareTo(Object)`
• Override `Equals(Object)`
• Implement `Operator ==(T, T)`
• Implement `Operator !=(T, T)`
• Implement `Operator >(T, T)`
• Implement `Operator <(T, T)`
• Implement `Operator >=(T, T)`
• Implement `Operator <=(T, T)`

That’s 9 additional methods, most of which depend on the logic that compares two instances of the class. Rather than having to implement all those methods in any class that implements `IComparable<T>`, I decided to create a base class that implements `IComparable<T>` and the other recommended interfaces (similar to the way Microsoft provides `Comparer` as a base class for implementations of `IComparer<T>`)

It doesn’t make sense to compare instances of two different classes that each inherit from the base class. preventing that was the main reason for making the class generic (although it makes coding a derived class a little more complicate).

I would like to ask for a review of the code for the base class. Am I missing something? Can it be simplified? Is this a bad idea?

Here is the base class

``public abstract class Comparable<T> : IComparable, IComparable<T>, IEquatable<T> where T: Comparable<T> {     public abstract override int GetHashCode();      public abstract int CompareTo(T other);      public int CompareTo(object obj) {         T other = obj as T;         if (other == null && obj != null) {             throw new ArgumentException(\$  "Objects of type {typeof(T).Name} can only be compared to objects of the same type", nameof(obj));         }         return CompareTo(other);     }      public override bool Equals(object obj) {         return CompareTo(obj) == 0;     }      new public bool Equals(T other) {         return CompareTo(other) == 0;     }      private static int Compare(Comparable<T> comp1, Comparable<T> comp2) {         if (comp1 == null) {             return ((comp2 == null) ? 0 : -1);         }         return comp1.CompareTo(comp2);     }      public static bool operator == (Comparable<T> comp1, Comparable<T> comp2) {         return Compare(comp1, comp2) == 0;     }      public static bool operator != (Comparable<T> comp1, Comparable<T> comp2) {         return Compare(comp1, comp2) != 0;     }      public static bool operator > (Comparable<T> comp1, Comparable<T> comp2) {         return Compare(comp1, comp2) > 0;     }      public static bool operator < (Comparable<T> comp1, Comparable<T> comp2) {         return Compare(comp1, comp2) < 0;     }      public static bool operator >= (Comparable<T> comp1, Comparable<T> comp2) {         return Compare(comp1, comp2) >= 0;     }      public static bool operator <= (Comparable<T> comp1, Comparable<T> comp2) {         return Compare(comp1, comp2) <= 0;     } } ``

Below is a minimal implementation of the base class.

``public class SeasonCompare : Comparable<SeasonCompare> {     public int Number {get; set;}      public override int GetHashCode() {         return Number;     }      public override int CompareTo(SeasonCompare other) {         if (other == null) {             return 1;         }         return Number.CompareTo(other.Number);     } } ``

Do the class vector and character vector of a \$p\$-group determine each other?

To a finite $$p$$-group, we can associate two vectors $$(v_0,v_1,\dotsc)$$:

1. The class vector – $$v_i$$ is the number of conjugacy classesof order $$p^i$$.

2. The character vector – $$v_i$$ is the number of complex irreducible representations of dimension $$i$$ up to isomorphism.

Question: Do these two invariants of the group determine each other? In other words, if two groups have the same class vector, do they have the same character vector and vice versa?

Getting “this class is not key value coding-compliant for the key backGroundView.'” when adding view from xib to scrollview

add ScrollView is for creating scrollview

``  func addScrollView() {     self.scrollView.frame = CGRect(x: 0, y: 150, width: self.view.bounds.size.width, height: height)     self.scrollView.contentSize = CGSize(width: height * 3, height: self.view.bounds.size.width)     scrollView.isPagingEnabled = true     scrollView.backgroundColor = .orange     self.view.addSubview(scrollView)      var y = CGFloat(0.0)      for i in 0..<24 {         let customView = self.createCustomView(index: i)         customView.frame = CGRect(x: 0, y: y, width: 320, height: 200)         self.scrollView.addSubview(customView)          y += height     } } ``

Here create custom view function is used to add custom subviews according to loop

``func createCustomView(index: Int) -> UIView {      let eventView: EventView = Bundle.main.loadNibNamed("EventView", owner: self, options: nil)![0] as! EventView      if index == 0{         eventView.backgroundColor = UIColor.green     }      if index == 1{         eventView.backgroundColor = UIColor.red     }      return eventView } ``

Deciding complexity class of a TM s.t M(0) = accept

Below is a sample of 2 homework TM where Im not sure what complexity class they fit in. Also have to decide the complexity class of the complement. These 2 in particular confuse me because I got a different answer so I feel I may be missing something:

S = { : M is a TM s.t. M(0) = accept} U = { : M is a TM s.t. M(0)[20000] = accept}

The options are P, NP, coNP, EXP, Decidable, Recognizable, lang (all strings).

S: I read this as ‘M checks if the input is 0, if yes accept’. My first instinct is that S is in P as it simply checks the if the input is 0 which is a single operation, so I would say it can be solved in polynomial time. Someone else decided RE for S and lang for S complement respectively, which I just dont understand if correct.

U: I read this same as S, but runs (to a maximum of?) 2000 steps. I’d also place this in P for both U and its complement. Other answer is P as well but I don’t see how the addendum of 2000 makes a difference.

Thanks for any clarification.

Hints about analyzing single (huge) C# class using SonarQube and related issues

I’m doing an internship into a small company which is working on part of a systems which runs on a base already written by another company (many company are working on the same project) which is basically a 1:1 translation from an old COBOL system into .NET technology. Since they have not been given enough time, they’re literally running producing as much working code as possible, so the code quality is not elevated. The objective of my internship is to produce a graduate thesis following my work in this little company, and will be based on refactoring some functions or classes (between those being developed in this small company) following the baselines of software engineering (patterns mainly), the branch to whom my thesis is related.

To underline the results of this work, my professor told me to use a static code analyzer such SonarQube or Kiuwan, I already configured and hosted on Amazon AWS a functioning SonarQube 7.4 server.

At this point of my work the question is: how can I analyze just this single class alone? Pro and Cons.

I’m in front of 2 choices:

1) Create a project in Visual Studio to make this class self-sustaining full of stubs and mocks to make it live by itself with the pourpose of being analyzed before and after the re-engineering.

–> The main issue with this option is that this class on which I am working is made of about 12000 lines of code, so it’s easy to think that it refers to many many other classes, thus creating stubs and mocks would be a pain…

2) Use an integrated feature in SonarQube, which should let exclude whole folders or analyze just selected files/folders.

–> I already analyzed the whole project, made of about 350k lines of code using the default SonarQube rules, it gave me a result in everyone of it’s fields (quality, bugs, security…), the problem is that even modifing and making this class (on which I am working) a diamond of engeneering, it wouldn’t change much the overall quality of the software (obviously).

The structure:

The project has three indipendent branches: Backend, Client, and DB communications, I’m working in the Backend part.

The Backend got its own `.sln` file (the one I used for the whole analysis of the project in SonarQube), which links to `.csproj` subprojects. I feeded SonarQube one of these `.csproj` and it was able to analyze it.

Applying option 2 :

In the Sonar server in the preferences of the project, there’s a tab in which you can exclude what you DON’T want to be analyzed and INCLUDE JUST what you want to analyze. Since I was interested in the second option, I inserted in the field `sonar.inclusions` the name of the class I want to be analyzed, then I builded the project, sent the blob to SonarQube server, which analyzed it and…nothing happened, in the project page of Sonar just appeared “No project Analyzed yet”.

So my questions are:

Question 1) Should I follow this way of analyzing a single class with SonarQube? By directly feeding it from the original bug project, or is it better to extract the class, place it into a new project and fulfill it with stubs and mocks? Considering the complexity of doing this.

Question 2) Following what I wrote above, how can make sonar analyze just the class I feeded? Is practically possible to do it? What did I do wrong?

I posted the same question to stackoverflow, but they told me to post it here!

PHP Class – get current request

my first question at stackoverflow:

I have a class that loads JSON data.

I request data from outside the class with eg:

echo \$ class->country->name

echo \$ class->country->timezone

echo \$ class->country->population

Now I need to check if the requested properties do exist and if there is a valid value. As there are hundreds of properties I try to find a way to check the requested properties (country, name – country, timezone – country, population) per request within the class.

Thank you, harry_bo


text:
# Quantum -- Will the probability to provide a negative value of a Sz 1/2 spin system always be 0?

ellenb899
Homework Statement:
Will the probability to provide a negative value of a Sz 1/2 spin system always be 0? If lambda 1 = hbar/2 and lambda 2 = -h bar/2 ?
Relevant Equations:
P1(Sz = hbar/2) = |c1|^2
Will the probability to provide a negative value of a Sz 1/2 spin system always be 0? If lambda 1 = hbar/2 and lambda 2 = -h bar/2 ?

Mentor
The question is not clear. Can you post the full statement?

Also, PhysicsForums requires you to provide an attempt at a solution.

vanhees71
ellenb899
Given particle in spin state: wavefunction in bra-ket notation = 3N|1> + i4N|2> (1/2 spin state in z axis)

Q. What is the probability that a measurement of Sz will provide negative value?

My attempt at solution is using the equation I provided, a negative value cannot be obtained as it must be squared. Is this correct?

Mentor
Probabilities are always positive or zero, but it has nothing to do with the sign of what will be measured.

In other words, the question asks for the probability of measuring the spin as spin-down.

Given particle in spin state: wavefunction in bra-ket notation = 3N|1> + i4N|2> (1/2 spin state in z axis)
I don't understand what the states ##\ket{1}## and ##\ket{2}## correspond to.

I guess you will also have to figure out what the value of ##N## is.

Gold Member
2022 Award
For a spin 1/2 the eigenvalues of ##\sigma_z## are ##\pm \hbar/2##. A general state is
$$|\psi \rangle = a |\hbar/2 \rangle+ b|-\hbar/2 \rangle, \quad |a|^2+|b|^2=1.$$
The probability to find ##+\hbar/2## when measuring ##\sigma_z## is
$$P(+\hbar/2)=|a|^2,$$
and the probability to find ##-\hbar/2## is
$$P(-\hbar/2)=|b|^2.$$
So what's the question?

PS: For writing readable math, it's most convenient to use LaTeX. Just check the "LaTeX Guide" link below the entry form:

https://www.physicsforums.com/help/latexhelp/

format: plain


text:
Show Summary Details
More options …

# Analysis

### International mathematical journal of analysis and its applications

Editor-in-Chief: Schulz, Friedmar

4 Issues per year

Cite Score 2016: 0.65

SCImago Journal Rank (SJR) 2016: 0.125
Source Normalized Impact per Paper (SNIP) 2016: 3.360

Mathematical Citation Quotient (MCQ) 2016: 0.34

Online
ISSN
2196-6753
See all formats and pricing
More options …
Volume 36, Issue 1

# The generalized hypergeometric function as the Meijer G-function

Anatoly A. Kilbas
/ Ram K. Saxena
/ Megumi Saigo
/ Juan J. Trujillo
• Corresponding author
• Departamento de Análisis Matemático, Universidad de La Laguna, La Laguna, Tenerife 38271, Spain
• Email
• Other articles by this author:
• De Gruyter OnlineGoogle Scholar
Published Online: 2015-09-03 | DOI: https://doi.org/10.1515/anly-2015-5001

## Abstract

In this paper, we use the representation of the generalized hypergeometric function ${\phantom{\rule{0.166667em}{0ex}}}_{p}{F}_{q}$ in terms of the known Meijer G-function to extend the range of parameters of such a special function so it be convergent. Also, we establish the corresponding series representation for such an extension. In particular, we extend the hypergeometric functions ${\phantom{\rule{0.166667em}{0ex}}}_{2}{F}_{1}$ and ${\phantom{\rule{0.166667em}{0ex}}}_{3}{F}_{2}$ from $|z|<1$ to $|z|>1$. Moreover, we obtain asymptotic formulas to estimate the extended ${\phantom{\rule{0.166667em}{0ex}}}_{p}{F}_{q}$ at infinity.

MSC: 33C60; 33C20; 33C05; 41A60

## About the article

Accepted: 2015-03-20

Published Online: 2015-09-03

Published in Print: 2016-02-01

Funding Source: Belarusian Fundamental Research Fund

Award identifier / Grant number: F03MC-008

Funding Source: Universidad de La Laguna

Funding Source: University Grants Commission of India

Citation Information: Analysis, Volume 36, Issue 1, Pages 1–14, ISSN (Online) 2196-6753, ISSN (Print) 0174-4747,

Export Citation

© 2016 by De Gruyter.


text:
Sofia Aligizaki

### Sofia Aligizaki

Περισσότερες ιδέες από το Sofia

Dark gray animal prints nail art design. A strong looking nail art design with matter dark gray polish plus white polish under a series of black and dark gray animal prints painted on top.

they are so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so

Stephanie Rochester @_stephsnails_ CoralFloral #cora...Instagram photo | Websta (Webstagram)

Santorini Island in Greece. This is the main town called "Phira".

santorini, greece

Pink Sunset in Oia, Santorini by Katarina Mansson

Our own Damon O'Donnell is planning to see Santorini, Greece this year.


text:
## Another Trig Identity

$$1 - \frac{\cos^2 \theta}{1 + \sin^2 \theta} = \sin \theta$$

I can only get to $$\frac{2\sin^2 \theta}{1 + \sin^2 \theta}$$ and I don't know if that's correct.

 PhysOrg.com science news on PhysOrg.com >> 'Whodunnit' of Irish potato famine solved>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change>> Curiosity Mars rover drills second rock target
 Recognitions: Homework Help Perhaps you should check the problem again because it doesn't seem correct to me. Try $\theta = 3\pi /2$, the LHS will be 1 while the RHS is -1.
 Recognitions: Homework Help It's not an identity! Let θ = -π/2 then lhs = 1 - cos²(-π/2)/(1 + sin²(-π/2)) lhs = 1 - 0/2 lhs = 1 ===== but rhs = sin(-π/2) = -sin(π/2) = -1 rhs = - 1 ======= Since lhs ≠ rhs, it can't be an identity.

## Another Trig Identity

OMG, I've spent so much time trying to figure it out... I never thought of checking to make sure it was indeed an identity. I guess my teacher made a mistake. Thanks guys.

(Don't worry, I'll be back with another too soon )

 Recognitions: Homework Help I did a quick check to see if it was an identity. After all , you were having trouble ! It checked out ok for θ = 0 and θ = pi/2, so I did some work on it. It was only later on that I plugged the expressions into graphmatica and found out they were actually two different functions !!
 $$\frac{1 - \sin \theta}{\cos \theta} + \frac{\cos \theta}{1 - \sin \theta} = 2 \sec \theta$$ $$\frac{1 - \sin \theta}{1 + \sin \theta} = (\sec \theta - \tan \theta)^2$$ I can't seem to get anywhere with these...
 Recognitions: Homework Help For the 1st one, cross-multiply the two terms in the lhs and simplify.
 Recognitions: Homework Help For the 2nd one, multiply the lhs by (1 - sinθ) and simplify.
 I can only get to $2 \sin \theta + 2 \sin^2 \theta$ for the first after cross multiplying. For the second, how can I just multiply by $(1 - \sin \theta)$? I thought you can only multiply by 1?

Recognitions:
Gold Member
Homework Help
 Quote by cscott $$\frac{1 - \sin \theta}{\cos \theta} + \frac{\cos \theta}{1 - \sin \theta} = 2 \sec \theta$$ $$\frac{1 - \sin \theta}{1 + \sin \theta} = (\sec \theta - \tan \theta)^2$$ I can't seem to get anywhere with these...
$$\frac{1 - \sin \theta}{\cos \theta} + \frac{\cos \theta}{1 - \sin \theta}=\frac{1 - \sin \theta}{\cos \theta}+\frac{1+\sin\theta}{1+\sin\theta}\frac{\cos\theta}{1-\sin\theta}=\frac{1 - \sin \theta}{\cos \theta} +\frac{1+\sin\theta}{\cos\theta}=\frac{2}{\cos\theta}=2sec\theta$$

$$\frac{1 - \sin \theta}{1 + \sin \theta} =\frac{1-\sin\theta}{1-\sin\theta}\frac{1-\sin\theta}{1+\sin\theta}=\frac{(1-\sin\theta)^{2}}{\cos^{2}\theta}=(sec\theta-tan\theta)^{2}$$

 I see, thanks.

Recognitions:
Homework Help
 Quote by cscott I can only get to $2 \sin \theta + 2 \sin^2 \theta$ for the first after cross multiplying. For the second, how can I just multiply by $(1 - \sin \theta)$? I thought you can only multiply by 1?
Ah, sorry, that should have been, multiply above and below by (1 - sinθ)


text:
# fix bond/create command

## Syntax

fix ID group-ID bond/create Nevery itype jtype Rmin bondtype keyword values ...

• ID, group-ID are documented in fix command

• bond/create = style name of this fix command

• Nevery = attempt bond creation every this many steps

• itype,jtype = atoms of itype can bond to atoms of jtype

• Rmin = 2 atoms separated by less than Rmin can bond (distance units)

• bondtype = type of created bonds

• zero or more keyword/value pairs may be appended to args

• keyword = iparam or jparam or prob or atype or dtype or itype

iparam values = maxbond, newtype
maxbond = max # of bonds of bondtype the itype atom can have
newtype = change the itype atom to this type when maxbonds exist
jparam values = maxbond, newtype
maxbond = max # of bonds of bondtype the jtype atom can have
newtype = change the jtype atom to this type when maxbonds exist
prob values = fraction seed
fraction = create a bond with this probability if otherwise eligible
seed = random number seed (positive integer)
atype value = angletype
angletype = type of created angles
dtype value = dihedraltype
dihedraltype = type of created dihedrals
itype value = impropertype
impropertype = type of created impropers

## Examples

fix 5 all bond/create 10 1 2 0.8 1
fix 5 all bond/create 1 3 3 0.8 1 prob 0.5 85784 iparam 2 3
fix 5 all bond/create 1 3 3 0.8 1 prob 0.5 85784 iparam 2 3 atype 1 dtype 2

## Description

Create bonds between pairs of atoms as a simulation runs according to specified criteria. This can be used to model cross-linking of polymers, the formation of a percolation network, etc. In this context, a bond means an interaction between a pair of atoms computed by the bond_style command. Once the bond is created it will be permanently in place. Optionally, the creation of a bond can also create angle, dihedral, and improper interactions that bond is part of. See the discussion of the atype, dtype, and itype keywords below.

This is different than a pairwise bond-order potential such as Tersoff or AIREBO which infers bonds and many-body interactions based on the current geometry of a small cluster of atoms and effectively creates and destroys bonds and higher-order many-body interactions from timestep to timestep as atoms move.

A check for possible new bonds is performed every Nevery timesteps. If two atoms I,J are within a distance Rmin of each other, if I is of atom type itype, if J is of atom type jtype, if both I and J are in the specified fix group, if a bond does not already exist between I and J, and if both I and J meet their respective maxbond requirement (explained below), then I,J is labeled as a “possible” bond pair.

If several atoms are close to an atom, it may have multiple possible bond partners. Every atom checks its list of possible bond partners and labels the closest such partner as its “sole” bond partner. After this is done, if atom I has atom J as its sole partner, and atom J has atom I as its sole partner, then the I,J bond is “eligible” to be formed.

Note that these rules mean an atom will only be part of at most one created bond on a given timestep. It also means that if atom I chooses atom J as its sole partner, but atom J chooses atom K is its sole partner (due to Rjk < Rij), then this means atom I will not form a bond on this timestep, even if it has other possible bond partners.

It is permissible to have itype = jtype. Rmin must be <= the pairwise cutoff distance between itype and jtype atoms, as defined by the pair_style command.

The iparam and jparam keywords can be used to limit the bonding functionality of the participating atoms. Each atom keeps track of how many bonds of bondtype it already has. If atom I of itype already has maxbond bonds (as set by the iparam keyword), then it will not form any more. Likewise for atom J. If maxbond is set to 0, then there is no limit on the number of bonds that can be formed with that atom.

The newtype value for iparam and jparam can be used to change the atom type of atom I or J when it reaches maxbond number of bonds of type bondtype. This means it can now interact in a pairwise fashion with other atoms in a different way by specifying different pair_coeff coefficients. If you do not wish the atom type to change, simply specify newtype as itype or jtype.

The prob keyword can also effect whether an eligible bond is actually created. The fraction setting must be a value between 0.0 and 1.0. A uniform random number between 0.0 and 1.0 is generated and the eligible bond is only created if the random number < fraction.

Any bond that is created is assigned a bond type of bondtype

When a bond is created, data structures within LAMMPS that store bond topology are updated to reflect the creation. If the bond is part of new 3-body (angle) or 4-body (dihedral, improper) interactions, you can choose to create new angles, dihedrals, impropers as well, using the atype, dtype, and itype keywords. All of these changes typically affect pairwise interactions between atoms that are now part of new bonds, angles, etc.

Note

One data structure that is not updated when a bond breaks are the molecule IDs stored by each atom. Even though two molecules become one molecule due to the created bond, all atoms in the new molecule retain their original molecule IDs.

If the atype keyword is used and if an angle potential is defined via the angle_style command, then any new 3-body interactions inferred by the creation of a bond will create new angles of type angletype, with parameters assigned by the corresponding angle_coeff command. Likewise, the dtype and itype keywords will create new dihedrals and impropers of type dihedraltype and impropertype.

Note

To create a new bond, the internal LAMMPS data structures that store this information must have space for it. When LAMMPS is initialized from a data file, the list of bonds is scanned and the maximum number of bonds per atom is tallied. If some atom will acquire more bonds than this limit as this fix operates, then the “extra bond per atom” parameter must be set to allow for it. Ditto for “extra angle per atom”, “extra dihedral per atom”, and “extra improper per atom” if angles, dihedrals, or impropers are being added when bonds are created. See the read_data or create_box command for more details. Note that a data file with no atoms can be used if you wish to add unbonded atoms via the create atoms command, e.g. for a percolation simulation.

Note

LAMMPS stores and maintains a data structure with a list of the 1st, 2nd, and 3rd neighbors of each atom (within the bond topology of the system) for use in weighting pairwise interactions for bonded atoms. Note that adding a single bond always adds a new 1st neighbor but may also induce *many* new 2nd and 3rd neighbors, depending on the molecular topology of your system. The “extra special per atom” parameter must typically be set to allow for the new maximum total size (1st + 2nd + 3rd neighbors) of this per-atom list. There are 2 ways to do this. See the read_data or create_box commands for details.

Note

Even if you do not use the atype, dtype, or itype keywords, the list of topological neighbors is updated for atoms affected by the new bond. This in turn affects which neighbors are considered for pairwise interactions, using the weighting rules set by the special_bonds command. Consider a new bond created between atoms I,J. If J has a bonded neighbor K, then K becomes a 2nd neighbor of I. Even if the atype keyword is not used to create angle I-J-K, the pairwise interaction between I and K will be potentially turned off or weighted by the 1-3 weighting specified by the special_bonds command. This is the case even if the “angle yes” option was used with that command. The same is true for 3rd neighbors (1-4 interactions), the dtype keyword, and the “dihedral yes” option used with the special_bonds command.

Note that even if your simulation starts with no bonds, you must define a bond_style and use the bond_coeff command to specify coefficients for the bondtype. Similarly, if new atom types are specified by the iparam or jparam keywords, they must be within the range of atom types allowed by the simulation and pairwise coefficients must be specified for the new types.

Computationally, each timestep this fix operates, it loops over neighbor lists and computes distances between pairs of atoms in the list. It also communicates between neighboring processors to coordinate which bonds are created. Moreover, if any bonds are created, neighbor lists must be immediately updated on the same timestep. This is to insure that any pairwise interactions that should be turned “off” due to a bond creation, because they are now excluded by the presence of the bond and the settings of the special_bonds command, will be immediately recognized. All of these operations increase the cost of a timestep. Thus you should be cautious about invoking this fix too frequently.

You can dump out snapshots of the current bond topology via the dump local command.

Note

Creating a bond typically alters the energy of a system. You should be careful not to choose bond creation criteria that induce a dramatic change in energy. For example, if you define a very stiff harmonic bond and create it when 2 atoms are separated by a distance far from the equilibribum bond length, then the 2 atoms will oscillate dramatically when the bond is formed. More generally, you may need to thermostat your system to compensate for energy changes resulting from created bonds (and angles, dihedrals, impropers).

Restart, fix_modify, output, run start/stop, minimize info:

No information about this fix is written to binary restart files. None of the fix_modify options are relevant to this fix.

This fix computes two statistics which it stores in a global vector of length 2, which can be accessed by various output commands. The vector values calculated by this fix are “intensive”.

These are the 2 quantities:

1. # of bonds created on the most recent creation timestep
1. cumulative # of bonds created

No parameter of this fix can be used with the start/stop keywords of the run command. This fix is not invoked during energy minimization.

## Restrictions

This fix is part of the MC package. It is only enabled if LAMMPS was built with that package. See the Making LAMMPS section for more info.

## Default

The option defaults are iparam = (0,itype), jparam = (0,jtype), and prob = 1.0.


text:
Thread: Llinear transformations: Help with proving linear independency

1. Llinear transformations: Help with proving linear independency

Hi guys.

I had the following statement to prove:

Let $\varphi :V\rightarrow W$ be a linear transformation, and $v_1, v_2,...v_n\in V$ a set of vectors.
If $v_1, v_2,...v_n$ are linear independent, and $\varphi$ is one-to-one, then $\varphi(v_1), \varphi(v_2),...,\varphi(v_n)$ are also linear independent.

that's how I proved it:
$v_1, v_2,...v_n$ are linear independent, so if:

$\alpha_1 v_1+\alpha_2 v_2+...+\alpha_nv_n=0$

then: $\alpha_1=\alpha_2=...=\alpha_n=0$

now, since $\varphi$ is a linear transformation, it holds that $\varphi(\vec{0}_V)=\vec{0}_W$, therefore:

$\varphi(\vec{0}_V)=\varphi(\alpha_1 v_1+\alpha_2 v_2+...+\alpha_nv_n)=$
$\alpha_1\varphi(v_1)+\alpha_2\varphi(v_2)+...+ \alpha_n\varphi(v_n)=\vec{0}_W$

and since we know that $\alpha_1=\alpha_2=...=\alpha_n=0$, then $\varphi(v_1), \varphi(v_2),...,\varphi(v_n)$ are linear independent.

my question here is: why should I care that $\varphi$ is one-to-one?

any help would be greatly appreciated.

2. Re: Llinear transformations: Help with proving linear independency

Originally Posted by Stormey
Let $\varphi :V\rightarrow W$ be a linear transformation, and $v_1, v_2,...v_n\in V$ a set of vectors.
If $v_1, v_2,...v_n$ are linear independent, and $\varphi$ is one-to-one, then $\varphi(v_1), \varphi(v_2),...,\varphi(v_n)$ are also linear independent.

now, since $\varphi$ is a linear transformation, it holds that $\varphi(\vec{0}_V)=\vec{0}_W$, therefore:

$\varphi(\vec{0}_V)=\varphi(\alpha_1 v_1+\alpha_2 v_2+...+\alpha_nv_n)=$
$\alpha_1\varphi(v_1)+\alpha_2\varphi(v_2)+...+ \alpha_n\varphi(v_n)=\vec{0}_W$

and since we know that $\alpha_1=\alpha_2=...=\alpha_n=0$, then $\varphi(v_1), \varphi(v_2),...,\varphi(v_n)$ are linear independent.

my question here is: why should I care that $\varphi$ is one-to-one?

any help would be greatly appreciated.
What you did is not a proof.
You should start with, suppose that $\alpha_1\varphi(v_1)+\alpha_2\varphi(v_2)+...+ \alpha_n\varphi(v_n)=\vec{0}_W$
From which you must show that each $\alpha_k$ must equal zero.

Now as you said $\varphi(\vec{0}_V)=\varphi(\alpha_1 v_1+\alpha_2 v_2+...+\alpha_nv_n)$ is also that sum.

But that means $\vec{0}_V=\alpha_1 v_1+\alpha_2 v_2+...+\alpha_nv_n$ because $\varphi$ is one-to-one.

Are you done? Why?

3. Re: Llinear transformations: Help with proving linear independency

Hi Plato, and thanks for the help.

Yeah, we're done, if $\vec{0}_V=\alpha_1 v_1+\alpha_2 v_2+...+\alpha_nv_n$, then $\alpha_1=\alpha_2=...=\alpha_n=0$
because $v_1, v_2,...v_n$ are linear independent, and therefore $\varphi(v_1), \varphi(v_2),...,\varphi(v_n)$ are linear independent.

what was wrong with mine?
why doesn't it considered a valid proof?

4. Re: Llinear transformations: Help with proving linear independency

Originally Posted by Stormey
what was wrong with mine?
why doesn't it considered a valid proof?
You started out with what you wanted to prove. So you went nowhere.
That is why you never had to use one-to-one.
You are to show that $\left\{ {\varphi ({v_k})} \right\}_{k = 1}^n$ is an independent set.
So you start with a linear combination equaling the zero vector. Not the other way round.


text:
1. ## Probability

There are two players playing named John and Peter. The one who wins three games first is the winner of the match. So the max no. of games needed is 5. And John has probability of winning is 0.6 and assume that all games are independent.

(a)Given that John has lost the first two games, Find the probability so that he can still be the winner of the match?
(b) Given that John lost the first game, Find the probability that John will still be the winner?
(c) Find the probability that the number of games needed is exactly 5?

Sorry for so many questions but I have tried a lot and am unable to answer!

2. Originally Posted by santatrue
There are two players playing named John and Peter. The one who wins three games first is the winner of the match. So the max no. of games needed is 5. And John has probability of winning is 0.6 and assume that all games are independent.
(a)Given that John has lost the first two games, Find the probability so that he can still be the winner of the match?
(b) Given that John lost the first game, Find the probability that John will still be the winner?
(c) Find the probability that the number of games needed is exactly 5?
For part (a), what is the probability of this string, PPJJJ?

For part (b), what is the probability of each of these strings, PJJJ, PPJJJ, PJPJJ, PJJPJ? [Add these four.]

For part (c), what is the probability of each of these strings, PPJJJ, PJPJJ, PJJPJ, JPPJJ, JPJPJ, JJPPJ, JJPPP, JPJPP, JPPJP, PJJPP, PPJJP, PJPJP? [Add these 12.]

3. Originally Posted by Plato
For part (a), what is the probability of this string, PPJJJ?

For part (b), what is the probability of each of these strings, PJJJ, PPJJJ, PJPJJ, PJJPJ? [Add these four.]

For part (c), what is the probability of each of these strings, PPJJJ, PJPJJ, PJJPJ, JPPJJ, JPJPJ, JJPPJ, JJPPP, JPJPP, JPPJP, PJJPP, PPJJP, PJPJP? [Add these 12.]
isnt is suppose to be Conditional Probability or you can also do this way

4. Originally Posted by santatrue
isnt is suppose to be Conditional Probability
I used Conditional Probability!
Given John looses the first two means that Peter wins the first two.
Look at it this way, Conditional Probability just restricts our attention to a subset of the outcome space.

5. Originally Posted by santatrue
There are two players playing named John and Peter. The one who wins three games first is the winner of the match. So the max no. of games needed is 5. And John has probability of winning is 0.6 and assume that all games are independent.

(a)Given that John has lost the first two games, Find the probability so that he can still be the winner of the match?
(b) Given that John lost the first game, Find the probability that John will still be the winner?
(c) Find the probability that the number of games needed is exactly 5?

Sorry for so many questions but I have tried a lot and am unable to answer!
(a) The Propability is $\displaystyle \frac{PPJJJ}{PP}$ = $\displaystyle JJJ$

(b) $\displaystyle JJJPx4$ = $\displaystyle 4(0.6)^3(0.4)$

(c) $\displaystyle 6(0.6)^3(0.4)^2+6(0.6)^2(0.4)^3$

6. Originally Posted by Plato
I used Conditional Probability!
Given John looses the first two means that Peter wins the first two.
Look at it this way, Conditional Probability just restricts our attention to a subset of the outcome space.
So shouldnt it be for the first question to find for JJJ only , why PP as he has already won

7. Originally Posted by santatrue
So shouldnt it be for the first question to find for JJJ only , why PP as he has already won
He was Wrong
If
A = The Probability that Paul wins the first 2 games.
B = The probaility that John wins overall.

Then the probability of B given A is:
P(B|A) = $\displaystyle \frac{P(A and B)}{P(A)}$= $\displaystyle \frac{PPJJJ}{PP}$ = $\displaystyle \frac{(0.4)^2(0.6)^3}{(0.4)^2}$ = $\displaystyle 0.6^3$

8. Originally Posted by santatrue
So shouldnt it be for the first question to find for JJJ only , why PP as he has already won
Sorry that I did not make it clear that you do indeed divide by the given probability. I see how I misslead you.


text:
94-81 del Rio R., Makarov N., Simon B.
Operators with Singular Continuous Spectrum, II. Rank One Operators (23K, AMSTeX) Apr 5, 94
Abstract , Paper (src), View paper (auto. generated ps), Index of related papers

Abstract. For an operator, $A$, with cyclic vector $\varphi$, we study $A+\lambda P$ where $P$ is the rank one projection onto multiples of $\varphi$. If $[\alpha,\beta] \subset \text{spec} (A)$ and $A$ has no a.c. spectrum, we prove that $A+\lambda P$ has purely singular continuous spectrum on $(\alpha,\beta)$ for a dense $G_\delta$ of $\lambda$\!'s.

Files: 94-81.tex


text:
# Are Complex Numbers Real Or Imaginary?

## Is zero real or imaginary?

The real numbers are a subset of the complex numbers, so zero is by definition a complex number ( and a real number, of course; just as a fraction is a rational number and a real number).

If we define a pure real number as a complex number whose imaginary component is 0i, then 0 is a pure real number..

## How do you find the real and imaginary parts of a complex number?

It is common practice to use the letter z to stand for a complex number and write z = a + bi where a is the real part and b is the imaginary part. where a is the real part and b is the imaginary part. Example State the real and imaginary parts of 3+4i. Solution The real part is 3.

## Is 0 a real number?

Real numbers consist of zero (0), the positive and negative integers (-3, -1, 2, 4), and all the fractional and decimal values in between (0.4, 3.1415927, 1/2). Real numbers are divided into rational and irrational numbers.

## How do you find the Z of a complex number?

You can easily check that a complex number z = x + yi times its conjugate x – yi is the square of its absolute value |z|2. Therefore, 1/z is the conjugate of z divided by the square of its absolute value |z|2.

## What type of number is real imaginary or complex?

By making b=0 , any real number can be expressed as a complex number. The real number a is written as a+0i a + 0 i in complex form. Similarly, any imaginary number can be expressed as a complex number….Complex Numbers.Complex NumberReal PartImaginary Part√22−12i√22−12i3 more rows

## What is Z * in complex numbers?

The complex conjugate of the complex number z = x + yi is given by x − yi. It is denoted by either. or z*. This unary operation on complex numbers cannot be expressed by applying only their basic operations addition, subtraction, multiplication and division. Geometrically, is the “reflection” of z about the real axis.

## How do you simplify complex numbers?

To find the final simplified version of the sum, put the real part and the imaginary part back together. The result is the simplified sum of the complex numbers. The sum of (a+bi) and (c+di) is written as (a+c) + (b+d)i. Applying the numerical example, the sum of (3+3i) + (5-2i) is 8+i.

## Why do we need complex numbers?

Complex numbers are numbers that consist of two parts — a real number and an imaginary number. Complex numbers are the building blocks of more intricate math, such as algebra. They can be applied to many aspects of real life, especially in electronics and electromagnetism.

## What are pure imaginary numbers?

A pure imaginary number is any complex number whose real part is equal to 0.

## What is 5i equal to?

The imaginary number i is equal to the square root of -1. In other words, i2 equals -1. The square root of a negative number is not a real number and it is not a variable. For example, the square root of -25 is written as 5i because 5i times 5i equals 25 times -1 or -25.

## What is argument in complex number?

The angle measured from the positive real axis to the line segment is called the argument of the complex number, denoted arg(z) and often labelled θ. The modulus and argument can be calculated using trigonometry.

## Where are complex numbers used?

Imaginary numbers, also called complex numbers, are used in real-life applications, such as electricity, as well as quadratic equations. In quadratic planes, imaginary numbers show up in equations that don’t touch the x axis. Imaginary numbers become particularly useful in advanced calculus.

## Are complex numbers imaginary?

So, a Complex Number has a real part and an imaginary part. But either part can be 0, so all Real Numbers and Imaginary Numbers are also Complex Numbers.

## Is every complex number also a real number?

Every real number is a complex number, but every complex number is not necessarily a real number. The set of all complex numbers is denoted by Z ∈ C Z \in \mathbb C Z∈C. The set of all imaginary numbers is denoted as Z ∈ C − R Z \in \mathbb C – \mathbb R Z∈C−R.

## What is real and complex number?

A real number can thus be 8, 4.357, –3/5, π, , or any other such number. … A complex number is any number that includes i. Thus, 3i, 2 + 5.4i, and –πi are all complex numbers. (In fact, the real numbers are a subset of the complex numbers-any real number r can be written as r + 0i, which is a complex representation.)

## What does a line over a complex number mean?

Answer and Explanation: A line over a complex number denotes the complex conjugate of the number.

## Is 0 a digit number?

0 (zero) is a number, and the numerical digit used to represent that number in numerals. It fulfills a central role in mathematics as the additive identity of the integers, real numbers, and many other algebraic structures. As a digit, 0 is used as a placeholder in place value systems.


text:
# General question, inequalities and graphing

1. Dec 19, 2007

### rocomath

$$x+|x|=y+|y|$$

so for x which in a sense will be the same for y

x if x > 0
-x if x < 0

now does that only apply to my absolute x? or does it apply to both x and |x|?

2. Dec 19, 2007

### symbolipoint

You should consider four sets of conditions: both less than zero, both greater than zero, one less and other greater; the other greater and the one less. An obvious solution is in case x=y=0, but you should check the other four conditions.

3. Dec 19, 2007

### rocomath

no i meant if x < 0, then does it become

(-x) + (-x) or x + (-x)

does the condition only apply to the absolute value? but i checked my SM, i couldn't resist any longer :p

4. Dec 19, 2007

### symbolipoint

Use a number line to justify this: but if x<0, then
$$$x + \left| x \right| = x + ( - x)$$$

5. Dec 19, 2007

### HallsofIvy

Staff Emeritus
The trouble is you don't say what those two lines are EQUAL to. You should say "for x

|x|= x if $x\ge 0$
|x|= -x if x< 0.

Yes, of course, that applies only to the absolute value of x- it wouldn't make sense to say that x= -x! As symbolipoint said, you will have 4 cases to consider- the four quadrants- $x\ge 0$ and $y\ge 0$; $x\ge 0$ and y< 0; x< 0 and $y\ge 0$; x< 0 and y< 0.

6. Dec 19, 2007

### rocomath

Thanks! Unfortunately, I have another :p


text:
# closed curve theorem

Let $U\subset\mathbb{C}$ be a simply connected domain, and suppose $f:U\longrightarrow\mathbb{C}$ is holomorphic. Then

 $\int_{C}f(z)\ dz=0$

for any smooth closed curve $C$ in $U$.

More generally, if $U$ is any domain, and $C_{1}$ and $C_{2}$ are two homotopic smooth closed curves in $U$, then

 $\int_{C_{1}}f(z)\ dz=\int_{C_{2}}f(z)\ dz.$

for any holomorphic function $f:U\longrightarrow\mathbb{C}$.

Title closed curve theorem ClosedCurveTheorem 2013-03-22 12:04:43 2013-03-22 12:04:43 djao (24) djao (24) 7 djao (24) Theorem msc 30E20 CauchyIntegralTheorem


text:
hot Modafinil is an “energy” drug prescribed to treat sleep disorders like narcolepsy and hypersomnia. When taken for enhancement purposes, it’s used to suppress the pesky symptoms of sleep deprivation and retain mental energy and clarity. It’s less addictive than Adderall and Ritalin.[*][*] My predictions were substantially better than random chance7, so my default belief - that Adderall does affect me and (mostly) for the better - is borne out. I usually sleep very well and 3 separate incidents of horrible sleep in a few weeks seems rather unlikely (though I didn’t keep track of dates carefully enough to link the Zeo data with the Adderall data). Between the price and the sleep disturbances, I don’t think Adderall is personally worthwhile. Q10 Published on: Sep 14, 2017  Nootropics # as.factor(Noopept)60 -0.1714377 0.1794377 -0.95542 0.34008626 However, this can be alleviated by the consumption of a choline supplement such as Alpha GPC.

# nootropics

^ Albertson TE, Chenoweth JA, Colby DK, Sutter ME (2016). "The Changing Drug Culture: Use and Misuse of Cognition-Enhancing Drugs". FP Essent. 441: 25–9. PMID 26881770. Read Reviews Nootropics List Based on their Effects The original magnesium l-threonate caused me no apparent problems by the time I finished off the powder and usage correlated with better days, further supporting the hypothesis that magnesium helps it. But l-threonate would be difficult to cap (and hence blind self-experiment) and is ruinously expensive on a per-dose basis. So I looked around for alternatives for the followup; one of the most common compounds suggested was the citrate form because it is reasonably well-absorbed and causes fewer digestive problems, so I could just take that. Magnesium oxide is widely available it looks cheap, but the absorption/bioavailability problem makes it unattractive: at a 3:5 ratio, an estimate of 4% absorption, a ZMA formulation of an impressive-sounding 500mg would be 500×35×0.04=12500 \times \frac{3}{5} \times 0.04 = 12mg or a small fraction of RDAs for male adults like 400mg elemental. (Calcium shouldn’t be a problem since I get 220mg of calcium from my multivitamin and I enjoy dairy products daily.) Tweet on Twitter 21 - 23 May: 1 By Pure Nootropics - $25.99 ($0.86 / dose)  Here’s a full overview of the best nootropics on the market today. We try to update every serious nootropic stack we can, and we update our rankings after every review. Our Newest Products bill Necessity for cognitive enhancing* supplements Can I take ED drugs after a heart attack? » Cannot be consumed by children Tech Not only that, L-theanine also raises the levels of several key neurotransmitters to promote recall, learning, and motivation. (18) Community portal There are a number of plants and herbs which over history have been examined for their benefits on cognition and mental function. We will examine some of the more popular ones which fall into the general spectrum of classification we have discussed. The BrainMD Promise contact@selfhacked.com Newly formulated and making our #5 pick, Cerebral Success has the edge on many brain supplements. Why? The ingredient profile has the essential ingredients proven to boost performance and focus, yet missing a few key ingredients. If you are someone who has ADD or just someone who needs a boost in mental performance to focus on tasks much easier and want a healthy alternative to prescription medicine, this is the decent choice. Lavender Oil We’re all looking for the edge, whether in work or school and if you’re reading [...] 10. Loef M, Walach H.The omega-6/omega-3 ratio and dementia or cognitive decline: a systematic review on human studies and biological evidence. J Nutr Gerontol Geriatr. 2013;32(1):1-23. PMID: 23451843 The hormone testosterone (Examine.com; FDA adverse events) needs no introduction. This is one of the scariest substances I have considered using: it affects so many bodily systems in so many ways that it seems almost impossible to come up with a net summary, either positive or negative. With testosterone, the problem is not the usual nootropics problem that that there is a lack of human research, the problem is that the summary constitutes a textbook - or two. That said, the 2011 review The role of testosterone in social interaction (excerpts) gives me the impression that testosterone does indeed play into risk-taking, motivation, and social status-seeking; some useful links and a representative anecdote: # Time.Backups -0.09 0.06 -0.01 0.04 0.0114 0.989 2.4 GET IN TOUCH 2. More Focus Jarrow (Improves circulation, memory, focus and energy. Nature’s most powerful antioxidant and the ideal brain food) 26 - 28 July: 1 patchLines <- as.list(patchLines) 29: 1 (40%) POPULAR CATEGORY • Nursing mothers and pregnant women Smart stacking strategies and the right nootropic combinations unlock the best possible brain supplement benefits. Creatine monohydrate can be supplemented through a loading protocol. Individual results may vary.  All products come with a 30 day customer satisfaction guarantee.  Trending Topics Popular herbal nootropics and adaptogens that have been shown to improve cognition, reduce stress, combat fatigue, enhance memory and provide overall brain protection[*][*][*][*] include: second block: 5 June - 11 June: 0 productivity <- lithiumExperiment[,c(3,5:22)] Some people that have been using Nootropics for a long time will develop a dependence on the drug, such that their cognitive function is impaired making it impossible to function without the drug. Wholesale Factors that increase your risk for a secondary cancer How iQ² helps Phil fight memory loss. 00:41 # Lithium 0.0345 0.4655 0.07 0.94 This supplement contains 2 natural nutrients, Acetyl-L-Carnitine and Alpha Lipoic Acid to support extremely important metabolic functions. Cognitive science Ketones help convert excess glutamate into GABA, leading to better mental focus and reductions in overall stress,anxiety, and even depression [*][*]. second block: 21 July - 27 July: 0 OK They also act as vasodilators (increase blood flow) in the small arteries and veins in the brain and throughout the whole body.[*] The term Nootropic was first coined by Dr. Corneliu E. Giurgea the Romanian chemist and psychologist that synthesized Piracetam, the first smart drug. View all brands This doesn’t fit the U-curve so well: while 60mg is substantially negative as one would extrapolate from 30mg being ~0, 48mg is actually better than 15mg. But we bought the estimates of 48mg/60mg at a steep price - we ignore the influence of magnesium which we know influences the data a great deal. And the higher doses were added towards the end, so may be influenced by the magnesium starting/stopping. Another fix for the missingness is to impute the missing data. In this case, we might argue that the placebo days of the magnesium experiment were identical to taking no magnesium at all and so we can classify each NA as a placebo day, and rerun the desired analysis: Stock trader makes \$63,000 a month after taking iQ². 00:58 Moreover, sodium butyrate prevents memory impairment in experimental pneumococcal meningitis [R]. 7 March - 9 March: 0 active mind pills|brain sharpness supplement active mind pills|brain supplements 2015 active mind pills|brain supplements 2018
Legal | Sitemap


text:
# (AES in mind) How can we show two irreducible polynomials have a bit-wise linear isomorphism

This refers to answer 2 on a similar question:Design properties of the Rijndael finite field

I am unsure what many of the terms mean in this answer. I think a bit-wise linear isomorphism of irreducible polynomial A refers to: $$A(x) = x^8+x^4+x^3+x+1=100011011$$ or $11B$ in hex. And I assume B refers to another irreducible polynomial over $GF(2^8)$ (btw Is there a list of these? I cannot find them). If I am right, I still cannot fully understand what is meant by:$$L(X+_AY)=L(X)+_BL(Y)$$ or $$L(X \times_AY)=L(X)\times _BL(Y)$$Specifically, I am not sure what $X$ and $Y$ are (but I think they are other polynomials) or what $+_A$, $+_B$, $\times_A$, $\times_B$ mean. A full numerical example would be very helpful, even if only one of the two equations above.

To answer this question, we'll first want to step back and discuss what a finite field is, and what a representation is.

A finite field is a group of finite size (always $p^k$, for some prime $p$ and integer $k$, in this case, $2^8$), along with addition and multiplication operators, where certain identities are true (e.g. $a \times (b + c) = a \times b + a \times c$), see this link for the list.

It turns out that, given a specific size $p^k$, the field is essentially unique (in the sense that, if we have two different sets of the same size where they both preserve the identities, they will always be a mapping between the two sets which preserve both the addition and multiplication operations, hence those two sets are essentially the same.

This is nice, however we need a way to talk about these elements; what we do is assign the element names; for $GF(2^8)$, we have precisely 256 elements, and so we typically give each element a unique 8 bit name. Such a way of assigning names is known as the 'representation'.

For $GF(2^8)$, there are a number of reasonable ways to assign these names, one such way is to select an irreducible polynomial, and compute the multiplication modulo that polynomial. That is the approach that AES takes, with the irreducible polynomial $x^8 + x^4 + x^3 + x + 1$. Let us call this specific representation (which is a way of assigning names to field members) $A$.

However, that isn't the only way of assigning names; we could consider a different irreducible polynomial, say, $x^8 + x^4 + x^3 + x^2 + 1$. That gives a different way of assigning names to field elements, that is, a different representation, we may call this representation $B$.

Now, we define $L$ to be the function that takes a field element (using the $A$ naming convention), and return the name of that same field element (using the $B$ naming convention). It turns out $L$ isn't unique; we'll ignore that for now. It turns out that $L$ is an isomorphism, as the field it maps from (the $A$ representation) and the field it maps to (the $B$ representation) are the same (because they're both different ways of given labels to the same underlying field).

It turns out that, if we just look at $L$ as a mapping between 8 bits to 8 bits, it is bit-wise linear.

In the $A, B$ representations I just gave, one such mapping is:

$$L(01) = 01$$ $$L(02) = 03$$ $$L(04) = 05$$ $$L(08) = 0F$$ $$L(10) = 11$$ $$L(20) = 33$$ $$L(40) = 55$$ $$L(80) = FF$$

Because $L$ is linear, it is easy to deduce $L(X)$ for any other $X$ not listed.

And, what $+_A$ means is the addition operation in the $A$ representation; that is, $X +_A Y$ takes the two field elements $X, Y$ (named using the $A$ convention), and evaluates to the field addition of those elements (also expressed in the $A$ naming convention. Hence, when we say:

$$L(X+_AY)=L(X)+_BL(Y)$$

$X, Y$ are both arbitrary field elements (in the $A$ naming convention), and what we're saying is that the $L$ mapping preserves addition; that is, if we add two arbitrary elements $X, Y$ (in the $A$ representation) and then map the sum, we always get the exact same value as we would have if we first mapped $X$ and $Y$ into the $B$ representation, and then added them (in the $B$ representation).

We call out $+_A$ and $+_B$ because they aren't necessarily the same operation (actually, in this case they are, but not in general); $+_A$ assumes the inputs are in the $A$ representation, and $+_B$ assumes they are in the $B$ representation.

You asked for a numeric example, here's a simple one (using the $\times$ operator; it turns out that the addition operation isn't that interesting).

If we pick $X = 03$ and $Y = 05$, we have (on the left side):

$L(03 \times_A 05) = L(0F) = L(01) \oplus L(02) \oplus L(04) \oplus L(08) = 08$

(Note: we have $L(0F) = L(01) \oplus L(02) \oplus L(04) \oplus L(08)$ because of the bitwise linearity of $L$)

On the right side, we have:

$L(03) \times_B L(05) = (L(01) \oplus L(02)) \times_B (L(01) \oplus L(04)) = 02 \times_B 04 = 08$

That is, both sides come up with the same value. This will always be true no matter what values we picked for $X, Y$

• From the list L(01) = 01, L(02) = 03, etc. I assume 01 is hex for 0000 0001, 02 is hex for 0000 0010, etc. and these can be expressed as polynomials. However, I don't understand where the inputs for L(.) come from. I think they are field elements but: (i) how did you choose them? (ii) And how do we know what can or cannot be chosen? I see, for example, L(08) = 0F, but I cannot see how they relate to A and B or how the answer 0F comes to be. . – Red Book 1 Oct 19 '17 at 11:04
• @RedBook1: actually, the inputs to $L$ are bitpatterns, specifically, the bitpattern in the $A$ representation; the output is the bitpattern in the $B$ representation that corresponds to the same abstract field element. For example, we have $L(08) = 0F$, that is, the same abstract field element has bitpattern 08 (or 00001000) in the $A$ representation and has bitpattern 0F (or 00001111) in the $B$ representation. – poncho Oct 19 '17 at 12:57
• Sorry, but I am still not getting this. If, for instance, I see the bit-pattern 01010111 = 57, I think of polynomial $x^6 + x^4 + x^2 + x +1$. In our case, $A(x) = x^8 + X^4 + x^3 + x + 1 = 1 0001 1011$ and $B(x) = x^8 + X^4 + x^3 + x^2 + 1 = 1 0001 1101$. So when you say (for example) $L(08) = L(00001000)$ is a bit-pattern 'in' $A$, this seems to leave only $x^3$. In any case, I cannot see how this comes to be the same as $0F$ in $B$. Sorry if I am asking too much, but I think a step-by-step example of how $L(08)=0F$ would get me over this hurdle. – Red Book 1 Oct 19 '17 at 14:09
• @RedBook1: I have no idea what you mean by $A(x)$ and $B(x)$; $A$ and $B$ are not functions; instead, they are a way of labeling things. Instead, lets go with an analogy; $A$ and $B$ are naming conventions; lets say that they're "English" and "French"; $L$ is the mapping between the two, so $L(\text{"Dog"}) = \text{"Chien"}$. – poncho Oct 19 '17 at 14:47
• @RedBook1: as for why $L(02) = 03$, well, in the $A$ naming convention, the value 02 is one of the roots to the equation $x^8 + x^4 + x^3 + x + 1 = 0$. In the $B$ naming convention, the value 02 is one of the roots to the equation $y^8 + y^4 + y^3 + y^2 + 1 = 0$. It turns out that the value $x$ (02 in the $A$ naming convention) is the value $y+1$ (03 in the $B$ naming convention). As for why $L(08) = 0F$, well, cube each side, $02^3 = 08$ (in the $A$ naming convention), and $03^3 = 0F$ (in the $B$ naming convention) – poncho Oct 19 '17 at 15:01


text:
## Derivation of System Equations

The electrical network of example 2 is shown above. The elaborated network consists of $$l = 34$$ branches and $$k = 9$$ nodes.

The proper tree corresponding to the electrical network is shown above. Since capacitors $$C_{TG1}$$, $$C_{OUTN4}$$, $$C_{INP4}$$, $$C_{OUTN1}$$, $$C_{INP3}$$ and $$C_{INP2}$$ are members of the proper tree, the state vector may be written as:

$\mathbf{x} = \begin{bmatrix} v_{C_{TG1}} \\ v_{C_{OUTN4}} \\ v_{C_{INP4}} \\ v_{C_{OUTN1}} \\ v_{C_{INP3}} \\ v_{C_{INP2}} \\ \end{bmatrix}$

Determining the proper tree becomes increasingly complex as the number of branches and nodes are increased. As the network is comprised of 9 nodes, there are 8 basic cuts. To ease the process of determining all 8 basic cuts, it is often more convenient to form the $$\mathbf{Q_f}$$ matrix (where rows 0 to 7 correspond to the basic cuts containing $$v_{in}$$, $$v_{S}$$, $$C_{TG1}$$, $$C_{OUTN4}$$, $$C_{INP4}$$, $$C_{OUTN1}$$, $$C_{INP3}$$ and $$C_{INP2}$$ respectively:)

$\mathbf{Q_f} = \begin{bmatrix} -1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\ 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & \\ 0 & 1 & -1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 1 & 1 & 0 & -1 & -1 & -1 & 1 & 1 & 0 & -1 & -1 & -1 & 0 & -1 & 0 & \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 1 & 1 & 0 & -1 & -1 & -1 & 0 & 0 & -1 & 0 & 0 & -1 & 1 & -1 & 0 & \\ 0 & 0 & 0 & 1 & 1 & 1 & -1 & -1 & 0 & 1 & 1 & 0 & -1 & -1 & -1 & -1 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 0 & 0 & -1 & 0 & 0 & -1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & -1 & 0 & \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 & -1 & -1 & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \\ \end{bmatrix} \begin{bmatrix} i_{IN} \\ i_{TG1} \\ i_{C_{TG1}} \\ i_{P1} \\ i_{C_{OUTP1}} \\ i_{C_{INP1}} \\ i_{N1} \\ i_{C_{OUTN1}} \\ i_{C_{INN1}} \\ i_{P2} \\ i_{C_{OUTP2}} \\ i_{C_{INP2}} \\ i_{N2} \\ i_{C_{OUTN2}} \\ i_{C_{INN2}} \\ i_{TG2} \\ i_{C_{TG2}} \\ i_{TG3} \\ i_{C_{TG3}} \\ i_{P3} \\ i_{C_{OUTP3}} \\ i_{C_{INP3}} \\ i_{N3} \\ i_{C_{OUTN3}} \\ i_{C_{INN3}} \\ i_{P4} \\ i_{C_{OUTP4}} \\ i_{C_{INP4}} \\ i_{N4} \\ i_{C_{OUTN4}} \\ i_{C_{INN4}} \\ i_{TG4} \\ i_{C_{TG4}} \\ i_S \end{bmatrix} = \mathbf{0} \label{eq:ex2_qf}$

The differential equation for $$v_{C_{TG1}}$$ is obtained from the basic cut involving capacitor $$C_{TG1}$$. From row 2 of equation \eqref{eq:ex2_qf}:

$$i_{TG1} - i_{C_{TG1}} - i_{C_{INP1}} - i_{C_{INN1}} + i_{TG2} - i_{C_{TG2}} = 0 \\ \label{eq:ex2_kcl1}$$

Equation \eqref{eq:ex2_kcl1} may be rewritten in terms of the system state variables by noting that $$v_{C_{INP1}} = v_{C_{TG1}} - v_{C_{OUTN1}}$$, $$v_{C_{INN1}} = v_{C_{TG1}}$$, $$v_{C_{TG2}} = v_{C_{TG1}}$$ and $$v_{TG2} = v_{C_{OUTN1}} - v_{C_{INP2}} - v_{C_{TG1}}$$:

$$i_{TG1} - C_{TG1}\frac{dv_{C_{TG1}}}{dt} - C_{INP1}\left(\frac{dv_{C_{TG1}}}{dt} - \frac{dv_{C_{OUTN1}}}{dt}\right) - C_{INN1}\frac{dv_{C_{TG1}}}{dt} + i_{TG2} - C_{TG2}\left(\frac{dv_{C_{TG1}}}{dt}\right) = 0 \\ \label{eq:ex2_kcl2}$$

Note that the current sources $$i_{TG1}$$ and $$i_{TG2}$$ are functions of their respective branch voltages, which may be expressed in terms of the state vector. If a similar approach is adopted for rows 3 - 7 of equation \eqref{eq:ex2_qf}, the following system of equations, expressed in matrix form, may be derived:

$\begin{bmatrix} C_{TG1}+C_{INP1}+C_{INN1}+C_{TG2} & 0 & 0 & -C_{INP1} & 0 & 0 \\ 0 & C_{OUTN4}+C_{TG3}+C_{OUTP3}+C_{OUTN3}+C_{INN3}+C_{OUTP4}+C_{INN4}+C_{TG4} & C_{TG3}+C_{OUTP3}+C_{OUTN3}+C_{INN3}+C_{INN4}+C_{TG4} & 0 & C_{TG3}+C_{INN3}+C_{TG4} & 0 \\ 0 & C_{TG3}+C_{OUTP3}+C_{OUTN3}+C_{INN3}+C_{INN4}+C_{TG4} & C_{INP4}+C_{TG3}+C_{OUTP3}+C_{OUTN3}+C_{INN3}+C_{INN4}+C_{TG4} & 0 & C_{TG3}+C_{INN3}+C_{TG4} & 0 \\ -C_{INP1} & 0 & 0 & C_{OUTN1}+C_{OUTP1}+C_{INP1}+C_{OUTP2}+C_{OUTN2}+C_{INN2} & 0 & -C_{OUTP2}-C_{OUTN2} \\ 0 & C_{TG3}+C_{INN3}+C_{TG4} & C_{TG3}+C_{INN3}+C_{TG4} & 0 & C_{INP3}+C_{TG3}+C_{INN3}+C_{TG4} & 0 \\ 0 & 0 & 0 & -C_{OUTP2}-C_{OUTN2} & 0 & C_{INP2}+C_{OUTP2}+C_{OUTN2} \\ \end{bmatrix} \begin{bmatrix} \frac{dv_{C_{TG1}}}{dt} \\ \frac{dv_{C_{OUTN4}}}{dt} \\ \frac{dv_{C_{INP4}}}{dt} \\ \frac{dv_{C_{OUTN1}}}{dt} \\ \frac{dv_{C_{INP3}}}{dt} \\ \frac{dv_{C_{INP2}}}{dt} \\ \end{bmatrix} = \begin{bmatrix} i_{TG1} + i_{TG2} \\ i_{TG3} + i_{P3} + C_{OUTP3}\frac{dv_S}{dt} - i_{N3} + i_{P4} + C_{OUTP4}\frac{dv_S}{dt} - i_{N4} \\ i_{TG3} + i_{P3} + C_{OUTP3}\frac{dv_S}{dt} - i_{N3} + i_{TG4} \\ i_{P1} + C_{OUTP1}\frac{dv_S}{dt} - i_{N1} + i_{P2} + C_{OUTP2}\frac{dv_S}{dt} - i_{N2} - i_{TG2} - i_{TG3} \\ i_{TG3} + i_{TG4} \\ i_{TG2} - i_{P2} - C_{OUTP2}\frac{dv_S}{dt} + i_{N2} \\ \end{bmatrix} \label{eq:ex2_eqns}$

Notice that the right hand side of equation \eqref{eq:ex2_eqns} contains references to the time derivative of the supply voltage $$\left(\frac{dv_S}{dt}\right)$$. These terms arise whenever a co-tree branch forms a loop with the $$v_S$$ branch. For example, $$v_{C_{OUTP1}} = v_S - v_{C_{OUTN1}}$$ and therefore the time derivative may be written as:

$$\frac{dv_{C_{OUTP1}}}{dt} = \frac{dv_S}{dt} - \frac{dv_{C_{OUTN1}}}{dt} \\$$

Time derivatives of system inputs can often present problems to the numerical solution of the system. The inputs can often change rapidly with respect to time, resulting in derivatives large in magnitude and causing the equations to become stiff. In such situations, small time steps and stringent error tolerances are often required to prevent the solution from becoming unstable. In this example, since the derivative is of the supply voltage, assumed to be constant for all time, the derivative evaluates to zero.

## Solving the System of Equations

Octave's function lsode can be used to solve Ordinary Differential Equations (ODEs) of the form:

$$\frac {d\mathbf{x}}{dt} = f(\mathbf{x}, t) \\ \label{eq:oct1}$$

The ODE solver requires a function to compute the vector of derivatives of equation \eqref{eq:oct1}. For this example, the derivatives are evaluated by the function dypc_example2.

	  function dy = dypc_example2(y,t)

V_CTG1 = y(1);
V_COUTN4 = y(2);
V_CINP4 = y(3);
V_COUTN1 = y(4);
V_CINP3 = y(5);
V_CINP2 = y(6);

dy = zeros(6,1);

% supply voltage and time derivative
V_VS = 1;
dVS = 0;

% setup din input voltage and clock sources.
% din is a 50/50 duty cycle pulse with a period of 25ns.
% clock is a 50/50 duty cycle pulse with a period of 10ns.
V_VDIN = pulse(25e-9, 12.5e-9, 1e-12, 1e-12, t);
V_VCIN = pulse(10e-9, 5e-9, 1e-12, 1e-12, t+5e-9);
V_VCINB = pulse(10e-9, 5e-9, 1e-12, 1e-12, t);

% instantiate the CMOS transistor models and calculate the input/output capacitance
% and drain current.

% CMOS model parameters
Ln = 10;
Wn = 10;
Lp = 10;
Wp = 20;
scale = 50e-9;
Cox_dash = 25e-15;

%N1
Vgs = y(1); % in parallel with CTG1
Vds = y(4);
F = nmos_digital(Vgs, Vds, Ln, Wn, scale, Cox_dash);
CINN1 = F(1);
COUTN1 = F(2);
i_IN1 = F(3);

%P1
V_COUTP1 = -V_COUTN1 + V_VS;
V_CINP1 = V_CTG1 - V_COUTN1;
Vsg = V_CINP1 - V_COUTP1;
Vsd = -V_COUTN1 + V_VS;
F = pmos_digital(Vsg, Vsd, Lp, Wp, scale, Cox_dash);
CINP1 = F(1);
COUTP1 = F(2);
i_IP1 = F(3);

%N2
V_CINN2 = V_COUTN1;
Vgs = V_CINN2;
Vds = V_COUTN1 - V_CINP2;
F = nmos_digital(Vgs, Vds, Ln, Wn, scale, Cox_dash);
CINN2 = F(1);
COUTN2 = F(2);
i_IN2 = F(3);

%P2
V_COUTP2 = -V_COUTN1 + V_CINP2 + V_VS;
Vsg = V_CINP2 - V_COUTP2;
Vsd = -V_COUTN1 + V_CINP2 + V_VS;
F = pmos_digital(Vsg, Vsd, Lp, Wp, scale, Cox_dash);
CINP2 = F(1);
COUTP2 = F(2);
i_IP2 = F(3);

%N3
V_CINN3 = V_CINP3 + V_CINP4 + V_COUTN4;
Vgs = V_CINN3;
Vds = V_CINP4 + V_COUTN4;
F = nmos_digital(Vgs, Vds, Ln, Wn, scale, Cox_dash);
CINN3 = F(1);
COUTN3 = F(2);
i_IN3 = F(3);

%P3
V_COUTP3 = -V_CINP4 - V_COUTN4 + V_VS;
Vsg = V_CINP3 - V_COUTP3;
Vsd = -V_CINP4 - V_COUTN4 + V_VS;
F = pmos_digital(Vsg, Vsd, Lp, Wp, scale, Cox_dash);
CINP3 = F(1);
COUTP3 = F(2);
i_IP3 = F(3);

%N4
V_CINN4 = V_CINP4 + V_COUTN4;
Vgs = V_CINN4;
Vds = y(2);
F = nmos_digital(Vgs, Vds, Ln, Wn, scale, Cox_dash);
CINN4 = F(1);
COUTN4 = F(2);
i_IN4 = F(3);

%P4
V_COUTP4 = -V_COUTN4 + V_VS;
Vsg = V_CINP4 - V_COUTP4;
Vsd = -V_COUTN4 + V_VS;
F = pmos_digital(Vsg, Vsd, Lp, Wp, scale, Cox_dash);
CINP4 = F(1);
COUTP4 = F(2);
i_IP4 = F(3);

%TG1
V_ITG1 = V_VDIN -V_CTG1;
F = tg(V_ITG1, V_VCIN, V_VCINB, Ln, Wn, Lp, Wp, scale, Cox_dash);
CTG1 = F(1);
i_ITG1 = F(2);

%TG2
V_ITG2 = -V_CTG1 + V_COUTN1 - V_CINP2;
F = tg(V_ITG2, V_VCINB, V_VCIN, Ln, Wn, Lp, Wp, scale, Cox_dash);
CTG2 = F(1);
i_ITG2 = F(2);

%TG3
V_ITG3 = V_COUTN1 - V_CINP3 - V_CINP4 - V_COUTN4;
F = tg(V_ITG3, V_VCINB, V_VCIN, Ln, Wn, Lp, Wp, scale, Cox_dash);
CTG3 = F(1);
i_ITG3 = F(2);

%TG4
V_ITG4 = -V_CINP3 - V_CINP4;
F = tg(V_ITG4, V_VCIN, V_VCINB, Ln, Wn, Lp, Wp, scale, Cox_dash);
CTG4 = F(1);
i_ITG4 = F(2);

% create the Qm and Tm matrices.
Qm = [(CTG1+CINP1+CINN1+CTG2) 0 0 -CINP1 0 0;
0 (COUTN4+CTG3+COUTP3+COUTN3+CINN3+COUTP4+CINN4+CTG4) (CTG3+COUTP3+COUTN3+CINN3+CINN4+CTG4) 0 (CTG3+CINN3+CTG4) 0;
0 (CTG3+COUTP3+COUTN3+CINN3+CINN4+CTG4) (CINP4+CTG3+COUTP3+COUTN3+CINN3+CINN4+CTG4) 0 (CTG3+CINN3+CTG4) 0;
-CINP1 0 0 (COUTN1+COUTP1+CINP1+COUTP2+COUTN2+CINN2) 0 (-COUTP2-COUTN2);
0 (CTG3+CINN3+CTG4) (CTG3+CINN3+CTG4) 0 (CINP3+CTG3+CINN3+CTG4) 0;
0 0 0 (-COUTP2-COUTN2) 0 (CINP2+COUTP2+COUTN2)];

Tm = [i_ITG1 + i_ITG2;
i_ITG3 + i_IP3 + COUTP3*dVS - i_IN3 + i_IP4 + COUTP4*dVS - i_IN4;
i_ITG3 + i_IP3 + COUTP3*dVS - i_IN3 + i_ITG4;
i_IP1 + COUTP1*dVS - i_IN1 + i_IP2 + COUTP2*dVS - i_IN2 - i_ITG2 - i_ITG3;
i_ITG3 + i_ITG4;
-i_IP2 - COUTP2*dVS + i_IN2 + i_ITG2];

% calculate the system derivatives by performing Gaussian elimination.
dy = Qm\Tm;

The function lsode uses a numerical integration algorithm to solve the system of equations. It must be linked to the dypc_example2 function and invoked with suitable arguments. For this example, the following code sequence is used to solve the system of equations for time $$t=0$$ to $$t=100 ns$$.

	  clear all;
abTol = 1e-3;

t = linspace (0, 100e-9, 30e3);
x0 = [0 0 0 0 0 0];

lsode_options("absolute tolerance",[abTol abTol abTol abTol abTol abTol]);
lsode_options("relative tolerance", 1e-4);
lsode_options("integration method", "stiff");
lsode_options("maximum step size", 0.5e-9);

tic
Y = lsode("dypc_example2", x0, t);
toc

Notice that in the above code fragment the "maximum step size" parameter is specified. This prevents the solver from using too large a time step such that important changes on the system inputs are "missed".


text:
Top

# Elementary Number Theory

Elementary number theory is a theory of pure mathematics which is related to study of number systems (mainly Integers).

Every system of numbers has its limitations and this motivates to extend some more number systems by including some more numbers to it.

The limitation of natural numbers led to the discovery of integers and the limitation of integers led to the development of the set of rational numbers and so on.

Some Important Definitions, Results and Theorems of Elementary Number Theory are as follows:

Divisibility in Integers: If a and b are any two integers such that a not equal to zero, we say that a divides b, denoted by $\frac{a}{b}$, if b = ac, for some integer c.

Greatest Common Divisor: The greatest common divisor (g.c.d) of two integers a and b is defined as a positive integer c such that
1.    $\frac{c}{a}$ and $\frac{c}{b}$
2.    If d is any integer such that $\frac{d}{a}$ and $\frac{d}{b}$, then $\frac{d}{c}$.
The g.c.d of two integers a and b is denoted by (a, b).

Two integers a and b are said to be relatively prime if the g.c.d of a and b is 1. i.e., gcd (a, b) = 1.

Prime Numbers and Composite Numbers: An integer p > 1 is called a prime number (or Prime) if its only divisor are $\pm$1, $\pm$p. An integer n > 1 which is not prime is called a composite number (or composite).

Division Algorithm: If a and b are any two integers and a not equal to zero, then there exist unique integers q and r such that b = a $\times$ q + r, 0 $\leq$ r < mod (a).

Euclid’s Lemma: Let p be a prime number such that p / ab (a, b belongs to integers). Then $\frac{p}{a}$ or $\frac{p}{b}$.
Its corollary is, let p be a prime number such that $\frac{p}{(a_1, a_2,… .., a_n) (a_i\ represents\ integers)}$. Then $\frac{p}{a}$, for some i, 1 $\leq$ i $\leq$ n.

Unique Factorization Theorem: Every positive integer is either 1 or it can be expressed uniquely as a product of prime numbers.

Linear Diophantine Equation: An equation of the form ax + by = c, where a, b, c are integers such that a and b are not both zero, is called a linear Diophantine equation, due to a mathematician Diophantine. It can be shown that the linear Diophantine equation ax + by = c has a solution in the set of integers if $\frac{d}{c}$, where d = (a, b).

 Related Calculators Number Rounding 5 Number Summary Calculator Adding Binary Numbers Calculator Adding Complex Numbers Calculator

## Solving Elementary Number Theory

### Solved Examples

Question 1: Find a solution of 243x + 189y = 27 in integers.
Solution:

First we will find greatest common divisor of 243 and 189 by division algorithm, which can be written as 243 = 189 $\times$ 1 + 54 .......(i)
189 = 54 $\times$ 3 + 27 ……….(ii)
54 = 27 $\times$ 2.
Therefore, (243, 189) = 27.
From (ii) 27 = 189 – 54 $\times$ 3
= 189 – (243 - 189) $\times$ 3 by (i)
Therefore, (-3) $\times$ 243 + (4) $\times$ 189 = 27.
Hence x = -3, and y = 4 is the required solution.

Question 2: If (a, b) = 1, then prove that (a + b, a - b) = 1 or 2.
Solution:

Let d = (a + b, a - b), then $\frac{d}{(a+b)}$ and  $\frac{d}{(a-b)}$ this implies  $\frac{d}{(a - b + a - b)}$ and  $\frac{d}{(a - b - a + b)}$. This implies $\frac{d}{2(a, b)}$ = 2 $\times$ 1 = 2.

Hence, $\frac{d}{2}$ implies d = 1 or 2.

*AP and SAT are registered trademarks of the College Board.


text:
## Filters

Clear All
Solvay process is used to prepare sodium carbonate. Reactions occurs in solvay process are -
When the alkaline earth metals are heated the electrons are excited to higher energy levels and when they drop back to the ground state, energy is emitted in the form of visible light. Hence the colour is observed. The electrons in beryllium and magnesium are too strongly bound to get excited by flame. Hence, these elements do not impart any colour.
The alkali metals dissolve in liquid ammonia giving deep blue solutions which are conducting in nature.  The blue colour of the solution is due to the ammoniated electron which absorbs energy in the visible region of light and thus imparts blue colour to the solution. The solutions are paramagnetic. In concentrated solution, the blue colour changes to bronze colour and becomes diamagnetic
It is because of the low ionisation energy of K and . They lose electron easily. On the other hand, Lithium is smaller in size as compared to caesium and lithium, it requires high energy to lose an electron. Therefore, lithium is not used in a photoelectric cell.
Alkali and alkaline earth metals not be obtained by chemical reduction methods because to reduce their oxides we need to use a strong reducing agent, but there is no other reducing agent which is stronger than them.
Chemical similarities between lithium and magnesium-  and  slowly react with water and their hydroxide and oxides are also less soluble in water. On heating, their hydroxide decomposes. Both the element form nitride  and  by direct reaction with nitrogen.   and  do not give superoxide on reacting with an excess of oxygen. Lithium and Magnesium carbonates easily decompose into their oxides and...
(i) Ionisation enthalpy- Alkali metals have low first IE as compare to alkaline earth metals because of having a large atomic size also after losing one electron they attain noble gas configuration. In alkaline earth metals, their first IE is higher then alkali metals because they have high effective nuclear charge and small in size as compare to group 1st element. However, they have low second...
As we know that in alkali metals, as we go down the group the atomic size increases and also the effective nuclear charge decreases. So, therefore, the outermost electron of potassium is easily removed. Electronic configuration of  and electronic configuration of sodium  (Na= ). Hence the reactivity of sodium is less than of potassium.
Let suppose the oxidation state of Na is to be x. In the case of peroixide, the oxygen has  -1 oxidation state. So, now
Electronic Configuration All the alkali metals have one valence electron,   outside the noble gas core. The loosely held s electron in the outermost valence shell of these elements makes them the most electropositive metals. They readily lose an electron to give monovalent M+ ions. Hence they are never found in the free or native state in nature.
The general characteristics and gradation in properties of alkaline earth metals- General electronic configuration is [noble gas]. Have two electrons to lose and attain their nearest noble gas configuration. have smaller atomic and ionic radii than corresponding alkali metals in the same periods. First IE is higher than those elements of group 1 electropositive nature increase down the group...
Physical and chemical features of alkali metals- Physical features- All the alkali metals are silvery white, soft and light metals. Because of the large size, these elements have a low density which increases down the group from Li to Cs. However, potassium is lighter than sodium. The melting and boiling points of the alkali metals are low indicating weak metallic bonding due to the presence...
Exams
Articles
Questions


text:
HLIBpro  3.0
Solving an Integral Equation
Remarks
This example corresponds to the C++ example "Solving an Integral Equation".

In this example, an integral equation is to be solved by representing the discretised operator with an H-matrix, whereby the H-matrix is constructed using a matrix coefficient function for entries of the equation system. Furthermore, for the iterative solver a preconditioner is computed using H-LU factorisation.

Problem Description

Given the integral equation

$\int_0^1 \log|x-y| \mathbf{u}(y) dy = \mathbf{f}(x), \quad x \in [0,1]$

with $$\mathbf{u} : [0,1] \to \mathbf{R}$$ being sought for a given right hand side $$\mathbf{f} : [0,1] \to \mathbf{R}$$, the Galerkin discretisation with constant ansatz functions $$\phi_i, 0 \le i < n$$

$\phi_i(x) = \left\{ \begin{array}{ll} 1, & x \in \left[\frac{i}{n},\frac{i+1}{n} \right] \\ 0, & \mathrm{otherwise} \end{array} \right.$

leads to a linear equation system $$A u = f$$ where $$u$$ contains the coefficients of the discretised $$\mathbf{u}$$ and $$A$$ is defined by

\begin{eqnarray*} a_{ij} & = & \int_0^1 \int_0^1 \phi_i(x) \log|x-y| \phi_j(y) dy dx \\ & = & \int_{\frac{i}{n}}^{\frac{i+1}{n}} \int_{\frac{j}{n}}^{\frac{j+1}{n}} \log|x-y| dy dx \nonumber . \end{eqnarray*}

The right hand side $$f$$ is given by

$f_i = \int_0^1 \phi_i(x) f(x) dx.$

Remarks
This example is identical to the introductory example in

Coordinates and Cluster Trees

The code starts with the standard initialisation:

#include <stdio.h>
#include <hpro-c.h>
int main ( int argc, char ** argv )
{
int info;
hpro_init( & info ); CHECK_INFO;
hpro_set_verbosity( 2 );

Together with the initialisation, the verbosity level of HLIBpro was increased to have additional output during execution. The macro CHECK_INFO is defined as

#define CHECK_INFO { if ( info != HPRO_NO_ERROR ) \
{ char buf[1024]; hpro_error_desc( buf, 1024 ); \
printf( "\n%s\n\n", buf ); exit(1); } }

and tests the result of a 𝖧𝖫𝖨𝖡𝗉𝗋𝗈 function call. If an error occured, the description of this error is queried using hpro_error_desc and printed to the screen.

For clustering the unknowns, coordinate information is to be defined. For this 1d example, the indices are placed in the middle of equally sized intervals.

int i;
int n = ... /* set problem dimension */
double h = 1.0 / ((double) n);
double ** vertices;
hpro_coord_t coord;
vertices = (double**) malloc( n * sizeof(double*) );
for ( i = 0; i < n; i++ )
{
vertices[i] = (double*) malloc( sizeof(double) );
vertices[i][0] = h * ((double) i) + (h / 2.0);
}
coord = hpro_coord_import( n, 1, vertices, NULL, & info ); CHECK_INFO;

Coordinates in HLIBpro are vectors of the corresponding dimension, e.g. one in for this problem.

Having coordinates for each index, the cluster tree and block cluster tree can be constructed.

hpro_clustertree_t ct;
hpro_blockclustertree_t bct;
ct = hpro_clt_build_bsp( coord, HPRO_BSP_AUTO, 20, & info ); CHECK_INFO;
bct = hpro_bct_build( ct, ct, adm, & info ); CHECK_INFO;

For the cluster tree, the partitioning strategy for the indices is determined automatically by choosing HPRO_BSP_AUTO. For the block cluster tree, the standard admissibility condition is used as defined by HPRO_ADM_STD_MIN with $$\eta = 2$$.

Matrix Construction and Coefficient Function

Using the block cluster tree, finally the H-matrix can be constructed. For this, adaptive cross approximation (ACA) is applied to compute low rank approximations of admissibly matrix blocks. In HLIBpro, an improved version of ACA, ACA+ is implemented.

ACA only needs access to the matrix coefficients of the dense matrix. Those are provided by a coefficient function kernel with an optional parameter h, which will be discussed below. Furthermore, the block wise accuracy of the H-matrix approximation has to be defined. In this case, an accuracy of $$\epsilon = 10^{-4}$$ is used and stored in acc.

In this example, we use double precision arithmetic and as such prefix all functions with hpro_d .

Finally, a flag indicates, whether the matrix is symmetric or not.

hpro_acc_t acc = hpro_acc_fixed_eps( 1e-4 );
hpro_d_matrix_t A;
A = hpro_d_matrix_build_coeff( bct, kernel, & h, HPRO_LRAPX_ACAPLUS,
acc, 1, & info ); CHECK_INFO;

The coefficient function used during matrix construction comes in the form of a callback function:

typedef value_t = double;
void
kernel ( const size_t n, const int * rowidx,
const size_t m, const int * colidx,
value_t * matrix, void * arg )
{
int rowi, colj;
value_t h = *((double*) arg);
for ( colj = 0; colj < m; colj++ )
{
const int idx1 = colidx[colj];
for ( rowi = 0; rowi < n; rowi++ )
{
const int idx0 = rowidx[rowi];
value_t value;
if ( idx0 == idx1 )
value = -1.5*h*h + h*h*log(h);
else
{
const value_t dist = h * ( fabs( (double) (idx0-idx1) ) - 1.0 );
const value_t t1 = dist+1.0*h;
const value_t t2 = dist+2.0*h;
value = ( - 1.5*h*h + 0.5*t2*t2*log(t2) - t1*t1*log(t1) );
if ( fabs(dist) > 1e-8 )
value += 0.5*dist*dist*log(dist);
}
matrix[(colj*n) + rowi] = -value;
}
}
}
Remarks
To switch the value type more easily, it is defined and used via value_t .

It is called, whenever matrix coefficients are needed. Usually, a complete block of coefficients is requested by the internal matrix constructor, e.g. a full dense block in case of an inadmissible leaf or a full row/column in case of ACA. The row (column) indices for the requested coefficients are stored in rowidx (colidx) and are of size n (m). In the array matrix the coefficients have to be stored in column-wise order, e.g. the coefficient with the i'th row index and the j'th column index at position (i,j) or at matrix[j*n+i]. The final argument arg is the additional parameter to hpro_matrix_build_coeff at can be used to provided necessary data for the coefficient function. Here, it is the stepwidth $$h$$ of the problem.

H-LU Factorisation

Having constructed the H-matrix, the corresponding equation system shall be solved. In most cases, a standard iterative solve will not be sufficient, e.g. either the convergence rate is to bad or there is no convergence at all. Therefore, a (good) preconditioner is needed, with the inverse of $$A$$ being the best possible. Since iterative schemes only need matrix-vector multiplication, the corresponding functionality for the inverse is sufficient. This is provided by an (H-) LU factorisation of $$A$$, or for the symmetric case, a LDL factorisation:

hpro_d_matrix_t B;
hpro_d_linearoperator_t A_inv;
B = hpro_d_matrix_copy( A, & info ); CHECK_INFO;
A_inv = hpro_d_matrix_factorise_inv( B, acc, & info ); CHECK_INFO;

Since A is modified during the factorisation, a copy B is constructed. For the factorisation the accuracy is chosen to be equal as during matrix construction. The result of the factorisation is linear operator represented by the type hpro_d_linearoperator_t, which can be used to perform matrix vector multiplication. In this case, the evaluation of the inverse of $$A$$ is provided.

Remarks
A matrix can always be used as a linear operator, but not the other way around, i.e. a linear operator is not a full matrix object.

Iterative Solvers

Still missing is the right hand side of the equation system. In this example, it was chosen, such that $$\mathbf{u} \equiv \mathbf{1}$$:

hpro_d_vector_t b = hpro_d_vector_build( n, & info ); CHECK_INFO;
value_t * b_arr = (value_t *) malloc( n * sizeof(value_t) );
for ( i = 0; i < n; i++ )
b_arr[i] = rhs( i, n );
hpro_d_vector_import( b, b_arr, & info ); CHECK_INFO;
hpro_d_vector_permute( b, hpro_clt_perm_e2i( ct, & info ), & info ); CHECK_INFO;

Here, hpro_d_vector_import copies the coefficients from b_arr to b and rhs is defined by

value_t
rhs ( int i, int n )
{
const value_t a = ((value_t)i) / ((value_t) n);
const value_t b = ((value_t)i+1.0) / ((value_t) n);
value_t value = -1.5 * (b - a);
if ( fabs( b ) > 1e-8 ) value += 0.5*b*b*log(b);
if ( fabs( a ) > 1e-8 ) value -= 0.5*a*a*log(a);
if ( fabs( 1.0 - b ) > 1e-8 ) value -= 0.5*(1.0-b)*(1.0-b)*log(1.0-b);
if ( fabs( 1.0 - a ) > 1e-8 ) value += 0.5*(1.0-a)*(1.0-a)*log(1.0-a);
return value;
}
Remarks
Instead of using a special array b_arr, the coefficients of b could directly be set using hpro_d_vector_entry_set.

For the iterative solver the special auto solver is used, which automatically chooses a suitable solver for the given combination of matrix and preconditioner. Furthermore, statistics about the solution process is stored in solve_info, e.g. convergence rate, number of steps.

hpro_d_vector_t x = hpro_d_vector_build( n, & info ); CHECK_INFO;
hpro_solver_t solver;
hpro_solve_info_t solve_info;
solver = hpro_solver_auto( & info ); CHECK_INFO;
hpro_d_solver_solve( solver, (hpro_d_linearoperator_t) A, x, b,
A_inv, & solve_info, & info ); CHECK_INFO;
Remarks
Solvers in 𝖧𝖫𝖨𝖡𝗉𝗋𝗈 are based only on matrix vector multiplication and hence, only need the functionality of linear operators. This is an example, where matrices can simply be casted to the hpro_d_linearoperator_t type.

To check the accuracy of the computed solution, we compare it with the known exact solution:

hpro_d_vector_t one = hpro_d_vector_build( n, & info ); CHECK_INFO;
double error;
hpro_d_vector_permute( x, hpro_clt_perm_i2e( ct, & info ), & info ); CHECK_INFO;
hpro_d_vector_fill( one, 1.0, & info ); CHECK_INFO;
hpro_d_vector_axpy( 1.0, one, x, & info ); CHECK_INFO;
error = hpro_d_vector_norm_inf( x, & info ); CHECK_INFO;
printf( " error of solution = %.4e\n", error );

Finally, all resources have to be freed and 𝖧𝖫𝖨𝖡𝗉𝗋𝗈 be finished:

hpro_d_vector_free( one, & info ); CHECK_INFO;
hpro_d_vector_free( x, & info ); CHECK_INFO;
hpro_solver_free( solver, & info ); CHECK_INFO;
hpro_d_vector_free( b, & info ); CHECK_INFO;
hpro_d_linearoperator_free( A_inv, & info ); CHECK_INFO;
hpro_d_matrix_free( B, & info ); CHECK_INFO;
hpro_d_matrix_free( A, & info ); CHECK_INFO;
hpro_bct_free( bct, & info ); CHECK_INFO;
hpro_clt_free( ct, & info ); CHECK_INFO;
hpro_coord_free( coord, & info ); CHECK_INFO;
free( b_arr );
for ( i = 0; i < n; i++ )
free( vertices[i] );
free( vertices );
hpro_done( & info ); CHECK_INFO;
return 0;
}
Remarks
Please note, that the linear operator A_inv and the copy B of A are explicitly freed. By default, A_inv will only use the provided matrix object and does not perform memory management, e.g. deletion.

The Plain Program

#include <stdio.h>
#include <hpro-c.h>
#define CHECK_INFO { if ( info != HPRO_NO_ERROR ) \
{ char buf[1024]; hpro_error_desc( buf, 1024 ); \
printf( "\n%s\n\n", buf ); exit(1); } }
typedef value_t = double;
void
kernel ( const size_t n, const int * rowidx,
const size_t m, const int * colidx,
value_t * matrix, void * arg )
{
int rowi, colj;
value_t h = *((value_t*) arg);
for ( colj = 0; colj < m; colj++ )
{
const int idx1 = colidx[colj];
for ( rowi = 0; rowi < n; rowi++ )
{
const int idx0 = rowidx[rowi];
value_t value;
if ( idx0 == idx1 )
value = -1.5*h*h + h*h*log(h);
else
{
const value_t dist = h * ( fabs( (value_t) (idx0-idx1) ) - 1.0 );
const value_t t1 = dist+1.0*h;
const value_t t2 = dist+2.0*h;
value = ( - 1.5*h*h + 0.5*t2*t2*log(t2) - t1*t1*log(t1) );
if ( fabs(dist) > 1e-8 )
value += 0.5*dist*dist*log(dist);
}
matrix[(colj*n) + rowi] = -value;
}
}
}
value_t
rhs ( int i, int n )
{
const value_t a = ((value_t)i) / ((value_t) n);
const value_t b = ((value_t)i+1.0) / ((value_t) n);
value_t value = -1.5 * (b - a);
if ( fabs( b ) > 1e-8 ) value += 0.5*b*b*log(b);
if ( fabs( a ) > 1e-8 ) value -= 0.5*a*a*log(a);
if ( fabs( 1.0 - b ) > 1e-8 ) value -= 0.5*(1.0-b)*(1.0-b)*log(1.0-b);
if ( fabs( 1.0 - a ) > 1e-8 ) value += 0.5*(1.0-a)*(1.0-a)*log(1.0-a);
return value;
}
int
main ( int argc, char ** argv )
{
int info;
int i;
int n = ... /* set problem dimension */
double h = 1.0 / ((double) n);
double ** vertices;
hpro_coord_t coord;
hpro_clustertree_t ct;
hpro_blockclustertree_t bct;
hpro_acc_t acc;
hpro_d_matrix_t A, B;
hpro_d_linearoperator_t A_inv;
hpro_d_vector_t b;
value_t * b_arr = NULL;
hpro_d_vector_t x;
hpro_solver_t solver;
hpro_solve_info_t solve_info;
hpro_d_vector_t one;
double error;
hpro_init( & info ); CHECK_INFO;
hpro_set_verbosity( 2 );
vertices = (double**) malloc( n * sizeof(double*) );
for ( i = 0; i < n; i++ )
{
vertices[i] = (double*) malloc( sizeof(double) );
vertices[i][0] = h * ((double) i) + (h / 2.0);
}
coord = hpro_coord_import( n, 1, vertices, NULL, & info ); CHECK_INFO;
ct = hpro_clt_build_bsp( coord, HPRO_BSP_AUTO, 20, & info ); CHECK_INFO;
bct = hpro_bct_build( ct, ct, adm, & info ); CHECK_INFO;
acc = hpro_acc_fixed_eps( 1e-4 );
A = hpro_d_matrix_build_coeff( bct, kernel, & h, HPRO_LRAPX_ACAPLUS,
acc, 1, & info ); CHECK_INFO;
B = hpro_d_matrix_copy( A, & info ); CHECK_INFO;
A_inv = hpro_d_matrix_factorise_inv( B, acc, & info ); CHECK_INFO;
b = hpro_d_vector_build( n, & info ); CHECK_INFO;
b_arr = (value_t *) malloc( n * sizeof(value_t) );
for ( i = 0; i < n; i++ )
b_arr[i] = rhs( i, n );
hpro_d_vector_import( b, b_arr, & info ); CHECK_INFO;
hpro_d_vector_permute( b, hpro_clt_perm_e2i( ct, & info ), & info ); CHECK_INFO;
x = hpro_d_vector_build( n, & info ); CHECK_INFO;
solver = hpro_solver_auto( & info ); CHECK_INFO;
hpro_d_solver_solve( solver, (hpro_d_linearoperator_t) A, x, b,
A_inv, & solve_info, & info ); CHECK_INFO;
hpro_d_vector_permute( x, hpro_clt_perm_i2e( ct, & info ), & info ); CHECK_INFO;
one = hpro_d_vector_build( n, & info ); CHECK_INFO;
hpro_d_vector_fill( one, 1.0, & info ); CHECK_INFO;
hpro_d_vector_axpy( 1.0, one, x, & info ); CHECK_INFO;
error = hpro_d_vector_norm_inf( x, & info ); CHECK_INFO;
printf( " error of solution = %.4e\n", error );
hpro_d_vector_free( one, & info ); CHECK_INFO;
hpro_d_vector_free( x, & info ); CHECK_INFO;
hpro_solver_free( solver, & info ); CHECK_INFO;
hpro_d_vector_free( b, & info ); CHECK_INFO;
hpro_d_linearoperator_free( A_inv, & info ); CHECK_INFO;
hpro_d_matrix_free( B, & info ); CHECK_INFO;
hpro_d_matrix_free( A, & info ); CHECK_INFO;
hpro_bct_free( bct, & info ); CHECK_INFO;


text:
# Dimensional analysis - quantum and classical lengthscale ratio

1. Apr 21, 2012

### kapitan90

1. The problem statement, all variables and given/known data
I was supposed to use dimensional analysis to approximate the length scale (in classical and quantum mechanics). The results I got(same as those in the answer sheet): classicaly$$l_c≈\frac{e^2}{4πm_ec^2ε_0}≈2.8*10^-15m$$ In quantum mechanics$$l_q≈\frac{h}{m_ec}≈2.4*10^-12m$$

2. Relevant equations
The next question is: how would your analysis in case of $$l_q$$have to change if $$l_q≈l_c?$$

3. The attempt at a solution
I have the answer to question b), but I don't think I understand it. The answer they give is:
'If$$l_q≈l_c$$ it would not be possible to estimate l_q without considering electromagnetic effects and write $$l_q=f(\frac{l_c}{l_q})$$ In fact ratio l_c/l_q is is small (apart from a factor of 2π it is just the fine structure constant).'