text:
# Properties

 Label 114.2.h.f Level $114$ Weight $2$ Character orbit 114.h Analytic conductor $0.910$ Analytic rank $0$ Dimension $4$ CM no Inner twists $2$

# Related objects

## Newspace parameters

 Level: $$N$$ $$=$$ $$114 = 2 \cdot 3 \cdot 19$$ Weight: $$k$$ $$=$$ $$2$$ Character orbit: $$[\chi]$$ $$=$$ 114.h (of order $$6$$, degree $$2$$, minimal)

## Newform invariants

 Self dual: no Analytic conductor: $$0.910294583043$$ Analytic rank: $$0$$ Dimension: $$4$$ Relative dimension: $$2$$ over $$\Q(\zeta_{6})$$ Coefficient field: $$\Q(\sqrt{-2}, \sqrt{-3})$$ Defining polynomial: $$x^{4} - 2 x^{2} + 4$$ Coefficient ring: $$\Z[a_1, a_2, a_3]$$ Coefficient ring index: $$1$$ Twist minimal: yes Sato-Tate group: $\mathrm{SU}(2)[C_{6}]$

## $q$-expansion

Coefficients of the $$q$$-expansion are expressed in terms of a basis $$1,\beta_1,\beta_2,\beta_3$$ for the coefficient ring described below. We also show the integral $$q$$-expansion of the trace form.

 $$f(q)$$ $$=$$ $$q + ( 1 - \beta_{2} ) q^{2} + ( -\beta_{1} + \beta_{2} + \beta_{3} ) q^{3} -\beta_{2} q^{4} + \beta_{1} q^{5} + ( 1 + \beta_{3} ) q^{6} + ( 2 + 2 \beta_{1} - \beta_{3} ) q^{7} - q^{8} + ( 1 - 2 \beta_{1} - \beta_{2} ) q^{9} +O(q^{10})$$ $$q + ( 1 - \beta_{2} ) q^{2} + ( -\beta_{1} + \beta_{2} + \beta_{3} ) q^{3} -\beta_{2} q^{4} + \beta_{1} q^{5} + ( 1 + \beta_{3} ) q^{6} + ( 2 + 2 \beta_{1} - \beta_{3} ) q^{7} - q^{8} + ( 1 - 2 \beta_{1} - \beta_{2} ) q^{9} + ( \beta_{1} - \beta_{3} ) q^{10} + ( -1 + 2 \beta_{2} - \beta_{3} ) q^{11} + ( 1 + \beta_{1} - \beta_{2} ) q^{12} + ( -4 + 2 \beta_{2} ) q^{13} + ( 2 + \beta_{1} - 2 \beta_{2} - 2 \beta_{3} ) q^{14} + ( -2 + \beta_{3} ) q^{15} + ( -1 + \beta_{2} ) q^{16} + ( -2 - 2 \beta_{1} - 2 \beta_{2} ) q^{17} + ( -2 \beta_{1} - \beta_{2} + 2 \beta_{3} ) q^{18} + ( -3 \beta_{1} - \beta_{2} + 3 \beta_{3} ) q^{19} -\beta_{3} q^{20} + ( -4 - \beta_{1} + 4 \beta_{2} + 3 \beta_{3} ) q^{21} + ( 1 - \beta_{1} + \beta_{2} ) q^{22} + ( 5 \beta_{1} - 5 \beta_{3} ) q^{23} + ( \beta_{1} - \beta_{2} - \beta_{3} ) q^{24} -3 \beta_{2} q^{25} + ( -2 + 4 \beta_{2} ) q^{26} + ( 5 - \beta_{3} ) q^{27} + ( -\beta_{1} - 2 \beta_{2} - \beta_{3} ) q^{28} + ( -\beta_{1} - \beta_{3} ) q^{29} + ( -2 + \beta_{1} + 2 \beta_{2} ) q^{30} + 3 \beta_{3} q^{31} + \beta_{2} q^{32} + ( -2 + 3 \beta_{2} - 2 \beta_{3} ) q^{33} + ( -4 - 2 \beta_{1} + 2 \beta_{2} + 2 \beta_{3} ) q^{34} + ( 2 + 2 \beta_{1} + 2 \beta_{2} ) q^{35} + ( -1 + 2 \beta_{3} ) q^{36} + ( -2 + 4 \beta_{2} - 3 \beta_{3} ) q^{37} + ( -1 + 3 \beta_{3} ) q^{38} + ( -2 + 2 \beta_{1} - 2 \beta_{2} - 4 \beta_{3} ) q^{39} -\beta_{1} q^{40} + ( -3 + 3 \beta_{2} ) q^{41} + ( 2 \beta_{1} + 4 \beta_{2} + \beta_{3} ) q^{42} + ( 4 - 2 \beta_{1} - 4 \beta_{2} + 4 \beta_{3} ) q^{43} + ( 2 - \beta_{1} - \beta_{2} + \beta_{3} ) q^{44} + ( \beta_{1} - 4 \beta_{2} - \beta_{3} ) q^{45} -5 \beta_{3} q^{46} + ( 4 - 7 \beta_{1} - 2 \beta_{2} + 7 \beta_{3} ) q^{47} + ( -1 - \beta_{3} ) q^{48} + ( 3 + 8 \beta_{1} - 4 \beta_{3} ) q^{49} -3 q^{50} + ( 6 + 4 \beta_{1} - 4 \beta_{2} - 4 \beta_{3} ) q^{51} + ( 2 + 2 \beta_{2} ) q^{52} + ( 2 \beta_{1} - 6 \beta_{2} + 2 \beta_{3} ) q^{53} + ( 5 - \beta_{1} - 5 \beta_{2} ) q^{54} + ( 2 - \beta_{1} - 2 \beta_{2} + 2 \beta_{3} ) q^{55} + ( -2 - 2 \beta_{1} + \beta_{3} ) q^{56} + ( 7 - 2 \beta_{1} - 7 \beta_{2} ) q^{57} + ( -2 \beta_{1} + \beta_{3} ) q^{58} + ( 9 - \beta_{1} - 9 \beta_{2} + 2 \beta_{3} ) q^{59} + ( \beta_{1} + 2 \beta_{2} - \beta_{3} ) q^{60} + ( \beta_{1} + 4 \beta_{2} + \beta_{3} ) q^{61} + 3 \beta_{1} q^{62} + ( -2 - 3 \beta_{1} - 6 \beta_{2} - 2 \beta_{3} ) q^{63} + q^{64} + ( -4 \beta_{1} + 2 \beta_{3} ) q^{65} + ( 1 - 2 \beta_{1} + 2 \beta_{2} ) q^{66} + ( -2 - 3 \beta_{1} + \beta_{2} + 3 \beta_{3} ) q^{67} + ( -2 + 4 \beta_{2} + 2 \beta_{3} ) q^{68} + ( -10 + 5 \beta_{1} + 10 \beta_{2} ) q^{69} + ( 4 + 2 \beta_{1} - 2 \beta_{2} - 2 \beta_{3} ) q^{70} + ( 6 - 6 \beta_{2} ) q^{71} + ( -1 + 2 \beta_{1} + \beta_{2} ) q^{72} + ( 1 + 4 \beta_{1} - \beta_{2} - 8 \beta_{3} ) q^{73} + ( 2 - 3 \beta_{1} + 2 \beta_{2} ) q^{74} + ( 3 + 3 \beta_{1} - 3 \beta_{2} ) q^{75} + ( -1 + 3 \beta_{1} + \beta_{2} ) q^{76} + \beta_{3} q^{77} + ( -4 - 2 \beta_{1} + 2 \beta_{2} - 2 \beta_{3} ) q^{78} + 6 \beta_{1} q^{79} + ( -\beta_{1} + \beta_{3} ) q^{80} + ( -4 \beta_{1} + 7 \beta_{2} + 4 \beta_{3} ) q^{81} + 3 \beta_{2} q^{82} + ( -9 + 18 \beta_{2} - \beta_{3} ) q^{83} + ( 4 + 3 \beta_{1} - 2 \beta_{3} ) q^{84} + ( -2 \beta_{1} - 4 \beta_{2} - 2 \beta_{3} ) q^{85} + ( 2 \beta_{1} - 4 \beta_{2} + 2 \beta_{3} ) q^{86} + ( 2 + \beta_{1} + 2 \beta_{2} - 2 \beta_{3} ) q^{87} + ( 1 - 2 \beta_{2} + \beta_{3} ) q^{88} + ( 2 \beta_{1} + 12 \beta_{2} + 2 \beta_{3} ) q^{89} + ( -4 - \beta_{3} ) q^{90} + ( -8 - 6 \beta_{1} + 4 \beta_{2} + 6 \beta_{3} ) q^{91} -5 \beta_{1} q^{92} + ( -3 \beta_{1} - 6 \beta_{2} + 3 \beta_{3} ) q^{93} + ( 2 - 4 \beta_{2} + 7 \beta_{3} ) q^{94} + ( -6 - \beta_{3} ) q^{95} + ( -1 - \beta_{1} + \beta_{2} ) q^{96} + ( -3 - 6 \beta_{1} - 3 \beta_{2} ) q^{97} + ( 3 + 4 \beta_{1} - 3 \beta_{2} - 8 \beta_{3} ) q^{98} + ( -3 + \beta_{1} + 5 \beta_{2} - 4 \beta_{3} ) q^{99} +O(q^{100})$$ $$\operatorname{Tr}(f)(q)$$ $$=$$ $$4q + 2q^{2} + 2q^{3} - 2q^{4} + 4q^{6} + 8q^{7} - 4q^{8} + 2q^{9} + O(q^{10})$$ $$4q + 2q^{2} + 2q^{3} - 2q^{4} + 4q^{6} + 8q^{7} - 4q^{8} + 2q^{9} + 2q^{12} - 12q^{13} + 4q^{14} - 8q^{15} - 2q^{16} - 12q^{17} - 2q^{18} - 2q^{19} - 8q^{21} + 6q^{22} - 2q^{24} - 6q^{25} + 20q^{27} - 4q^{28} - 4q^{30} + 2q^{32} - 2q^{33} - 12q^{34} + 12q^{35} - 4q^{36} - 4q^{38} - 12q^{39} - 6q^{41} + 8q^{42} + 8q^{43} + 6q^{44} - 8q^{45} + 12q^{47} - 4q^{48} + 12q^{49} - 12q^{50} + 16q^{51} + 12q^{52} - 12q^{53} + 10q^{54} + 4q^{55} - 8q^{56} + 14q^{57} + 18q^{59} + 4q^{60} + 8q^{61} - 20q^{63} + 4q^{64} + 8q^{66} - 6q^{67} - 20q^{69} + 12q^{70} + 12q^{71} - 2q^{72} + 2q^{73} + 12q^{74} + 6q^{75} - 2q^{76} - 12q^{78} + 14q^{81} + 6q^{82} + 16q^{84} - 8q^{85} - 8q^{86} + 12q^{87} + 24q^{89} - 16q^{90} - 24q^{91} - 12q^{93} - 24q^{95} - 2q^{96} - 18q^{97} + 6q^{98} - 2q^{99} + O(q^{100})$$

Basis of coefficient ring in terms of a root $$\nu$$ of $$x^{4} - 2 x^{2} + 4$$:

 $$\beta_{0}$$ $$=$$ $$1$$ $$\beta_{1}$$ $$=$$ $$\nu$$ $$\beta_{2}$$ $$=$$ $$\nu^{2}$$$$/2$$ $$\beta_{3}$$ $$=$$ $$\nu^{3}$$$$/2$$
 $$1$$ $$=$$ $$\beta_0$$ $$\nu$$ $$=$$ $$\beta_{1}$$ $$\nu^{2}$$ $$=$$ $$2 \beta_{2}$$ $$\nu^{3}$$ $$=$$ $$2 \beta_{3}$$

## Character values

We give the values of $$\chi$$ on generators for $$\left(\mathbb{Z}/114\mathbb{Z}\right)^\times$$.

 $$n$$ $$77$$ $$97$$ $$\chi(n)$$ $$-1$$ $$\beta_{2}$$

## Embeddings

For each embedding $$\iota_m$$ of the coefficient field, the values $$\iota_m(a_n)$$ are shown below.

For more information on an embedded modular form you can click on its label.

Label $$\iota_m(\nu)$$ $$a_{2}$$ $$a_{3}$$ $$a_{4}$$ $$a_{5}$$ $$a_{6}$$ $$a_{7}$$ $$a_{8}$$ $$a_{9}$$ $$a_{10}$$
65.1
 1.22474 + 0.707107i −1.22474 − 0.707107i 1.22474 − 0.707107i −1.22474 + 0.707107i
0.500000 0.866025i −0.724745 + 1.57313i −0.500000 0.866025i 1.22474 + 0.707107i 1.00000 + 1.41421i 4.44949 −1.00000 −1.94949 2.28024i 1.22474 0.707107i
65.2 0.500000 0.866025i 1.72474 + 0.158919i −0.500000 0.866025i −1.22474 0.707107i 1.00000 1.41421i −0.449490 −1.00000 2.94949 + 0.548188i −1.22474 + 0.707107i
107.1 0.500000 + 0.866025i −0.724745 1.57313i −0.500000 + 0.866025i 1.22474 0.707107i 1.00000 1.41421i 4.44949 −1.00000 −1.94949 + 2.28024i 1.22474 + 0.707107i
107.2 0.500000 + 0.866025i 1.72474 0.158919i −0.500000 + 0.866025i −1.22474 + 0.707107i 1.00000 + 1.41421i −0.449490 −1.00000 2.94949 0.548188i −1.22474 0.707107i
 $$n$$: e.g. 2-40 or 990-1000 Significant digits: Format: Complex embeddings Normalized embeddings Satake parameters Satake angles

## Inner twists

Char Parity Ord Mult Type
1.a even 1 1 trivial
57.f even 6 1 inner

## Twists

By twisting character orbit
Char Parity Ord Mult Type Twist Min Dim
1.a even 1 1 trivial 114.2.h.f yes 4
3.b odd 2 1 114.2.h.e 4
4.b odd 2 1 912.2.bn.h 4
12.b even 2 1 912.2.bn.g 4
19.d odd 6 1 114.2.h.e 4
57.f even 6 1 inner 114.2.h.f yes 4
76.f even 6 1 912.2.bn.g 4
228.n odd 6 1 912.2.bn.h 4

By twisted newform orbit
Twist Min Dim Char Parity Ord Mult Type
114.2.h.e 4 3.b odd 2 1
114.2.h.e 4 19.d odd 6 1
114.2.h.f yes 4 1.a even 1 1 trivial
114.2.h.f yes 4 57.f even 6 1 inner
912.2.bn.g 4 12.b even 2 1
912.2.bn.g 4 76.f even 6 1
912.2.bn.h 4 4.b odd 2 1
912.2.bn.h 4 228.n odd 6 1

## Hecke kernels

This newform subspace can be constructed as the intersection of the kernels of the following linear operators acting on $$S_{2}^{\mathrm{new}}(114, [\chi])$$:

 $$T_{5}^{4} - 2 T_{5}^{2} + 4$$ $$T_{7}^{2} - 4 T_{7} - 2$$ $$T_{17}^{4} + 12 T_{17}^{3} + 52 T_{17}^{2} + 48 T_{17} + 16$$

## Hecke characteristic polynomials

$p$ $F_p(T)$
$2$ $$( 1 - T + T^{2} )^{2}$$
$3$ $$9 - 6 T + T^{2} - 2 T^{3} + T^{4}$$
$5$ $$4 - 2 T^{2} + T^{4}$$
$7$ $$( -2 - 4 T + T^{2} )^{2}$$
$11$ $$1 + 10 T^{2} + T^{4}$$
$13$ $$( 12 + 6 T + T^{2} )^{2}$$
$17$ $$16 + 48 T + 52 T^{2} + 12 T^{3} + T^{4}$$
$19$ $$361 + 38 T - 15 T^{2} + 2 T^{3} + T^{4}$$
$23$ $$2500 - 50 T^{2} + T^{4}$$
$29$ $$36 + 6 T^{2} + T^{4}$$
$31$ $$( 18 + T^{2} )^{2}$$
$37$ $$36 + 60 T^{2} + T^{4}$$
$41$ $$( 9 + 3 T + T^{2} )^{2}$$
$43$ $$64 + 64 T + 72 T^{2} - 8 T^{3} + T^{4}$$
$47$ $$7396 + 1032 T - 38 T^{2} - 12 T^{3} + T^{4}$$
$53$ $$144 + 144 T + 132 T^{2} + 12 T^{3} + T^{4}$$
$59$ $$5625 - 1350 T + 249 T^{2} - 18 T^{3} + T^{4}$$
$61$ $$100 - 80 T + 54 T^{2} - 8 T^{3} + T^{4}$$
$67$ $$225 - 90 T - 3 T^{2} + 6 T^{3} + T^{4}$$
$71$ $$( 36 - 6 T + T^{2} )^{2}$$
$73$ $$9025 + 190 T + 99 T^{2} - 2 T^{3} + T^{4}$$
$79$ $$5184 - 72 T^{2} + T^{4}$$
$83$ $$58081 + 490 T^{2} + T^{4}$$
$89$ $$14400 - 2880 T + 456 T^{2} - 24 T^{3} + T^{4}$$
$97$ $$2025 - 810 T + 63 T^{2} + 18 T^{3} + T^{4}$$


text:
# Postgresql – Meaning of precision 1, scale 0 in error message

errorsnumber formattingpostgresql

What datatype does this error message refer to?

ERROR:  numeric field overflow
DETAIL:  A field with precision 1, scale 0 must round to an absolute value less than 10^1.

I'm getting the error listed above, it's coming from an insert trigger. Since none of my datatype are explicitly defined as NUMERIC(1,0) and since the maximum value is 10 to the power of 1 (i.e. 10) I'm guessing that this error is actually referring to a BOOLEAN field. However, I can't find confirmation of this.

UPDATE
Solved. My trigger is attempting to parse some strings into numbers. The error listed is returned when to_number() doesn't get a string in the expected format.

This returns 1.4 (correct) –

select to_number('1.4','9D9');

This returns the aforementioned error

select to_number('1d4','9D9');

Still not quite sure why it's complaining about NUMERIC(1,0) but at least I know why there's an error.

That's because to_number() drops anything but data characters from the input string. Data characters are: digits, sign, decimal point, and comma. Noise characters are not insignificant though, as they still count against the length of the format pattern. So:

SELECT to_number('1d4','9D9');

is effectively the same as:

SELECT to_number('14','9D9');

Both fail because the pattern '9D9' only allows a single digit before the comma.

But this valid expression:

SELECT to_number('1X4','99D9');  -- added digit to pattern

is not the same as:

SELECT to_number('1XXX4','99D9');

To much noise truncates the input.

db<>fiddle here

And, yes, D is a format specifier for a decimal point (independent of locale) in the pattern string (2nd function argument), but not in the input string (1st function argument). You found that yourself already.

To address the question in the title - Postgres has a definition in the manual:

The precision of a numeric is the total count of significant digits in the whole number, that is, the number of digits to both sides of the decimal point. The scale of a numeric is the count of decimal digits in the fractional part, to the right of the decimal point. So the number 23.5141 has a precision of 6 and a scale of 4. Integers can be considered to have a scale of zero.

That said, I see two Postgres issues here:

### 1. Missing documentation

It's not documented in the manual that to_number() ignores non-data characters in the input. Nor that those still count against the total length of the pattern.

### 2. Bug in error message

There seems to be an error in the DETAIL of the error message. The observed:

DETAIL:  A field with precision 1, scale 0 must round to an absolute value less than 10^1.

Should really be:

DETAIL:  A field with precision 2, scale 1 must round to an absolute value less than 10^1.

The effect is the same, so the behavior is coherent. But the information is misleading.

format: plain


text:
# Introduction to Microcontrollers - Buttons and Bouncing

### What Is A Button?

To your hardware, that is.  As discussed in Introduction to Microcontrollers - More On GPIO, a button (or key, or switch, or any form of mechanical contact) is generally hooked up to a microcontroller so as to generate a certain logic level when pushed or closed or "active," and the opposite logic level when unpushed or open or "inactive."  The active logic level can be either '0' or '1', but for reasons both historical and electrical, an active level of '0' is more common.  Here is the basic button connection to a GPIO input, which we saw in the earlier tutorial chapter:

When the switch is open, the pullup or pulldown causes the GPIO input pin to see the inactive logic state, but when the switch is closed it overrides the resistor and causes the GPIO input pin to see the active logic state.  As a reminder, drawing 'A' shows an active-high button, while drawing 'B' shows an active-low button.

### What Does A Button Look Like?

To your code, that is.  The simplest way to represent a button is as a boolean, or as a single zero or non-zero byte.  One button, one byte.  Call this Method 1, or the Boolean-per-Button method.  It's simple because there is no masking required, either in setting the variable or in reading it.  The drawback of this approach is that it makes it difficult to check for all the different button possibilities in your system (16 buttons = 16 bytes to test).

Another way to represent a button is as a boolean which is is one bit of a byte or 16-bit word.  Now you can have a single byte or word that can hold the state of up to 8 or 16 completely independent buttons (or 32 if you want to go to a 32-bit value).  This button aggregate is easy to process in a "switch" statement, and it also provides the ability to check for multiple simultaneous button pushes.  By "independent" buttons we mean buttons that can be pressed and recognized regardless of the state of any of the other buttons.  This situation or requirement is actually much more common for switches than for buttons, but remember we are treating switches and buttons and keys all the same here.  Call this Method 2, or the Bit-per-Button method.

Finally, one can represent the state of multiple non-independent buttons as a single value.  Take a calculator keyboard for example.  With a calculator there is probably only one keypress allowed at any given time, so a calculator with 20 or 30 buttons can represent all the possible valid button pushes with a single variable that can hold 20 or 30 values.  In this case, 30 buttons can be represented by only 5 bits, since the buttons are not independent and thus most (or even all) combinations of multiple buttons are illegal.  Call this Method 3, or the Single-Value method.

For the most part, all the examples in this tutorial section will represent buttons according to methods 2 or 3 - that is, as an 8 or 16-bit variable that either represents multiple independent buttons or that represents a unique value among non-independent buttons.

### Button Debouncing, Revisited

You may remember in Introduction to Microcontrollers - More On GPIO that we saw some scary scope images of switch bounces.  Every system that uses any kind of mechanical switch must deal with the issue of debouncing.  The key task is to make sure that one mechanical switch or button action is only read as one action by the microcontroller, even though the microcontroller will typically be fast enough to detect the unwanted switch bounces and treat them as separate events.  Bouncing can be eliminated by special ICs or by RC circuitry, but in most cases debouncing is done in software because software is "free." (a software person should always carry tomatoes to throw at this point)

Scary images of switch bouncing, redux:

The key to debouncing is to establish a minimum criterion for a valid button push, one that can be implemented in software.  This criterion must involve differences in time - two button presses in 20ms must be treated as one button event, while two button presses in 2 seconds must be treated as two button events.  So what are the relevant times we need to consider?  They are these:

• Bounce time:  most buttons seem to stop bouncing within 10ms
• Button press time: the shortest time a user can press and release a button seems to be between 50 and 100ms
• Response time: a user notices if the system response is 100ms after the button press, but not if it is 50ms after

Combining all of these times, we can set a few goals

• Ignore all bouncing within 10ms
• Provide a response within 50ms of detecting a button push (or release)
• Be able to detect a 50ms push and a 50ms release

The simplest debouncing method is to examine the keys (or buttons or switches) every N milliseconds, where N > 10ms (our specified button bounce upper limit) and N <= 50ms (our specified response time).  This is the method we used in the last chapter with our example cyclic executive program STM32_LCD2.  We then have three possible outcomes every time we read a button:

1. We read the button in the solid '0' state
2. We read the button in the solid '1' state
3. We read the button while it is bouncing (so we will get either a '0' or a '1')

Outcomes 1 and 2 pose no problems, as they are what we'd always like to happen.  Outcome 3 also poses no problem because during a bounce either state is acceptable.  If we have just pressed an active-low button and we read a '1' as it bounces, the next time through we are guaranteed to read a '0' (remember, the next time through all bouncing will have ceased), so we will just detect the button push a bit later.  Otherwise, if we read a '0' as the button bounces, it will still be '0' the next time after all bouncing has stopped, so we are just detecting the button push a bit earlier.  The same applies to releasing a button.  Reading a single bounce (with all bouncing over by the time of the next read) will never give us an invalid button state.  It's only reading multiple bounces (multiple reads while bouncing is occurring) that can give invalid button states such as repeated push signals from one physical push.

So if we guarantee that all bouncing is done by the time we next read the button, we're good.  Well, almost good, if we're lucky...

### Noise, We Don't Have No Stinking Noise!

Don't we?  Well, maybe we don't.  Or maybe we do.  Sometimes.  Microcontrollers often live among high-energy beasts, and often control the beasts.  High energy devices make electrical noise, sometimes great amounts of electrical noise.  This noise can, at the worst possible moment, get into your delicate button-and-high-value-pullup circuit and act like a real button push.  Oops, missile launched, sorry!

If the noise is too intense we cannot filter it out using only software, but will need hardware of some sort (or even a redesign).  But if the noise is only occasional, we can filter it out in software without too much bother.  The trick is that instead of regarding a single button 'make' or 'break' as valid, we insist on N contiguous makes or breaks to mark a valid button event.  N will be a factor of your button scanning rate and the amount of filtering you want to add.  Bigger N gives more filtering.  The simplest filter (but still a big improvement over no filtering) is just an N of 2, which means compare the current button state with the last button state, and only if both are the same is the output valid.

Note that now we have not two but three button states: active (or pressed), inactive (or released), and indeterminate or invalid (in the middle of filtering, not yet filtered).  In most cases we can treat the invalid state the same as the inactive state, since we care in most cases only about when we go active (from whatever state) and when we cease being active (to inactive or invalid).  With that simplification we can look at simple N=2 filtering (representing buttons using Method 2), reading 4 buttons wired active-low to AVR PC0-PC3:

u8 filter_buttons_N2(void)
{
static u8 last_buttons = 0;  // up to 8 buttons, all inactive
u8 raw_buttons;
u8 filtered_buttons;

raw_buttons = ~PINC & 0x0f;  // read 4 buttons (PINC is active-low), active state = '1'
filtered_buttons = raw_buttons & last_buttons;  // N=2 filtering
last_buttons = raw_buttons;  // save for next filtering
return filtered_buttons;     // only active if active this time and last time
}

The function filter_buttons_N2() must be called no more often than our debounce time (10ms).  Typically it would be called every 10-25ms.  Each time it reads the 4 active-low buttons on PINC, inverts them to active-high, and filters them by ANDing them with the last reading.  Only if both readings had a given button high (pressed) will the result be high (pressed).  Note that we can filter up to 8 buttons at a time, one per bit position, with this method (16 if we used u16 button variables).

To expand to greater filtering (larger N), keep in mind that the filtering technique essentially involves reading the current button state and then either counting or reseting the counter.  We count if the current button state is the same as the last button state, and if our count reaches N we then report a valid new button state.  We reset the counter if the current button state is different than the last button state, and we then save the current button state as the new button state to compare against the next time.  Also note that the larger our value of N the more often our filtering routine must be called, so that we get a filtered response within our specified 50ms deadline.  So for example with an N of 8 we should be calling our filtering routine every 2 - 5ms, giving a response time of 16 - 40ms (>10ms and <50ms).

The details of the filtering depend on whether the value to be filtered is a simple binary (a single button), or is a multi-value variable such as the state of a button matrix.  If the value is a simple binary, we can do some tricks with bit-shifting to find our N consecutive states.  For simplicity, let us first choose N to be 8 or 16 or 32 - that is, the number of bits in a u8, u16 or u32.  Let's choose a u8 for this example.  Now, every time we sample the button state, we simply shift that state into a u8 "accumulator" variable.  Thus the u8 variable will maintain the last 8 button samples.  When the variable contains 0b00000000 then we have 8 contiguous 0s, and we have a valid filtered '0' output.  Similarly, when the variable contains 0b11111111 then we have a valid filtered '1' output.  Any other value is indeterminate.  So all we have to do is shift the current state into the variable and compare for 0 or ~0 (remember that the '~' operator is the bitwise inversion operator).  Thus ~0 is ~0b00000000 is 0b11111111.  OK, to be more correct, (u8)~0 is 0b11111111.  Since we are now using an entire byte (or word) to represent one button, this is a variant of Method 1.  In this case our button is assumed to be active-low, wired to PC3.

u8 filter_button_N8(void)
{

button_acc <<= 1;           // shift out oldest state, make new state a 0
if (~PINC & (1<<3))
button_acc |= 1;          // button on PC3 is active (low), shift in a 1
return button_acc;          // 0 is inactive, ~0 is active, others indeterminate
//
//return (button_acc == ~0) ? 1 : 0; // alternately, return 1 for active, 0 otherwise
//
}

### But I Want An N Of 5!

N values of 8, 16 or 32 are especially easy to deal with, but they may not fit in with your timing constraints; especially, your timer tick rate.  That's OK, since other N values are also useable.  For example, let's choose an N of 5.  That means we want to use the last 4 inputs along with the current input in our filtering.  If we were to use the method described above, we would have a valid filtered '0' with the byte 0bxxx00000, and a valid filtered '1' with the byte 0bxxx11111.  Hmm, those 'x's are a problem, but not a big one.  We have two approaches to deal with them.  We can either just AND off those bits and compare to 0b00000 or 0b11111, or we can stuff in more bits every time we read the button state and continue to compare with 0 or ~0 to look for a valid filtered input.  Using the latter approach in our N=5 example, instead of adding a single bit into the accumulating variable, we'll add 4 bits - 0b0000 if the current button state is '0', or 0b1111 if the current button state is '1'.  The general rule is to add in 8-N+1 bits of all 0s or all 1s.  This even works for N=1 - we would then add 0b11111111 or 0b00000000, which is just the 0 or ~0 that we will compare with.

By the way, there's a simple way to define the values we will AND or OR to our accumulator variable, based on the value of N.  This is one application of the useful pattern (1<<X)-1, which will give a value or mask of all '1's in the rightmost (least significant) X bits.

#define BUTTON_VAL ((1<<(8-N+1)-1)  // for N=5, this is 0b00001111

Now our input and filtering routine looks like this:

#define N           5
#define BUTTON_VAL  ((1<<(8-N+1))-1)  // for N=5 this is 0b00001111

u8 filter_button_N5(void)
{

button_acc <<= 1;           // shift out oldest state
if (~PINC & (1<<3))
button_acc |= BUTTON_VAL; // button on PC3 is active (low), load in 1s
else
button_acc &= ~BUTTON_VAL;  // button is inactive (high), load in 0s
return button_acc;          // 0 is inactive, ~0 is active, others indeterminate
//
// return (button_acc == ~0) ? 1 : 0; // alternately, return 1 for active, 0 otherwise
//
}

### Expanding This Filter Method To Multiple Independent Buttons

As you can see above, the bit-shift filter method can only deal with one button at a time (in our examples, we hardwired that button to be PC3).  Of course in the usual case we want a more general ability to filter multiple buttons.  To do this we can create suitable data structures that encapsulate all the necessary data for a given button, and pass in the associated structure to a filter program for each button.

typedef struct
{
u8  b_num;  // the bit position of this button on our button port
u8  b_acc;  // the button accumulator
u8  b_val;  // the boolean button val (active or other)
} B_DATA;

u8 filter_button_N8(B_DATA * p_bd)
{
p_bd->b_acc <<= 1;          // shift out oldest state, make new state a 0
if (~PINC & (1<<p_bd->b_num))
p_bd->b_acc |= 1;           // button on PC3 is active (low), shift in a 1
return p_bd->b_acc;         // 0 is inactive, ~0 is active, others indeterminate
//
//p_bd->b_val = (p_bd->b_acc == ~0) ? 1 : 0;
//return (p_bd->b_val; // alternately, return 1 for active, 0 otherwise
//
}

Here we are still hard-wiring the button port (PINC), but not the bits within the port.  We can now maintain an array of B_DATA structures, one for each button, and filter all the buttons in a loop.

#define NUM_B 6
B_DATA Button_data[NUM_B]  // elements must be initialized before use

void filter_all_buttons_N8(void)
{
u8 i;

for (i = 0; i < NUM_B; i++)
filter_button_N8(&Button_data[i]);  // results are in b_acc and b_val for each i
}

We can also collect all of our filtered buttons into a button byte or word (Method 2) if we like.  Here we have altered filter_button_N8() to return a '1' if the filtered button is active and a '0' otherwise, to make our bit shifting easier:

u8 filter_button_N8(B_DATA * p_bd)
{
p_bd->b_acc <<= 1;          // shift out oldest state, make new state a 0
if (~PINC & (1<<p_bd->b_num))
p_bd->b_acc |= 1;           // button on PC3 is active (low), shift in a 1
p_bd->b_val = (p_bd->b_acc == ~0) ? 1 : 0;
return p_bd->b_val;         // return 1 for active, 0 otherwise
}

u8 filter_all_buttons_N8(void)
{
i8 i;
u8 b;
u8 buttons = 0;

for (i = NUM_B - 1; i >= 0; i--)  // notice reverse count order, to accomodate left shift
{
b = filter_button_N8(&Button_data[i]); // results are in b_acc and b_val for each i
buttons = (buttons << 1) | b;          // b must be 0 or 1
}
return buttons;
}

### When Does A Button Press End?

It's pretty clear when a button press begins, but when does it end?  Imagine a perfect button - no bouncing, no noise.  This button is in a vending machine, and pressing the button once is intended to cause the machine to deliver one can of Tazmanian Cola:

// assume buttons filtered and checked every 50ms
u8 buttons = filter_buttons();  // GPIO, filtering details don't matter

if (buttons == DISPENSE_TASMANIAN_COLA_BUTTON)
dispense_tasmanian_cola();

So how many cans of Tasmanian Cola will you get?  Trust me, you had better be very thirsty if you're using this vending machine,  because you'll get 20 cans per second for as long as you hold down the button!

The problem is that the software is looking to see if the button is pressed (looking at the button state), when it should be looking to see if the button has been pressed once (looking at a button event).  The difference is critical.  The button state just is what it is, but a button event must be consumed when used so as not to deceive the code into thinking the multiple button events have occurred.  In this, buttons (and keys) are different from switches, where it is generally the state that one is interested in.

To turn button pushes into button events we need to think in terms of button flags.  A flag will be set when a button push occurs, and cleared when that button push is consumed - that is, when acted on by the software.  Note carefully that the flag is not set whenever the button is found to be pushed (active), but only when the button is first pushed (first goes active - the "leading edge" of the button push).  We will revisit this restriction when we look at auto-repeating, but for now we will hold to this restriction.  But for now:

• Flag is set when button goes from inactive or indeterminate, to active
• Flag is cleared when software consumes - that is, acts upon - the button

Let's assume a byte of filtered buttons using Method 2:

//
// detect button events
//
u8 buttons;             // raw filtered buttons
u8 new_buttons;         // all buttons that just went from 0 to 1
u8 last_buttons = 0;    // last raw active buttons
u8 button_flags = 0;    // all buttons that have gone active

buttons = get_filtered_buttons();
new_buttons = buttons & ~last_buttons;  // 1s for each button that went from 0 to 1
button_flags |= new_buttons;        // add all new button pushes to existing pushes
last_buttons = buttons;             // for next time thru

//
// consume a button event
//
if (button_flags & (1<<MY_BUTTON))  // detect MY_BUTTON event
{
button_flags &= ~(1<<MY_BUTTON);  // consume MY_BUTTON event
..process MY_BUTTON..
}

### Buttons In Combination

So far we have been looking at button event data as being Method 1 or Method 2 data (that is, independent booleans), but this is often not the case.  Many times, such as with a keypad or keyboard, we want a single code or value to represent all of the buttons being pressed.  This also makes debouncing easier because we are just debouncing one value at a time, not N different buttons.

For now let's just assume a 16-button keypad and a scanning routine that returns a raw value from the button or buttons being pushed on the keypad.  Let's also specify an example encoding:

• 0:    1
• 1:    2
• 2:    3
• 3:    4
• 4:    5
• 5:    6
• 6:    7
• 7:    8
• 8:    9
• 9:    10
• EQUAL:  11
• CLEAR: 12
• +:    13
• -:    14
• *:    15
• /:    16
• No key pushed: 0

So these are the values returned by read_keypad() below, and thus by filter_keypad().  This is a pretty simple calculator keypad, without, for example, any decimal capability, but it will demonstrate the techniques.  We will stipulate some function read_keypad() which reads the keypad buttons and returns one of the values specified above.  Now how do we debounce this?  We will look for N contiguous identical keypad values, just as we have been doing up to now.  Only the method will be a bit different.

u8 filter_keypad(void)
{
static u8 last_val = 0;           // 0 means no buttons pushed
static u8 count = 0;              // debounce filter count
u8 val;                           // raw val this time
u8 filtered_val = 0;              // our filtered return val

if (val != 0)                     // have a keypad button push
{
if (val == last_val)            // we're filtering this val
{
if ((count != 0) && (--count == 0))  // continue filtering & check if done
{
filtered_val = val;         // found enough consecutive values to return as valid
}
}
else
{
count = FILTER_COUNT;         // start filtering a new val
}
}
last_val = val;
return filtered_val;
}

As with all the other button filtering methods, this method will be called once every filtering interval, which might be 1-10ms.  The first check (if (val != 0)) checks for any button pushes.  If none, the no-button-value of 0 is returned.  The second check looks to see if the new value is the same as the last value.  If it is then we are in the midst of filtering the value.  If not (if a new val is detected) the filter count is loaded to its full filter value and filtering begins for the new value.  The third check (if we are in the midst of filtering) looks to see if the filter count has just been decremented to zero.  If so, the code reports this value as the filtered val, but will not continue to report it in subsequent passes.

This method offers a few bonuses that may not be readily apparent.  In the first place, it returns true keypad events.  It will return the filtered keypad value only once (when count decrements from 1 to 0), as is desired, and will not continue to return it as buttons remain held down.  In the second place, and related to the first, it allows us to add auto-repeat very easily, as we will see in the next tutorial chapter.  Also in the next tutorial chapter we will look at matrixed buttons and how to scan the matrix to read them.

Previous post by Mike Silva:
Introduction to Microcontrollers - More Timers and Displays
Next post by Mike Silva:
Introduction to Microcontrollers - Button Matrix & Auto Repeating

[ - ]
Comment by March 11, 2014
An amazing article. I have been going through a lot of stuff on the internet for good keypad handling routines and the ones I found were - kind-of-works stuff. This article gives a comprehensive insight into the keypad handling as well as the tricks and tips that are required to handle keypads..

Thanks a lot Mike...
[ - ]
Comment by April 18, 2014
Thanks for the kind words, Ravi. I'm glad I was able to help you make sense of the subject. Good luck!
[ - ]
Comment by February 19, 2018

thanks for this great article. it contains very useful and practical information.

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.


text:
# Fnet=ma 2008 #14

1. Jan 28, 2009

### dtl42

1. The problem statement, all variables and given/known data
A spaceborne energy storage device consists of two equal masses connected by a tether and rotating about their center of mass. Additional energy is stored by reeling in the tether; no external forces are applied. Initially the device has kinetic energy E and rotates at angular velocity ω. Energy is added until the device rotates at angular velocity 2ω. What is the new kinetic energy of the device?

2. Relevant equations
Not sure.

3. The attempt at a solution
I guessed that since kinetic energy is related to angular velocity squared, it would be 4E, but the answer is 2E.

2. Jan 28, 2009

v=rw and if the tether is reeled in r reduces as w increases.Angular momentum is conserved.

3. Jan 28, 2009

### dtl42

Thanks, I get it now.

4. Jan 29, 2009

### compwiz3000

Can somebody explain this in detail?

5. Jan 30, 2009

### bowma166

Well, as you're pulling in the tether, angular momentum is conserved. Angular momentum: $L=mvr$, so:

$$mvr_{1}=mvr_{2}$$
rewriting v as wr...
$$\omega_{1} r_{1}^{2}=\omega_{2} r_{2}^{2}$$

With $\omega_{2}=2\omega_{1}$, we get

$$r_{1}^{2}\omega_{1}=r_{2}^{2}\left(2 \omega_{1}\right)$$

$$\frac{r_{1}}{\sqrt{2}}=r_{2}$$

Kinetic energy...
$$K_{1}=mv^{2}=m\left(\omega r\right)^{2}=m\omega^{2}r^{2}$$

So, replacing with $\omega_{2}$ and $r_{2}$,

$$K_{2}=m\left(2\omega\right)^{2}\left(\frac{r}{\sqrt{2}}\right)^{2}=m\left(4\omega^{2}\right)\left(\frac{r^{2}}{2}\right)=2m\omega^{2}r^{2}=2K_{1}$$


text:
# ADC Input Protection with 4-20mA

If you've got a 4-20mA transducer, powered by 14V, and you want to measure it, your analog front end might look something like this:

simulate this circuit – Schematic created using CircuitLab

... but now my thinking shifts toward failure mode considerations. My ADC has an absolute maximum rating that dictates that it's inputs must not be greater than 3.6V and must not be less than -0.3V.

What circuit do you usually put on the positive input to your ADC to make sure that it never sees more than 3.3V if the transducer fails to limit current to 20mA or if R1 doubles in resistance for some reason (or whatever). Is this input protection circuit a good idea (BAT42 Schottky diodes in a crowbar configuration) and a current limiting resistor:

simulate this circuit

• Yes, that‘s how you can do it. I don‘t know a better way. – Stefan Wyss Jun 16 at 19:18
• Is this input protection circuit a good idea yes. Additionally, you can add a capacitor (10~100n) across D2 to form an RC filter with R1. – Rohat Kılıç Jun 16 at 19:23
• @RohatKılıç good thinking! – vicatcu Jun 16 at 22:12


text:
Home » » The angle of elevation of the top of a tree 39m away from a point on the ground ...

# The angle of elevation of the top of a tree 39m away from a point on the ground ...

### Question

The angle of elevation of the top of a tree 39m away from a point on the ground is 30o. Find the height of the tree.

### Options

A) 39√3m

B) 13√3m

C) 13/$$\sqrt{3}$$m

D) 13/3$$\sqrt{3}$$m

E) $$\sqrt{3}$$/13m

### Explanation:

x/25 = tan 30o
x = 39 x 1/√3 = 13√3m

## Dicussion (1)

• x/25 = tan 30o
x = 39 x 1/√3 = 13√3m


text:
## Forum archive 2000-2006

### Jun Wang - Questions about $newProblemSeed, ensuremath, and answer box in a matrix. ### Jun Wang - Questions about$newProblemSeed, ensuremath, and answer box in a matrix.

by Arnold Pizer -
Number of replies: 0
 Questions about $newProblemSeed, ensuremath, and answer box in a matrix. topic started 5/20/2003; 12:43:30 PMlast post 5/21/2003; 5:55:40 PM  Jun Wang - Questions about$newProblemSeed, ensuremath, and answer box in a matrix.  5/20/2003; 12:43:30 PM (reads: 2022, responses: 9) Hi, I need some help in dealing the following cases. 1. While playing with the MAA tutorial templates, I noticed that $newProblemSeed does not work in typeset2 mode on our system if there are images involed. TEXT mode and "formatted-text" mode show that the problem is changed. However, the images are not updated even after reloading. 2. When dealing with fractions with command "new Fracion()" as used in the 8th grade problems in Rochester CVS, "\ensuremath" is not interpreted by our system. We have latex2e installed. 3. In typeset2 mode, the answer box can not be displayed in a table or in a matrix on our system. Is there a way to resolve this? Thanks, Jun <| Post or View Comments |>  Michael Gage - Re: Questions about$newProblemSeed, ensuremath, and answer box in a matrix.  5/20/2003; 4:04:40 PM (reads: 2238, responses: 0) Hi Jun, (1) When ever you use images the browser caches the images so that they do not need to be downloaded again. (Some browsers have a preference which allows you to turn this "feature" off.) Pressing the shift key while clicking "reload" will force the browser to reload the images (in most browsers). WeBWorK could help with this problem by renumbering the image everytime it is displayed. This would require some work however and is not high on our toDo list, since the problem you are discussing occurs mainly when instructors write problems, not when students view them. For this reason I tend to use the formattted-text mode when writing problems. (2) I believe that ensuremath is part of Latex2e (see http://www.nerc-essc.ac.uk/~dwcp/Latex/ensuremath.html for example) I suggest trying to debug this problem by writing a tex file directly on your system and processing it with the same tex system that is called by WeBWorK. (3) Using tth mode is one way to resolve it, but many browsers/OS systems don't have the needed fonts installed. John Jones is working on an improved version of display_matrix that will display the matrices as a table while processing the entries with Tex. You can follow his changes at http://webwork-db.math.rochester.edu/cgi-bin/cvsweb.cgi/webwork/system/courseScripts/PGmatrixmacros.pl and also download the latest versions. (If you want to keep up with changes this summer "as they happen" you can link to our CVS as described at http://webhost.math.rochester.edu/webworkdocs/docs/install/how_to_use_cvs Hope this helps. -- Mike <| Post or View Comments |>

 Arnold K. Pizer - Re: Questions about $newProblemSeed, ensuremath, and answer box in a matrix. 5/21/2003; 9:30:45 AM (reads: 2240, responses: 0) Hi Jun, Let me add one additional comment to Mike's reply about cached images. Assuming you are using WeBWorK 1.8, if you want to refresh images when you change seeds, you should put$refreshCachedImages = 1;into the .pg code for the problem. This disables WeBWorK's caching of images but you still have to handle the browser's caching of images. You can also set this as the default for the whole WeBWorK system or for a single course, but this is not recommended (see below). In typeset2 (dvipng) and typeset (latex2html) modes, WeBWorK caches the images on the server in order to speed up processing the next time the same problem is viewed. When a problem is viewed, WeBWorK checks that the cached images are newer than the problem .pg code and if not, regenerates the images. Thus if a problem is edited, the images are regenerated. However, since it is very rare for the seeds to be changed, no such check is done with seeds. Thus if a professor changes the seed for a problem, it is up to the professor to delete any cached images for that problem (or to set $refreshCachedImages = 1; for that particular problem if seeds will be changed a lot). It would not be too difficult to change the WeBWorK system code so that when the seed for a problem is changed, all associated cached images are deleted but WeBWorK does not currently work that way. Here is the documentation on$refreshCachedImages taken from Global.pm: $Global::PG_environment{refreshCachedImages} = 0; # Set to 0 or 1. If set to 1, the cached images for # problems will never be used and Latex2html, dvipng, or any new # modes that use cached images will always be called # on to create or recreate all images. This can be very time # consuming so almost never should this variable be set to 1. # This default can be over ridden for an individual problem by # setting e.g. refreshCachedImages = 1 in the .pg file for the problem. # This is the real reason for the variable and is useful for # conditional problems where the second part of the problem # will be displayed only if a student answers the first part # correctly. In this case the cached images would only show # for the first part so the second part would never appear in # typeset, etc. mode. <| Post or View Comments |>  Jun Wang - Re: Questions about$newProblemSeed, ensuremath, and answer box in a matrix.  5/21/2003; 10:32:03 AM (reads: 2227, responses: 0) Thank you, Mike, (1), I tried "Shift+reload" on IE5 and Netscape 7.0, but they did not work. Formatted-text mode works fine and I was just wondering if I missed something. (2). I was referring to some grade 8th problems in Rochester CVS like http://webwork-db.math.rochester.edu/cgi-bin/cvsweb.cgi/rochester_grade8problems/setGrade8/U1orderingNumbers/ordering_numbers_2.pg?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=Rochester. When I copied them to our system, the problems displayed something like "\ensuremath{ \frac{11}{17} }" instead of a fraction. Last night I accidentally fixed it on our system by enclosing them with (...), that is, I changed "\{ $a->print \} \{ans_rule(5)\} \{$b->print \}$BR" in the template to "$$\{ a->print \}$$ \{ans_rule(5)\}$$\{ b->print \}$$$BR". However, I don't know why and I thought (...) or $were not needed in Latex2e. (3). We will keep up with the changes. Thank you. Jun <| Post or View Comments |>  Jun Wang - Re: Questions about$newProblemSeed, ensuremath, and answer box in a matrix.  5/21/2003; 10:41:31 AM (reads: 2221, responses: 0) Hi, Arnie, It worked. This fixed my first question. Thank you. Jun <| Post or View Comments |>

 John Jones - Re: Questions about $newProblemSeed, ensuremath, and answer box in a matrix. 5/21/2003; 12:28:32 PM (reads: 2191, responses: 0) Hi Jun, I haven't researched your question about \ensuremath, but I have a few thoughts. \ensuremath is part of latex2e, so it will work as expected in some cases with WeBWorK. In particular, it should work in pdf production. On the other hand, when WeBWorK makes images from bits of math in a problem, it has to know where those bits of math are. It does it by searching for  and . Other ways of invoking math mode will be missed, which includes use dollar signs (which would be hell to support because of their special nature in perl) and \ensuremath. Looking at the code for EV3, it doesn't look to hard to add support for \ensuremath. After it has dealt with the two basic types of math expressions above, it would then look for \ensuremath{...} and treat it as $$...$$. One difficulty may be jumping past matching braces inside the \ensuremath, but I think a suitable regular expression can be made. John <| Post or View Comments |>  Zbigniew Fiedorowicz - Re: Questions about$newProblemSeed, ensuremath, and answer box in a matrix.  5/21/2003; 1:35:40 PM (reads: 2214, responses: 0) Hi Arnie, << Thus if a professor changes the seed for a problem, it is up to the professor to delete any cached images for that problem (or to set $refreshCachedImages = 1; for that particular problem if seeds will be changed a lot). It would not be too difficult to change the WeBWorK system code so that when the seed for a problem is changed, all associated cached images are deleted but WeBWorK does not currently work that way. >> I would request that you make this change. The current situation can easily lead to unpleasant misunderstandings between the professors and students. Zig <| Post or View Comments |>  Michael Gage - Re: Questions about$newProblemSeed, ensuremath, and answer box in a matrix.  5/21/2003; 1:48:36 PM (reads: 2203, responses: 0) Hi Jun and John, Jun, I think you have found a "feature/bug" in Fraction.pm. That module has not been tested in the field very much, so I guess I shouldn't be surprised. I expect it will work in Latex2HTML mode which analyzes the entire file, not just the math strings. We have two choices, remove the ensuremath tags in the Fraction.pm module. This means that fractions will always need to be printed inside math mode e.g. $$\{a->print} - \{ b->print \} = \{ ans_rule \}$$ which is not elegant, but it is consistent. Alternatively we could also try to make WeBWorK do something more sophisticated along the lines of John's suggestion. This would allow us to write \{$a->print\} when the fraction is used alone. How useful is it to be able to use \{$a->print \} instead of $$\{ a->print }$$ ? is it worth the extra effort? -- Mike <| Post or View Comments |>

 John Jones - Re: Questions about $newProblemSeed, ensuremath, and answer box in a matrix. 5/21/2003; 2:17:31 PM (reads: 2211, responses: 0) Hi, On << Thus if a professor changes the seed for a problem, it is up to the professor to delete any cached images for that problem (or to set$refreshCachedImages = 1; for that particular problem if seeds will be changed a lot). It would not be too difficult to change the WeBWorK system code so that when the seed for a problem is changed, all associated cached images are deleted but WeBWorK does not currently work that way. >> I think images are deleted automatically if the professor changes a seed through the professor's page. What is not noticed is if the seed is changed by the problem itself. If that possibility is built into a problem, then the problem should set $refreshCachedImages = 1. John <| Post or View Comments |>  Jun Wang - Re: Questions about$newProblemSeed, ensuremath, and answer box in a matrix.  5/21/2003; 5:55:40 PM (reads: 2228, responses: 0) Hi, Mike and John, John is right and it works in the pdf production of hard copies. The current version is fine to me. I just need to make a note and remember to use math mode, different from other situations such as printing multiple choices. Thanks. Jun <| Post or View Comments |>


text:
# Recent content by Don D

1. ### Smartphone/Tablet Software

I'm wanting to have NEXRAD weather on my Samsung Galaxy S-4 phone with Avare installed. Looking at FlightBox ADS-B as the receiving device for ADS-B weather. The Flight Box home page says it will provide NEXRAD weather to Avare, but sometimes things don't work as stated. Has anyone used...
2. ### Looking For A Good Portable Comm

I use and like the 220 also. Only downside for me is the small buttons. Easy for fat fingers to push a wrong one. Don
3. ### VAL 760 radios - pros and cons

I'm considering the purchase of a used VAL 760 comm radio. I'm not familiar with them and would appreciate any comments or reviews on their operation. reliability, maintenance issues, etc. Thanks Don
4. ### Yaesu FTA-230 handheld and use of cigarette lighter charger?

Thanks, Dana. The Yaesu Operating Manual states that one should not use the PA-44 or PA 48 AC charging devices as a power source, but is silent on using the CD-59 cigarette charging device as a power source while transmitting or receiving on the radio. As you suggest, I'll have to contact...
5. ### Yaesu FTA-230 handheld and use of cigarette lighter charger?

Can one use Yaesu's CD-59 cigarette lighter charger as a power source while the FTA-230 radio is being used in an airplane? If so, it seems doing so would keep the radio operating at full strength rather than on declining battery power. Thanks Don
6. ### Anyone Know of FAenforcement actions for flying aircraft converted back to LSA status

Re: Anyone Know of FAenforcement actions for flying aircraft converted back to LSA st Thanks for the good advice, but that is not what I'm asking for. Does anyone know of any FAA enforcement actions for flying a retro-converted LSA as LS? Don
7. ### Anyone Know of FAenforcement actions for flying aircraft converted back to LSA status

This is a follow-up to my question about retro-conversion of aircraft originally mfg'd as LSA, but subsequently modified to operate at a higher gross weight, and then returned to LS limitations. I am doing some research into this issue and now I am trying to determine if a retro-conversion...
8. ### FAA regulations defining LSA with reference to model changes

Thanks, I found the citation. Don
9. ### FAA regulations defining LSA with reference to model changes

Thanks, Dana. Where is the quote from? Where can I find it online. I would like to cite it. Don
10. ### FAA regulations defining LSA with reference to model changes

Where can I find the FAA regulation that states an aircraft that originally qualified for light sport operation and was upgraded to a model that exceeded the gross weight of 1320 lbs, may not be returned to a light sport configuration? Thanks. Don
11. ### Preceptor N3 Pup

Fritz: Is the Pup for sale flying? Don
12. ### Range Rider?

There's an Ultra Pup for sale on Trade a Plane. In Florida, I believe. Been listed for quite awhile. Don
13. ### Bye Bye Kitplanes

Amen to the above! It's my opinion that editorial oversight is almost totally lacking in most publications these days, especially in the "news" media. That is, other than a computer spell check, no one reads articles before going to press to see if there are inaccuracies, misspellings, poor...


text:
Apply multidimensional models with Low number of samples? (What should i do with the train-test?)
0
0
Entering edit mode
12 months ago

I've been working with huge datasets since, well, i started with bioinformatics, but now i face a problem with a new dataset with very little samples.

I have 5 groups, Control, and 4 Diseases, wich frecuencies vary from a set of 10 features corresponding to the $log_2(1+2^{-Delta CT})$ values of gene expression (I had to use a pseudocount, to "nullify" my 0, preventing them to become a NA or -Inf).

Yet i only have a maximum of 20 entries per group (and a minimum of 3, because the data is full of NA's in some features). My plan is to cross use some of this features with clinical values in order to fit a model; i have a complete dataset of 87 of them with very few little Na's.

But I'm stuck with:

a) How do i divide a train-test dataset to fit my models with this very few little data?
b) How can i do the feature selection with my 8 firsts gene-features? I did some ANOVA (despise they are not normal, and the dataset its full of extreme outliers detected by 'identify_outliers()' and easily visible by boxplots; and some manovas with very few little features that are "significant" (Despise the data dont fullfill the asumptions, like normality).
c) Should i use a multinomial logistic regression? By the rule of thumb, i need about 10 samples per feature, but i dont know any more multiclass models that assign a probability.

Any recommendations?

r stats multidimensional logistic • 209 views


text:
# Tag Info

0

Just look at meeting date OIS. There should be broker screens and dealer runs for these for liquid markets.

2

The first method is how you actually calculate the forward price of a specific bond. You need to use the repo rate for that bond as the financing rate inside the calculation. The second method is a quick way of estimating bond forward yields, but it is not something you can execute in practice. For example, if you try to lock in the yield , 5yrs from today,...

0

I think that the formula of $F(t,T_a,T_b)$ is misleading. The ratio $P(t,T_b)/P(t,T_a)$ should be $P(t,T_a)/P(t,T_b)$ instead.

Top 50 recent answers are included


text:
## Machines B/C

Test your knowledge of various Science Olympiad events.
Godspeed
Member
Posts: 145
Joined: February 20th, 2020, 10:16 pm
Division: C
State: CA
Pronouns: He/Him/His
Has thanked: 45 times
Been thanked: 10 times

### Re: Machines B/C

RiverWalker88 wrote:
September 29th, 2020, 8:51 pm
astronomybuff wrote:
September 29th, 2020, 5:45 pm
RiverWalker88 wrote:
September 29th, 2020, 4:59 pm

Thanks, Umaroth for pointing out that you can't calculate the AMA of the system, thus making parts c and d impossible.
Wow!! So it wasnt just me thank God. I was kinda scared to ask ngl.
Nope, It wasn't! When in doubt, I probably wrote the question wrong...
Yeah I thought I was just dumb and didn't know the AMA. If not specified tho, isn't the AMA always the same as the IMA if you're not given any extra information such as friction?

RiverWalker88
Member
Posts: 68
Joined: February 24th, 2020, 7:14 pm
Division: C
State: NM
Pronouns: He/Him/His
Location: 1 AU away from a 1,390,000 km wide, 6000K ball of nuclear fusion.
Has thanked: 69 times
Been thanked: 110 times
Contact:

### Re: Machines B/C

Godspeed wrote:
September 29th, 2020, 10:17 pm
RiverWalker88 wrote:
September 29th, 2020, 8:51 pm
astronomybuff wrote:
September 29th, 2020, 5:45 pm

Wow!! So it wasnt just me thank God. I was kinda scared to ask ngl.
Nope, It wasn't! When in doubt, I probably wrote the question wrong...
Yeah I thought I was just dumb and didn't know the AMA. If not specified tho, isn't the AMA always the same as the IMA if you're not given any extra information such as friction?
Generally speaking, yes, you will assume IMA and AMA are the same for a system, especially if the question states that the system is ideal. However, if you specifically are asked for AMA, you will probably have to find some way to get the effort and resistance forces to do this. I gave no effort force for this, so it was impossible to solve for the AMA.
Socorro High School (2021 Events: Astro, Botany [TR], Circuit Lab, Codybusters, Detector, DesGenes, ExDes, Machines, (Apparently Sounds now too??))
I use (way) too many parentheses and ellipses...
RiverWalker88's Userpage (Mostly Complete)

Lemonism Forever

Godspeed
Member
Posts: 145
Joined: February 20th, 2020, 10:16 pm
Division: C
State: CA
Pronouns: He/Him/His
Has thanked: 45 times
Been thanked: 10 times

### Re: Machines B/C

RiverWalker88 wrote:
September 29th, 2020, 10:22 pm
Godspeed wrote:
September 29th, 2020, 10:17 pm
RiverWalker88 wrote:
September 29th, 2020, 8:51 pm

Nope, It wasn't! When in doubt, I probably wrote the question wrong...
Yeah I thought I was just dumb and didn't know the AMA. If not specified tho, isn't the AMA always the same as the IMA if you're not given any extra information such as friction?
Generally speaking, yes, you will assume IMA and AMA are the same for a system, especially if the question states that the system is ideal. However, if you specifically are asked for AMA, you will probably have to find some way to get the effort and resistance forces to do this. I gave no effort force for this, so it was impossible to solve for the AMA.
Oh I see, ok.

YellowMamba
Member
Posts: 14
Joined: September 30th, 2020, 12:57 pm
Division: B
State: KS
Location: On a crusade
Has thanked: 0
Been thanked: 0

### Re: Machines B/C

Is e 5827.14 joules?

RiverWalker88
Member
Posts: 68
Joined: February 24th, 2020, 7:14 pm
Division: C
State: NM
Pronouns: He/Him/His
Location: 1 AU away from a 1,390,000 km wide, 6000K ball of nuclear fusion.
Has thanked: 69 times
Been thanked: 110 times
Contact:

### Re: Machines B/C

So, for the scattered answers (thanks for posting, this was a very poorly-written question, sorry ) here's the solutions.
1. Block & Tackle
2. IMA = 4. There are two moving pulleys, so the IMA is 2*2=4
3. This is why I should solve
4. problems before posting them.
5. I got 1903 J, because I used the frictional force that needs to be overcome for the force that the block was pulled at. Once again, though, this part was unclear and far too open to assumption...

So, yeah. Someone's turn now. Next time I post a question, I will solve it first to ensure clarity and possibility. Apologies for the bad question.
Socorro High School (2021 Events: Astro, Botany [TR], Circuit Lab, Codybusters, Detector, DesGenes, ExDes, Machines, (Apparently Sounds now too??))
I use (way) too many parentheses and ellipses...
RiverWalker88's Userpage (Mostly Complete)

Lemonism Forever

astronomybuff
Member
Posts: 32
Joined: January 25th, 2020, 9:19 am
Division: C
State: NC
Has thanked: 1 time
Been thanked: 1 time

### Re: Machines B/C

Alright, it's been a while.

A block slides down a plane inclined at an angle of θ degrees with constant velocity. It is then projected up the same plane.

Determine the following (symbolically)
a) Coefficient of kinetic friction
b) The distance it travels before it stops
c) Whether or not it will slide down again

astronomybuff
Member
Posts: 32
Joined: January 25th, 2020, 9:19 am
Division: C
State: NC
Has thanked: 1 time
Been thanked: 1 time

### Re: Machines B/C

Hello....
Don't leave me hanging guys
Last edited by astronomybuff on October 10th, 2020, 2:42 pm, edited 1 time in total.

Hiujier
Member
Posts: 2
Joined: February 5th, 2018, 4:13 pm
Has thanked: 0
Been thanked: 1 time

### Re: Machines B/C

a)
Since the block slides down parallel to the plane at a constant velocity, we know that the net force parallel to the plane is 0. Drawing a free body diagram and writing Newton's 2nd Law, we get:

$mg \sin \theta - f = 0$
$mg \sin \theta - \mu_k N = 0$
$mg \sin \theta - \mu_k mg \cos \theta = 0$
$mg \sin \theta = \mu_k mg \cos \theta$
$\mu_k = \frac{\sin \theta}{\cos \theta}$
b)
I'm not sure if you can find the distance without initial velocity at the bottom of the ramp, so here is my solution given intial velocity:

Using energy conservation with work done by friction, we get:

$\frac{1}{2} mv^2 = fd + mgd \sin \theta$,

where $d$ is the distance traveled by the block parallel to the plane.

Furthermore, we know from part (a) that:
$f = mg \sin \theta$, so:

$\frac{1}{2} mv^2 = mgd \sin \theta + mgd \sin \theta$

$\frac{1}{2} mv^2 = 2mgd \sin \theta$
$d = \frac{v^2}{4g \sin \theta}$
c)
When the block is at rest after sliding, we know it experiences static friction. For static friction, we know that:

$\mu_s \geq \mu_k$

From this, we know that:
$f_{static} \geq f_{kinetic} = mg \sin \theta$,
$f_{static} \geq mg \sin \theta$

So the combining both conditions we get that the net force must be 0 when the block is at rest at the top of the plane. Therefore, it will not slide down again.
Last edited by Hiujier on October 10th, 2020, 8:01 pm, edited 2 times in total.
These users thanked the author Hiujier for the post:
AlexanderH (October 13th, 2020, 6:19 am)

astronomybuff
Member
Posts: 32
Joined: January 25th, 2020, 9:19 am
Division: C
State: NC
Has thanked: 1 time
Been thanked: 1 time

### Re: Machines B/C

Yep! Everything correct. Yes, my bad I forgot to include the velocity with which it was projected is v0. Your turn!

### Who is online

Users browsing this forum: No registered users and 3 guests


text:
# Different measured strain in beam experiencing pure bending

I have a beam experiencing a pure bending moment. The setup is similar to this image from these lecture notes (with different values).

Using the flexure formula, we can determine that the stress (and thus the strain) at any point along the top of the beam between C and D should be the same: $$\sigma_{max} = \frac{Mc}{I}$$ where $M$ is the moment, $c$ is the distance from the neutral axis, and $I$ is the area moment of inertia.

However, I've a couple of strain gauges along the top of the beam measuring strain in the axial direction. These gauges are reading different values at different locations between C and D.

Is this expected? Is it a limitation of the model or are the gauges malfunctioning (or laid up improperly)?

• besides other factors already mentioned , the experiment is sensitive to the precise positioning of the load/support points. Sep 28 '16 at 0:24

What variation in value are you experiencing? Theoretically, the curvature or strain of the beam should be constant in between load points. Minor variation could be expected, but major probably indicates a problem. Assuming all strain gauges are calibrated thermo corrected etc then it could be a faulty strain gauge or poor adhesive/preparation.

• Thanks for the answer. The max applied force was ~20lb and difference in strain gauge readings in the area between the supports varied from 30-70µstrain. The gauges were balanced before the experiment, but the layup was performed eons ago by someone else. It looks like model inaccuracies might not be enough to explain the discrepancy, and that it might be worth it to redo the gauges :( Sep 28 '16 at 23:22

If the loads you apply are too big, you can get local crushing of the beam, or plastic deformation of the beam at the loading points instead of uniform elastic bending.

But without more details of your experimental setup, it's a complete guess whether this is actually the cause.

A basic check is whether the beam returns to its original state when the loads are removed - i.e. it is still straight, and the gauges all read zero.

(Of course if this is a lab experiment and some previous student had permanently bent the beam before you used it, you won't get the expected results!)

• Thanks for the response. We're dealing with small enough forces to keep us well in the elastic region for our material. It could always be past students...now that's an error source I didn't consider! Sep 28 '16 at 23:11


text:
# Visualizing a multilevel model (HLM) in ggplot2

I have longitudinal data on several countries, looking at GDP and CO2 Emissions. In ggplot2, it is easy to make the software do something HLM-ish by plotting relationships separately for every country:

 ggplot(dat, aes(x=CO2.Emissions, y=GDP, color=as.factor(Country))) +
geom_point(shape=20) +
geom_smooth(method=lm) +
theme(legend.position="none") +
scale_y_log10(name="Log10(GDP)") +
scale_x_log10(name="Log10(CO2 Emissions)")

I get the following plot:

However, this is not a true plot of a multilevel model. I would love to do something LIKE this but visualizing results from a multilevel model. Specifically, the model is:

 lmer(GDP ~ 1 + CO2.Emissions + (1 + CO2.Emissions | Country), data=dat )

This generates a random slope and intercept for each country. QUESTION: can I plot these and get something similar to (and as aesthetically pleasing as) the ggplot above? I want to visualize the relationships as depicted in the model, which ggplot2 is not doing.

Any help is appreciated!

When you fit an lmer model, you can use the coef() function to extract the coefficients from the model. Your code would look something like:

mod1 <- lmer(GDP ~ 1 + CO2.Emissions + (1 + CO2.Emissions | Country), data=dat)

Then you can call coef() and extract the coefficients for each group by specifying:

coef(mod1)$Country  This will give you a vector of intercepts (the '1' you specified in the random term) and slopes (for 'C02.Emissions'). You can then save each of these into their own vector: intercepts <- coef(mod1)$Country[,1] # Specifying the first column only
slopes <- coef(mod1)$Country[,2] # Specifying the second column only  Instead of calling geom_smooth(), you could then specify specific slopes and intercepts by adding this to your plot: geom_abline(slope=slopes, intercept=intercepts)  The positive of this is that it is using the model-implied slopes and intercepts. The downside is that it will extrapolate the lines beyond the values for each cluster (in this case, 'Country'). I would then add another geom_abline that is the average slope and intercept, which you can get from: summary(mod1)$coef

Another way of doing this—that is not using the model-implied slopes and intercepts—is by specifying group=cluster. Using this, it fits a different OLS line for each cluster (which is not what the multilevel model fit with lmer() is doing, obviously).

I've done this before, and it adapted to your variables would look something like:

ggplot(datalong, aes(x=CO2.Emissions, y=GDP, group=Country))+
stat_smooth(method="lm", se=FALSE, size=.5, color="springgreen") + # slopes for different countries
stat_smooth(aes(group=1), method="lm", color="blue", size=1.5) + # average slope with SE

This might be slightly easier to do, but it will not match up with the model-implied slopes and intercepts you get from the coef(lmer(...))$cluster approach. When you want to plot lmer()objects, I find it easiest to use predict(). First you fit your model: random.coef.model <- lmer(GDP ~ 1 + CO2.Emissions + (1 + CO2.Emissions | Country), data=dat)  Then you predict GDP values corresponding to your predictor variable (CO2.Emissions): dat$random.coefficients.predictions <- predict(random.coef.model)

And then you are free to plot them either using geom_smooth(se=FALSE) or geom_line(). If you want to have a scatterplot at the same time, you need to feed geom_point() new aes(), as the existing y-values would be the predicted values. So:

random.coef.graph <- ggplot(aes(x = CO2.Emissions, y = random.coefficients.predictions,
color = as.factor(Country)), data = dat) +
geom_line(size=.3) +
geom_point(aes(y = GDP)) +
ggthemes::theme_tufte() #just to make it nice!


text:
- Current Issue - Ahead of Print Articles - All Issues - Search - Open Access - Information for Authors - Downloads - Guideline - Regulations ㆍPaper Submission ㆍPaper Reviewing ㆍPublication and Distribution - Code of Ethics - For Authors ㆍOnlilne Submission ㆍMy Manuscript - For Reviewers - For Editors
 On integral domains in which every ascending chain on principal ideals is $S$-stationary Bull. Korean Math. Soc. 2020 Vol. 57, No. 5, 1215-1229 https://doi.org/10.4134/BKMS.b190903Published online September 30, 2020 Ahmed Hamed, Hwankoo Kim University of Monastir; Hoseo University Abstract : Let $D$ be an integral domain and $S$ a multiplicative subset of $D.$ An ascending chain $(I_k)_{k\in\mathbb{N}}$ of ideals of $D$ is said to be $S$-stationary if there exist a positive integer $n$ and an $s\in S$ such that for each $k\geq n,$ $sI_k\subseteq I_n.$ As a generalization of domains satisfying ACCP (resp., ACC on $*$-ideals) we define $D$ to satisfy $S$-ACCP (resp., $S$-ACC on $*$-ideals) if every ascending chain of principal ideals (resp., $*$-ideals) of $D$ is $S$-stationary. One of main results of this paper is the Hilbert basis theorem for an integral domain satisfying $S$-ACCP. Also we investigate the class of such domains $D$ and we generalize some known related results in the literature. Finally some illustrative examples regarding the introduced concepts are given. Keywords : $S$-ACCP, $S$-ACC, $S$-PID, $S$-UFD MSC numbers : 13A15, 13E99, 13G05 Supported by : This research was supported by the Academic Research Fund of Hoseo University in 2018 (20180320) Downloads: Full-text PDF   Full-text HTML


text:
Chapter 92

Rhabdomyolysis is a clinical and biochemical syndrome that results from acute necrosis of skeletal muscle fibers and the leakage of cellular contents into the circulation. Several classification systems have been developed to characterize the numerous causes of rhabdomyolysis. None of these systems is universally recognized, and each has its limitations. Table 92-1 lists commonly recognized causes. In general, the most common causes of rhabdomyolysis in adults appear to be alcohol and drugs of abuse, followed by medications, muscle diseases, trauma, neuroleptic malignant syndrome, seizures, immobility, infection, strenuous physical activity, and heat-related illness.1 Multiple causes are present in more than half of patients.1 In children, rhabdomyolysis is less common and is thought to be more benign.2 In one study of children, the most common causes of nonrecurrent rhabdomyolysis were trauma, viral myositis, and connective tissue disease.2 For adults and children, inherited metabolic disorders should be suspected with recurrent episodes of rhabdomyolysis, especially if associated with exercise intolerance.

Table 92-1 Common Causes of Rhabdomyolysis in Adults

Patients in coma are at risk for development of rhabdomyolysis due to immobility from unrelieved pressure on gravity-dependent body parts. In one study, the positions most commonly leading to rhabdomyolysis were the lateral decubitus, lithotomy, sitting, knee-to-chest, and prone positions.3 Alcohol consumption can result in rhabdomyolysis secondary to coma-induced muscle compression and a direct toxic effect. Nutritional compromise, hypokalemia, hypomagnesemia, and hypophosphatemia, all common in alcoholics, increase the risk of rhabdomyolysis. Alcohol and drugs are thought to play a role in up to 80% of cases of rhabdomyolysis in adults.1,4,5 Drugs of abuse that have commonly been implicated in acute rhabdomyolysis include cocaine, amphetamines [including Ecstasy (3,4-methylenedioxymethamphetamine)], lysergic acid diethylamide (LSD), heroin, and phencyclidine. Commonly prescribed medications associated with the development of rhabdomyolysis include antipsychotics, lipid-lowering agents (i.e., statins and clofibrate), selective serotonin reuptake inhibitors, narcotics, zidovudine, colchicine, lithium, and antihistamines.2Statin-related myopathies include myalgias with or without elevation of creatine kinase (CK) level, muscle weakness, and rhabdomyolysis. Statin-related rhabdomyolysis is rare, varies with the particular statin (0.04% for pravastatin and ...

Sign in to your MyAccess profile while you are actively authenticated on this site via your institution (you will be able to verify this by looking at the top right corner of the screen - if you see your institution's name, you are authenticated). Once logged in to your MyAccess profile, you will be able to access your institution's subscription for 90 days from any location. You must be logged in while authenticated at least once every 90 days to maintain this remote access.

Ok

## Subscription Options

### AccessMedicine Full Site: One-Year Subscription

Connect to the full suite of AccessMedicine content and resources including more than 250 examination and procedural videos, patient safety modules, an extensive drug database, Q&A, Case Files, and more.


text:
# BunsenLabs on VirtualBox on Windows 10 on a Laptop

Why: Because.

How: With great effort and time.

I’ve gone through so, so many iterations of this installation process because of various things that have gone irreversibly wrong. Luckily, this has all been on a VM, so nothing is truly irreversible (save for the overall entropy of the universe), but many mistakes were made, then remade (“testing”, they call it) to be sure of their causes. To note:

1. Don’t install with separate partitions; put everything in one partition. Otherwise, when you boot up, fsck does a lot of shouting and you do a lot of shouting of a word similar to “fsck”. I reinstalled thrice and on VMWare just to confirm that it was really the partitioning that was the issue.

2. The installation is reported to only take 2 GB so it might seem like a good idea to give the virtual disk just 4 GB, but the installation really takes a bit more than 2 GB and the formatted disk really has a bit less than 4 GB and you’ll be installing extra packages and themeing-related files, which means you’ll run out of space and be unable to log in after you reboot because you put everything in one partition. The recommended amount is 10 GB, but I’ve redone my installation with 8 GB because I’m on a laptop with an SSD with only ~40 GB remaining that I’m loath to use up.

3. VMDKs can’t be resized. I’d’ve had to clone the disk to VDI, enlarge the disk, then clone back to VMDK. Or reinstall it, which took less time and space.

One cosmetic issue: the guest screen doesn’t fill up the host screen when maximized. It needs VirtualBox guest additions, and a bit more video memory than the recommendation to be able to run fullscreen if you have a higher-resolution screen. The same happens in VMWare, but when I tried to install VMWare Tools I had the guest screen stuck in a corner. Not being able to figure this one out was mainly why I stuck with VirtualBox, though I had to convert my VMWare .vmx to .ovf using VMWare’s OVFTool.

This isn’t a glitch in my screen capturing software, this is literally what I had to deal with

And now for the fun part: tweaking the UI! As usual, I went for a flat + dark theme using the following:

• Afterpiece (Openbox) ― double-click .odt to install
• FlatStudioDark (GTK3) ― paste folder into ~/.themes, then apply in Preferences > Appearance > Widget
• Paper (icons) ― double-click .deb to install, then apply in Preferences > Appearance > Icon Theme

The Conky configuration is based off of this one and can be found here. In that repo are also configurations for Openbox and Tint2, whose defaults I’ve tweaked slightly with the following:

• Bindings for lowering, raising, and muting volume in ~/.config/openbox/rc.xml:
<keybind key=”XF86AudioLowerVolume”>
<action name=”Execute”>
<command>amixer set -D pulse Master 5%- unmute</command>
</action>
</keybind>
<keybind key=”XF86AudioMute”>
<action name=”Execute”>
<command>amixer set -D pulse Master toggle</command>
</action>
</keybind>
<keybind key=”XF86AudioRaiseVolume”>
<action name=”Execute”>
<command>amixer set -D pulse Master 5%+ unmute</command>
</action>
</keybind>
• Icons theme and clock format for Tint2 in ~/.config/tint2/tint2rc:
launcher_icon_theme = Paper
time1_format = %a, %d %b | %H:%M

I’ve also replaced the following default programs using GAlternatives found under System > Edit Debian Alternatives (where adding the same path with a new priority will update an existing entry’s priority):

• Geany -> VSCode (/usr/bin/code), with custom settings (under File > Preferences > Settings)
{
"editor.scrollBeyondLastLine": false,
"editor.roundedSelection": false,
"editor.emptySelectionClipboard": false,
"workbench.startupEditor": "none",
"workbench.tips.enabled": false,
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false
}
• Firefox -> Opera Beta Firefox Developer Edition. Note that updates would need to be manually installed, so I’ve written a script (in $HOME/updatefirefox.sh) to do that for me. The update-alternatives line isn’t necessary if it’s already been set through GAlternatives. This needs to be run with sudo -E because a few of these commands require root and I want to preserve$HOME.
#!/bin/bash

wget -O $TARBALL$URL
rm -rf /opt/firefox
tar -xjvf $TARBALL -C /opt update-alternatives --install /usr/bin/x-www-browser x-www-browser/opt/firefox/firefox 200 rm$TARBALL

Only a few final things to configure:

• Adding setxkbmap -option 'grp:ctrl_shift_toggle' 'ca(multix),us' to \$HOME/.bashrc to set toggling between US and Canadian Multilingual Standard keyboard layouts with Ctrl-Shift; note that this is only run when a shell has started so a terminal will have to be opened before the changes are made

• Adding copy-paste functionality in Terminator (~/.config/terminator/config):

[keybindings]
paste = <Control>v
copy  = <Control>c
• Setting up SSH keys for GitHub using ssh-keygen then git remote set-url origin git@github.com:<user>/<repo>.git

And that should be it!


text:
# Find the inverse Laplace transformation and limit

The question is related to this post but can be solved independtly. I am trying to find a general expression in the time domain for the asymptotic behavior when $t \to \infty$ of $\bar{f}(s)$ defined in the Laplace domain.

$$\bar{f}(s) = \cfrac{\sigma}{\Gamma\left(\frac{n}{2} \right)}\cfrac{K_{\nu-1}\left(\sigma \right)}{K_\nu\left(\sigma\right)}$$

and

• $\bar{u}(s) = \cfrac{s\omega (\omega -1)+\lambda }{s(\omega -1)+\lambda }$ with $\omega < 1$ and $\lambda \in \mathbb{R^{+}}$
• $\sigma = \sqrt{s\bar{u}(s)}$
• $\nu = 1- \cfrac{n}{2}$ with $n \in ]2;3]$

Because $\nu < 0$ we can not use the approximated values available for small arguments of the modified Bessel function.

I tried to tackle the problem with approximations of the modified Bessel function, to check the properties of the incomplete gamma function but I am not familiar with this. I ended to plot the values of $f(t)$ for great values of $t$ as a function of n. The graph shows that for small values of $n$ (i.e. $n<2$) the limit of $f(t)$ tends to $0$, this can be found analyticaly with the approximations available for the modified Bessel function. It takes a specific solution when $n = 2$ (red circle on the figure), still the approx. of the modified Bessel function. Once $n>3$, $n$ influences the value of the limit of $f(t)$.

See the plot:

The behavior at large times might depend if $\omega <1$ or $\omega>1$. Are you interested in one of the two regimes only? – Fabian Feb 1 '13 at 18:15
@Fabian, you are right, I am considering the case where $\omega < 1$, I edited my post to specify this particularity, thank you. – Vivh Feb 1 '13 at 18:29


text:
2.8k views

Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.

Program main;
Var ...

Procedure A1;
Var ...
Call A2;
End A1

Procedure A2;
Var ...

Procedure A21;
Var ...
Call A1;
End A21

Call A21;
End A2

Call A1;
End main.

Consider the calling chain: $Main \rightarrow A1 \rightarrow A2 \rightarrow A21 \rightarrow A1$

The correct set of activation records along with their access links is given by:

edited | 2.8k views
0
can any one describe it more ?
0
Need more explanation of this question
+1
First why we need access link? acess link is used to access the non local data.why we need non local deta what it has to do with access link ? example :: In dynamic scoping we need to access the non local data this done using access link now come to question .....when this code will executed first main will pushed in stack. all the procedure declaration will not run until CALL A1; It will called so it will pushed into stack.now program will try to find the code of A1 so it will go to main using the access link to main .main will give code to A1.so access link will need here .now you are in inside A1 when u execute its code then A2 will be called .again using access link it will go main to find the code of A2 and then pushed into stack so link will be stablished between main to A2 reason is using main you came to know that A2 exist.this process will continue until whole program get executed. below link will be helpfull page 42

https://www.cse.iitk.ac.in/users/karkare/cs335/lectures/13RuntimeSystems.pdf
0
Thanks @a new one.

Since, Activation records are created at procedure entry time and destroyed at procedure exit time.
therefore here Calling sequence is given as ,
$Main \rightarrow A1 \rightarrow A2 \rightarrow A21 \rightarrow A1$
now $A1$ and $A2$ are defined under Main...So $A1,A2$ Access link are pointed to main
$A21$ is Defined under $A2$ hence its Access link will point to $A2$.

edited by
0
consider a different program where  A21 is enclosed under A1, which in turn is enclosed under Main.

If A21 is called directly form main, only activation records for Main and A21 will exist. So my question is will A21 access link point to main then? Because Main is the closest enclosing procedure.
0
Wat about a21 ?? i think there should be a line between a1 to a21 ?? anyone ??
+1
Procedure A2;
Var ...

Procedure A21;
Var ...
Call A1;
End A21

Call A21;
End A2

here A21 come inside A2 thats y only scope not goes outside it.

0
Actually from where procedure started and ended inside that procedure if there is any nested procedure or calling any function, every thing will be nested with activation record of that procedure
0
i didn't understand why there is no link from A1 to A21. Please explain?
+2
Because A1 is not Defined under A21.. it is being simply called this time .

Procedure A1 and A2 are defined under main hence there is an access link between them .
+1 vote

From main() there are three function calling sequence

1) A1 -> A2

2) A2 ->  A21  ->  A1

3) A1

Now match with the given answer calling chains:

A)(FALSE)

It shows a linear chain(only one function call from main()) which isn't correct and doesn't follow above sequence at all.

B)(FALSE)

It is false because main() unable to call A1 directly.

C) (FALSE)

It shows there is only two function call made by main(). That is not true and Frame pointer will also get updated by new A1 address block not will be old one.

D) (TRUE)

main() has three function calling sequence present and Frame Pointer is holding the new A1 block address. That is true.

1
2


text:
## Fundamentals of Physics Extended (10th Edition)

Published by Wiley

# Chapter 2 - Motion Along a Straight Line - Problems: 48b

27 m/s

#### Work Step by Step

In part a we found that the stone takes 1.53 seconds to reach the ground. We also established that the initial velocity, v0 = -12 m/s and that $a = -9.81 m/s^2$ To find the velocity at impact (when it reaches the ground) we use the equation: v = v0 + at $v = -12m/s + (-9.81m/s^2)(1.53s) = -27m/s$ The negative here means only the direction, but the speed is the absolute value of the velocity, which is 27 m/s

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.


text:
# Latin Square in C++

The Latin square is a matrix that has a special pattern. Let's see different examples to examine the pattern.

1 2
2 1

1 2 3
3 1 2
2 3 1

1 2 3 4
4 1 2 3
3 4 1 2
2 3 4 1

The Latin square that you get will be of different size as you notice in the above examples. But, if you carefully observe the above matrices' pattern, you will find out that the last number of the previous row comes as the first element of the next row.

That's the pattern hidden in Latin square. We have to write the program that generates the above matrix for the input n.

## Algorithm

• Initialise the n with any number you like.
• Initialise a number with the value n + 1 call it as first_half_end.
• Write a loop that iterates from 1 to n both inclusive.
• Assign the value of first_half_end to a variable called first_half_start.
• Write a loop until first_half_start reaches to the value n.
• Print the iterating variable i.e.., first_half_start.
• Write a loop that iterates from 1 to first_half_end.
• Print the iterating variable.
• Decrement the value of first_half_end by 1.
• Move the next row.

## Implementation

Following is the implementation of the above algorithm in C++

#include <bits/stdc++.h>

using namespace std;

void generateLatinSquare(int n) {
int first_half_end = n + 1;

for (int i = 1; i <= n; i++) {
int first_half_start = first_half_end;
while (first_half_start <= n) {
cout << first_half_start << " ";
first_half_start++;
}

for (int second_half_start = 1; second_half_start < first_half_end; second_half_start++){
cout << second_half_start << " ";
}
first_half_end--;
cout << endl;
}
cout << endl;
}

int main(void) {
generateLatinSquare(2);
generateLatinSquare(3);
generateLatinSquare(4);
return 0;
}

## Output

If you run the above code, then you will get the following result.

1 2
2 1

1 2 3
3 1 2
2 3 1

1 2 3 4
4 1 2 3
3 4 1 2
2 3 4 1


text:
## Sunday, January 29, 2006

### Cellphones induce greater market efficiency on the fish market

The best Indian economics conference that I know is the NCAER-NBER Neemrana conference, which takes place in Dec/Jan every year. This year, one fascinating paper was by Robert Jensen of Harvard, who has worked on the impact of cellular telephony on pricing efficiency on the market for fish in Kerala. It's a great story, and Swaminathan Aiyar wrote his column in Times of India this morning using it. I haven't been able to locate a PDF of the full paper by Prof. Jensen. It's well worth reading - please tell me if you find the URL.

As Jensen emphasises, what is going on is the power of the I' in IT. Putting better information in the hands of economic agents transforms their thought process and maximisation. I feel similarly about the work that's been done in India on bringing transparency to previously opaque market, by polling dealer markets. This includes MIBOR (done by NSE) and the NCDEX polled prices for the commodity spot markets (done by CMIE and CRISIL).

(Times of India has a really terrible website, so while I normally like to link to original sources, I have instead linked up to Swami's website. If someone from TOI reads this, please see these guidelines for you are violating most of them.).

1. hi Sir,

It is really fascinating how competition and technology together can affect such positive changes across villages and societies.

Found these two pdfs from the professor you mentioned -

web.mit.edu/sinana/www/sari.pdf

www.cid.harvard.edu/cr/pdf/gitrr2002_ch07.pdf
(This is a similar study done in the Chinese market by the same gentleman)

2. Ravi,

No, these two URLs are both related (insofar as Robert Jensen does lots of work on related themes) but they are not the paper on Kerala, mobile phones, and fish markets. I hope that papers turns up soon on the web.

3. Hi

I had been hearing about the Kerala fishermen from BPL executives for some time - BPL was one of the two circle operators in Kerala.

But didn't realise how efficiently the telecom network served the waterways (and thus the river/sea economy) until I travelled, two or three years ago, by speed boat from Cochin to Alleppey and Kumarakom on the backwaters.

Amazingly, I had a signal on my mobile phone right through despite it getting pretty isolated in some parts. The guy who was driving the boat would keep getting phone calls all the time. So, he had one hand on the phone and one the wheel, the boat's wheel !

And guess what ? Driving back from Kumarakom to Cochin by road, there were long stretches when there would be no phone signal !! Don't know if its changed now.

4. Dear Ajay,
The gains in efficiency cited need to be deconstructed' into:
(a) the usage of technology to lock-in prices - thus in essence cellphones enable a standard futures contract markets. an empirical test should be that the ex-post cell-phones the lagged prices of marine products are significant predictors of spot prices. ex-post the lagged effect of the prices of the marine products should be less stochastic, and thus the trend is significant but lagged deviations from the mean are insignificant.

(b) on a more macro-level, the risk-minimization due to technology leads to improved consumption smoothing in this micromarket - which in turn leaves other related-micromarkets (like the small restaurants, food hawkers) to either forgo, or exploit, the gains from informational arbitrage - thus causing an "informational cascade" across sectors.

don't know where to find data for (a) to write a paper. what do you think?
cheers. k.,

5. Why do you expect that in an efficient market, there should be bigger AR terms? Jensen does look at simple volatility - both across space and time - and he finds that post cellphones, the vol goes down. In the pre-cellphone period, there were episodes where the price of fish (a perishable) used to go to 0! Now those episodes don't happen.

He also tries to think about who captured what part of the welfare gains. Some of it went to the producer, some of it went to consumers. I wish we got a URL for his paper or slideshow. Thus far, it doesn't seem to be up on the net.

6. CORRECTION TO POST # 4. NOTE THE CAPITALIZED CHANGES.
(MISTAKE DUE TO LATE NIGHT FORAYS ON CAFFEINE!)

a) the usage of technology to lock-in prices - thus in essence cellphones enable a standard futures contract markets. an empirical test should be that the ex-ANTE cell-phones the lagged prices of marine products are significant predictors of spot prices. ex-post the lagged effect of the prices of the marine products should be less stochastic, and thus the trend is significant but lagged deviations from the mean are insignificant.

7. Hi Ajay,

The article is now posted at the following URL:

http://www.swaminomics.org/articles/20060129_Cell_ridge_the_dig.htm

Thanks,
Mukul.
http://mukulblog.blogspot.com/

8. Thanks, Mukul, I used the new URL!

9. Ajay,
Did you finally manage to locate the full text of Jensen's study on the Kerala Fishermen? If so, please advise on the same.

10. The Economist has an article on Jensen's study (May 10th 2007). it cites the following reference:

*“The Digital Provide: Information (technology), market performance and welfare in the South Indian fisheries sector”, by Robert Jensen. To be published in the Quarterly Journal of Economics, August 2007.

11. Here are two studies, I found in this blog
http://bayesianheresy.blogspot.com/2007/05/how-mobile-phone-brought-down-price-of.html

LaTeX mathematics works. This means that if you want to say $10 you have to say \$10.


text:
## EE230 fundamentals of electric circuits 5th ed. 1.18

I'm not sure if I'm getting the right power for p5 or p3 because the total power isn't adding up to zero.


text:
# misc-non-copyable-objects¶

cert-fio38-c redirects here as an alias for this check.

The check flags dereferences and non-pointer declarations of objects that are not meant to be passed by value, such as C FILE objects or POSIX pthread_mutex_t objects.

This check corresponds to CERT C++ Coding Standard rule FIO38-C. Do not copy a FILE object.


text:
Graphing Calculator Math Worksheets Algebara Solver Chart Maker
 A+ A− B

# Logarithm: Rules, rules rules!

## Rules and Formula of Logarithms

### Formula and laws of logarithms

• Quotient rule: logb(A/C) = logbA − logbC
• Ex: $$log_3(\frac{27}{9}) = log_3(27) - log_3(9) = 3-2 =1$$
• Power rule: logbAC = C(logbA)
• Ex: log39² = 2log39
• ## Product Rule Practice Problems

Worksheet on product rule of logarithms

Problem 1) Rewrite log12 + log5 as a single term using the product rule formula

Problem 2) Rewrite log312 + log311 using the product rule formula

Problem 3) Rewrite log511 + log5a using the product rule formula

## Quotient Rule Practice Problems

worksheet on the quotient rule of logarithms

Practice problem 1) Rewrite log20 − log5 as a single term using the quotient rule formula

Practice problem 2) Rewrite log2100− log225 as a single term using the quotient rule formula

Practice problem 3) Rewrite log240− log25 as a single term using the quotient rule formula

Practice problem 4) Rewrite log318− log32 as a single term using the quotient rule formula

## Power Rule Practice Problems

worksheet on the power rule of logarithms

Practice problem 1) Rewrite log3x2 as a single term using the power rule formula


text:
# Application of Factor Theorem

We will discuss here about the application of Factor Theorem.

1. Find the roots of the equation 2x$$^{2}$$ - 7x + 6 = 0. Hence factorize 2x$$^{2}$$ - 7x + 6.

Solution:

Here, the equation is 2x$$^{2}$$ - 7x + 6 = 0

2x$$^{2}$$ - 4x - 3x + 6 = 0

⟹ 2x(x - 2) - 3(x - 2) = 0

⟹ (x - 2)(2x - 3) = 0

⟹ x - 2 = 0 or 2x - 3 = 0

⟹ x = 2 or x = $$\frac{3}{2}$$

Therefore, 2x$$^{2}$$ - 7x + 6 = 2(x - 2)(x - $$\frac{3}{2}$$) = (x - 2)(2x - 3)

2. Find the quadratic equation whose roots are 1 + √3 and 1 - √3.

Solution:

We know that the quadratic equation whose roots are α and β, is

(x – α)(x – β) = 0

Therefore, the required equation is {x - (1 + √3)}{x - (1 - √3)} = 0

x$$^{2}$$ - {1 - √3 + 1 + √3}x + (1 + √3)( 1 - √3) = 0

x$$^{2}$$ - 2x + (1 - 3) = 0

⟹ x$$^{2}$$ - 2x – 2 = 0.

3. Find the cubic equation whose roots are 2, √3 and -√3.

Solution:

We know that the quadratic equation whose roots are α, β and γ, is

(x – α)(x – β)(x - γ) = 0

Therefore, the required equation is (x – 2)(x - √3){x – (-√3)} = 0

⟹ (x - 2)(x - √3)(x + √3) = 0

⟹ (x - 2)(x$$^{2}$$ - 3) = 0

⟹ x$$^{3}$$ – 2x$$^{2}$$ - 3x + 6 = 0.

x$$^{2}$$ - {1 - √3 + 1 + √3}x + (1 + √3)( 1 - √3) = 0

x$$^{2}$$ - 2x + (1 - 3) = 0

⟹ x$$^{2}$$ - 2x - 2 = 0.

4. Factorize x$$^{2}$$ -3x - 9

Solution:

The corresponding equation is x$$^{2}$$ - 3x - 9= 0

Now we apply the quadratic formula

x = $$\frac{-b \pm \sqrt{b^{2} - 4ac}}{2a}$$

= $$\frac{-(-3) \pm \sqrt{(-3)^{2} - 4 \cdot 1 \cdot (-9)}}{2 \cdot 1}$$

= $$\frac{3 \pm \sqrt{9 + 36}}{2}$$

= $$\frac{3 \pm \sqrt{45}}{2}$$

= $$\frac{3 \pm 3\sqrt{5}}{2}$$

Therefore, x$$^{2}$$ - 3x - 9 = (x - $$\frac{3 + 3\sqrt{5}}{2}$$)(x - $$\frac{3 - 3\sqrt{5}}{2}$$)

From Application of Factor Theorem to HOME


text:
# Differential equations of the First order and First degree

A differential equation that contains derivative of a function with an exponent one is called the differential equation of the first order and first degree.

## Introduction

In calculus, we see several types of differential equations but the first order and first degree differential equations are frequently appeared. So, let us learn how the differential equations of first order and first degree look like.

### Example

$(x^2-yx^2)\dfrac{dy}{dx}$ $+$ $y^2$ $+$ $xy^2$ $\,=\,$ $0$

In this example, $x$ and $y$ are variables but $y$ represents a function in terms of $x$. The function $y$ is differentiated one time and there is no other derivatives in the given differential equation. Hence, it is called the first order differential equation.

$\implies$ $(x^2-yx^2)\Bigg(\dfrac{dy}{dx}\Bigg)^1$ $+$ $y^2$ $+$ $xy^2$ $\,=\,$ $0$

The power of the derivative of the function is one. Hence, it is a first degree differential equation.

Therefore, the given differential equation is called the differential equation of first order and first degree.

## Examples

The following are some more examples for the first order and first degree differential equations.

$(1)\,\,\,$ $\sec^2{y}\tan{x}\dfrac{dy}{dx}$ $+$ $\sec^2{x}\tan{y} = 0$

$(2)\,\,\,$ $(x-y)^2\dfrac{dy}{dx} = a^2$

$(3)\,\,\,$ $\dfrac{dy}{dx} = -\dfrac{x\sqrt{1-y^2}}{y\sqrt{1-x^2}}$

$(4)\,\,\,$ $\dfrac{dy}{dx}$ $\,=\,$ $e^{2x-3y}+4x^2e^{-3y}$

$(5)\,\,\,$ $x^4\dfrac{dy}{dx}$ $+$ $x^3y$ $+$ $\log_e{(xy)}$ $\,=\,$ $0$

A best free mathematics education website for students, teachers and researchers.

###### Maths Topics

Learn each topic of the mathematics easily with understandable proofs and visual animation graphics.

###### Maths Problems

Learn how to solve the maths problems in different methods with understandable steps.

Learn solutions

###### Subscribe us

You can get the latest updates from us by following to our official page of Math Doubts in one of your favourite social media sites.


text:
## College Algebra (6th Edition)

Logistic growth: growth is limited. Exponential growth$:$ growth is not limited.
Exponential growth model: $A=A_{0}e^{kt} \quad (k>0)$ (where $A_{0}$ is the initial quantity, and $A$ is the quantity after time t) The growth is unlimited, A can become arbitrarily large. ----------- The logistic growth model, given by $A=\displaystyle \frac{c}{1+ae^{-bt}}$, (a,b,c are constants and $c>0, b>0$) describes situations in which growth is limited. $y=c$ is a horizontal asymptote for the graph, and growth, $A$, can never exceed $c$.