text:
Home > Sample Size > Sample Size Increases Standard Error

# Sample Size Increases Standard Error

## Contents

One way to do this is with the standard error of the mean. Increase the sample size, say to 10. I thought maybe this was a bug in MySQL, so I tried to use the Excel functions, but got the same results. You might want to change "STD" to "SD" which is more standard and STD had another meaning (to medical people, STD means sexually transmitted disease). 2. http://ldkoffice.com/sample-size/sample-size-increases-standard-error-decrease.html

I should think that you wouldn't be very certain at all. This is not true (Browne 1979, Payton et al. 2003); it is easy for two sets of numbers to have standard error bars that don't overlap, yet not be significantly different I tried: googling, but most accepted answers have 0 upvotes or are merely examples thinking: By the law of big numbers every value should eventually stabilize around its probable value according I'll give you two. http://academic.udayton.edu/gregelvers/psy216/activex/sampling.htm

## Standard Deviation Sample Size Relationship

The standard error of the mean (i.e., the precision of your estimate of the mean) does get smaller as sample size increases. If your sample size is small, your estimate of the mean won't be as good as an estimate based on a larger sample size. Why were Native American code talkers used during WW2?

Did the standard deviation of the population means decrease with the larger sample size? For binomial data there is good discussion of how power and standard error vary with sample size at stats.stackexchange.com/q/87730/22228 –Silverfish Dec 21 '14 at 2:26 1 As you are new You shouldn't expect to get less spread--just less error in your measurement of a fundamental characteristic of the data. Which Combination Of Factors Will Produce The Smallest Value For The Standard Error b.

Amazingly, this distribution is quite real, it pops up here and there in physics. What Happens To The Mean When The Sample Size Increases The shape of the distribution becomes narrower since the dispersion is less and estimates of the mean are more precise. This provides additional reputation for the answerer and also marks the question as resolved. –amoeba Jan 7 '15 at 12:57 I think about it like this: each new point If our sample mean appears in the middle section of the curve, then the observed weight change could have happened by chance.

Greenstone, and N. When The Population Standard Deviation Is Not Known The Sampling Distribution Is A Maybe the inaccurate shooter got lucky a few times, so the pattern is tighter than you would expect from him over the long haul. a. Handbook of Biological Statistics (3rd ed.).

## What Happens To The Mean When The Sample Size Increases

Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the In a World Where Gods Exist Why Wouldn't Every Nation Be Theocratic? Standard Deviation Sample Size Relationship We should, right? Find The Mean And Standard Error Of The Sample Means That Is Normally Distributed Journal of Insect Science 3: 34. ⇐ Previous topic|Next topic ⇒ Table of Contents This page was last revised July 20, 2015.

The standard deviation of the sample means is equivalent to the standard error of the mean. http://ldkoffice.com/sample-size/sample-size-calculator-using-standard-error.html A similar effect applies in regression problems. The standard deviation of those means is then calculated. (Remember that the standard deviation is a measure of how much the data deviate from the mean on average.) The standard deviation share|improve this answer answered Mar 10 '14 at 16:44 msouth 1863 add a comment| Did you find this question interesting? If The Size Of The Sample Is Increased The Standard Error Will

Means ±1 standard error of 100 random samples (n=3) from a population with a parametric mean of 5 (horizontal line). What game is this? In its simplest form this involves comparing samples between one regime and another (which may be a control). check over here Related 12Calculating required sample size, precision of variance estimate?0Design effects (or variances) of sampling methods?5Sampling variance is reduced when removing duplicates — why?3Sampling variance when the largest observation is removed2What role

It may or may not be. The Relationship Between Sample Size And Sampling Error Is Quizlet Symbol creation in TikZ What is a Cessna 172's maximum altitude? By increasing the sample size we increase the reliability of the sample means - making the curve narrower and spikier - and so any change we detect is more likely to

## How likely is it that a 3kg weight change will be statistically significant in these two scenarios?

When the error bars are standard errors of the mean, only about two-thirds of the error bars are expected to include the parametric means; I have to mentally double the bars up vote 14 down vote favorite 4 Big picture: I'm trying to understand how increasing the sample size increases the power of an experiment. The shape of the distribution becomes narrower since the dispersion is less and estimates of the mean are less precise. The Sources Of Variability In A Set Of Data Can Be Attributed To: Finally we work out the mean weight change of the entire sample.

For example, if you grew a bunch of soybean plants with two different kinds of fertilizer, your main interest would probably be whether the yield of soybeans was different, so you'd Success! The second sample has three observations that were less than 5, so the sample mean is too low. this content We could subtract the sample mean from the population mean to get an idea of how close the sample mean is to the population mean. (Technically, we don't know the value

H. How to slow down sessions? It makes sense that having more data gives less variation (and more precision) in your results.

Distributions of times for 1 worker, 10 workers, and 50 workers. Generate several sets of samples, watching the standard deviation of the population means after each generation.

According to the Empirical Rule, almost all of the values are within 3 standard deviations of the mean (10.5) -- between 1.5 and 19.5. That's because average times don't vary as much from sample to sample as individual times vary from person to person. the sample mean is closer and the deviations from that sample mean are less so your answer is going to have less variance in it making the margin of error less. You know that your sample mean will be close to the actual population mean if your sample is large, as the figure shows (assuming your data are collected correctly).

McDonald. You use standard deviation and coefficient of variation to show how much variation there is among individual observations, while you use standard error or confidence intervals to show how good your As mentioned above, the specific difference is proposed by the researcher and the population sd has to be obtained from previously published research or from a pilot study. Wikipedia's article on this says: According to the law, the average of the results obtained from a large number of trials should be close to the expected value, and will tend

As you can see from it's equation, it's an estimation of a parameter, $\sigma$ (that should become more accurate as n increases) divided by a value that always increases with n, How to leave a job for ethical/moral issues without explaining details to a potential employer A question about Fleur's quotes in Harry Potter Why did the Ministry of Magic choose an Your sample mean won't be exactly equal to the parametric mean that you're trying to estimate, and you'd like to have an idea of how close your sample mean is likely Because the estimate of the standard error is based on only three observations, it varies a lot from sample to sample.


text:
Class Notes (836,381)
MATH 140 (141)
Ewa Duma (13)
Lecture 10

# Lecture 10 - 2.6.pdf

2 Pages
110 Views

School
Department
Mathematics & Statistics (Sci)
Course
MATH 140
Professor
Ewa Duma
Semester
Summer

Description
2.6 LIMITS AT INFINITY; HORIZONTAL ASYMPTOTES In Sections 2.2 and 2.4 we investigated inﬁnite limits and vertical asymptotes. There we let x approach a number and the result was that the values of y became arbitrarily large (positive or negative). In this section we let x become arbitrarily large (positive or nega- x f▯x▯ tive) and see what happens to y. 132 |||| CHAPTER 2 LIMITS AND DERIVATIVES 0 ▯1 Let’s begin by investigating the behavior of the function f deﬁned by 2 ▯1 0 f▯x▯ ▯40 - Lecture 10 Notes Again, the symbol ▯▯ does not represent a number, but the expression lim f▯x▯ ▯ L ▯2 0.600000 x ▯ 1 y=ƒ is often read as ▯3 0.800000 as x becomes large. The table at the left gives values of this function correct to six decimal “the limit of f▯x▯, as x approaches negative inﬁnity, is L” ▯4 0.882353 places, and the graph of f has been drawn by a computer in Figure 1. ▯5 0.923077 Limits at Inﬁnity and Horizontal Asymptotes: ▯10 0.980198 y y=L Deﬁnition 2 is illustrated in Figure 3. Notice that the graph approaches the line y ▯ L as y=1 we look to the far left of each graph. ▯50 0.999200 0 x ▯100 0.999800 ▯1000 0.999998 3 y DEFINITION The line y ▯ L is called a horizontal asymptote of the curve 0 1 ▯-1 xy ▯ f▯x▯ if either y= ▯+1 FIGURE 1 lim f▯x▯ ▯ L y=ƒ xl▯ y=L As x grows larger and larger, the values of f(x) gets closer and closer to 1 but never to to 1. This implies that we have a horizontal asymptote at 1 which means that the value willing x sufﬁciently large. This situation is expressed symbolically by 0riting x For instance, the curve illustrated in Figure 1 has the line y ▯ 1 as a horizontal asymp- get extremely close to 1 but never 1 itself. tote because 2 lim x ▯FIGUR▯ 1 Deﬁnition: Let f be a function dx l ▯x ▯ 1ome interval (a, inf). Then lim (x > inf) f(x) = L Examples illustratixg_`im ƒ=L which means that the values of f(x) can be made arbitrarily close to L by taking x sufﬁciently large. An example of a curve with two horizontal asymptotes is y ▯ tan x. (See Figure 4.) y In fact, ▯ Deﬁnition: Let f be a function deﬁned on some interval (-inf, a). Then lim (x > -inf) f(x) = L which means that the values of f(x) can be made arbitrarily close to L by taking x sufﬁciently large negative. 0 4 lim tan x ▯ ▯ x xl▯▯ Deﬁnition: The line y = L is called a horizontal asymptote of the curve y = f(x) if either lim ▯ (x > inf) f(x) = L or lim (x > -inf) f(x) = L _2 so both of the lines y ▯ ▯ ▯2 and y ▯ the fact that the lines x ▯ ▯▯2 are vertical asymptotes of the graph of tan.) Example: Find the inﬁnite limits, limitsFIGURE 4ity, and asymptotes for the function f whose y=tan–!x EXAMPLE 1 Find the inﬁnite limits, limits at inﬁnity, and asymptotes for the function f graph is shown: whose graph is shown in Figure 5. y SOLUTIONWe see that the values of f▯x▯ become large as x l ▯1 from both sides, so 2 Notice that f▯x▯ becomes large negative as x approaches 2 from the left, but large posi- 0 2 x tive as x approaches 2 from the right. So lim f▯x▯ ▯ ▯▯ xl2▯ Thus both of the lines x ▯ ▯1 and x ▯ 2 are vertical asymptotes. We can see that y = inf when x approachFIGURE 5d when x approaches -1 from both As x becomes large, it appears that f▯x▯ approaches 4. But as x decreases through left and right side. Therefore the vertical asymptotes are when x = -1, 2.
More Less

Related notes for MATH 140
Me

OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Join to view

OR

By registering, I agree to the Terms and Privacy Policies
Just a few more details

So we can recommend you notes for your school.

format: plain


text:
# Frobenius density theorem

As mentioned by @MichaelZieve in his comment re Quadratic residue, Chebotarev's density theorem was preceded by an allegedly much easier theorem of Frobenius (Mike Zieve is certainly not the only one to mention that the Frobenius theorem is much easier than Chebotarev) -- the difference between the two theorems is that Frobenius talks of conjugacy in $S_n,$ while Chebotarev of conjugacy in the Galois group itself. Does anyone know what the "easier" argument is? Is there a good reference?

-
I just changed the link, since it pointed neither to the question nor the answer you mention, but to an other answer. –  quid Jul 7 at 19:40
@quid: thanks..! –  Igor Rivin Jul 7 at 21:20


text:
MathSciNet bibliographic data MR1164194 (93e:58111) 58F11 (28D05) Moriyasu, Kazumine The ergodic closing lemma for \$C\sp 1\$$C\sp 1$ regular maps. Tokyo J. Math. 15 (1992), no. 1, 171–183. Article

For users without a MathSciNet license , Relay Station allows linking from MR numbers in online mathematical literature directly to electronic journals and original articles. Subscribers receive the added value of full MathSciNet reviews.


text:
# Why isn't Derivative equal to NeumannValue? [duplicate]

Can someone explain why, if I have

u=u[x,t]

then

Derivative[1,0][u][0,t] == 0

doesn't give the same result as

NeumannValue[0,x==0]

I just want to solve heat/diffusion equation

D[u[x,t],t] == D[u[x,t],{x,2}]

with 2 bc saying that the derivative with respect to $x$ at $x=0$ and $x=1$ is equal to $0$ (flux=0) and that ic is

u[x,0]==Sin[Pi*x]

I got it right in COMSOL but not in Mathematica

• Err... Because the first is a differential equation, and the second says that something is supposed to be zero at $x=0$? Your question is like asking why Range[42] doesn't give the same result as ListPlot[{1,2}]. What is it that you really are doing? – corey979 Jun 22 '18 at 19:08
• Can you give a complete example? – Szabolcs Jun 22 '18 at 19:28
• I second @Szabolcs: please post the complete Mathematica code you are using. Without it we're not really able to help you. – corey979 Jun 22 '18 at 20:28
• Here user21 writes :"Specifying NeumannValue will lead to FEM since the correspondence to Derivative is not one to one". I confess that I don't understand the section "The Relation between NeumannValue and Boundary Derivatives" in the linked page. – andre314 Jun 22 '18 at 22:54
• In your case zero Neumann value at x==0 is indeed equivalent to Derivative[1,0][u][0,t] == 0, how did you code it? Please add the complete code sample. Also, notice your i.c. is inconsistent with b.c., so you'll face the problem mentioned here if you're not using "FiniteElement" method for spatial discretization. – xzczd Jun 23 '18 at 4:24

Just use DSolve in the normal way. No need to use NeumannValue in this case.

pde = D[u[x, t], t] == D[u[x, t], {x, 2}]

DSolve[{pde, Derivative[1, 0][u][1, t] == 0,
Derivative[1, 0][u][0, t] == 0, u[x, 0] == Sin[Pi x]},
u[x, t], {x, t}]

(*{{u[x, t] -> 2*Inactive[Sum][((1 + (-1)^K[1])*Cos[Pi*x*K[1]])/
(E^(Pi^2*t*K[1]^2)*(Pi - Pi*K[1]^2)), {K[1], 1, Infinity}] +
2/Pi}}*)

Change from K[1] to n to make simpler and make finite number of terms for plotting

u[x_, t_, m_] := 2/Pi + (2/Pi)*Sum[((1 + (-1)^n)*Cos[Pi*x*n])/(E^(Pi^2*t*n^2)*(1 - n^2)),
{n, 2, m}]

The trick is that the n = 1 term appears singular to MMA with the denominator and if you take the limit MMA returns a complex result. Plotting the real portion shows that the n = 1 term is zero, so we can start the sum at n = 2.

tp = Table[
Plot[Evaluate[u[x, t, 200]], {x, 0, 1}, PlotRange -> {0, 1}], {t,
0, .2, .005}];
ListAnimate[tp]

• How is a DSolve answer the same as an NDSolve answer? – Bill Watts Jun 23 '18 at 7:28


text:
Check GMAT Club Decision Tracker for the Latest School Decision Releases https://gmatclub.com/AppTrack

 It is currently 28 May 2017, 21:55

GMAT Club Daily Prep

Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

Events & Promotions

Events & Promotions in June
Open Detailed Calendar

GMAT Diagnostic Test Question 21

Author Message
Founder
Joined: 04 Dec 2002
Posts: 14965
Location: United States (WA)
GMAT 1: 750 Q49 V42
GPA: 3.5
Followers: 3962

Kudos [?]: 25210 [0], given: 4765

GMAT Diagnostic Test Question 21 [#permalink]

Show Tags

06 Jun 2009, 22:59
Expert's post
7
This post was
BOOKMARKED
GMAT Diagnostic Test Question 21
Field: word problems (min/max)
Difficulty: 700

A set of 11 different integers has a median of 25 and a range of 50. What is the greatest possible integer that could be in this set?

A. 65
B. 70
C. 75
D. 80
E. 85
_________________

Founder of GMAT Club

US News Rankings progression - last 10 years in a snapshot - New!
Just starting out with GMAT? Start here...
Need GMAT Book Recommendations? Best GMAT Books

Co-author of the GMAT Club tests

Last edited by bb on 28 Sep 2013, 21:33, edited 1 time in total.
Updated
CIO
Joined: 02 Oct 2007
Posts: 1218
Followers: 97

Kudos [?]: 946 [7] , given: 334

Re: GMAT Diagnostic Test Question 20 [#permalink]

Show Tags

08 Jul 2009, 06:56
7
KUDOS
3
This post was
BOOKMARKED
Consider 11 numbers in ascending order to be $$x_1$$, $$x_2$$, $$x_3$$, ..., $$x_{11}$$.

The median of a set with odd number of elements is the middle number (when arranged in ascending or descending order), so the median of given set is $$x_{6}=25$$;

The range of a set is the difference between the largest and the smallest numbers of a set, so the range of given set is $$50=x_{11}-x_{1}$$ --> $$x_{11}=50+x_{1}$$;

We want to maximize $$x_{11}$$, hence we need to maximize $$x_{1}$$. Since all integers must be distinct then the maximum value of $$x_{1}$$ will be $$median-5=25-5=20$$ and thus the maximum value of $$x_{11}$$ is $$x_{11}=50+20=70$$.

The set could be {20, 21, 22, 23, 24, 25, 26, 27, 26, 29, 70}

_________________

Welcome to GMAT Club!

Want to solve GMAT questions on the go? GMAT Club iPhone app will help.
Result correlation between real GMAT and GMAT Club Tests
Are GMAT Club Test sets ordered in any way?

Take 15 free tests with questions from GMAT Club, Knewton, Manhattan GMAT, and Veritas.

GMAT Club Premium Membership - big benefits and savings

Intern
Joined: 02 Jul 2013
Posts: 1
Followers: 0

Kudos [?]: 1 [1] , given: 0

Re: GMAT Diagnostic Test Question 21 [#permalink]

Show Tags

20 Nov 2013, 12:24
1
KUDOS
Why must the numbers in the set be different in order to calculate the median?

Couldn't I arrange a set like the following? S={25, 25, 25, 25, 25, 25, 75, 75, 75, 75, 75}?
(Note that after x6, the follwoing numbers could be anything between 26 and 74)

In this way, the median is still 25, but the máximum value of x would now be 75, making "C" the correct answer.

D.
Math Expert
Joined: 02 Sep 2009
Posts: 39040
Followers: 7750

Kudos [?]: 106487 [1] , given: 11626

Re: GMAT Diagnostic Test Question 21 [#permalink]

Show Tags

21 Nov 2013, 01:55
1
KUDOS
Expert's post
peti wrote:
Why must the numbers in the set be different in order to calculate the median?

Couldn't I arrange a set like the following? S={25, 25, 25, 25, 25, 25, 75, 75, 75, 75, 75}?
(Note that after x6, the follwoing numbers could be anything between 26 and 74)

In this way, the median is still 25, but the máximum value of x would now be 75, making "C" the correct answer.

D.

The number is the set must be different because we are told that they are different, check the stem: "A set of 11 different integers has ..."
_________________
Intern
Joined: 19 Jul 2013
Posts: 23
Location: United States
GMAT 1: 340 Q27 V12
GPA: 3.33
Followers: 0

Kudos [?]: 6 [1] , given: 9

Re: GMAT Diagnostic Test Question 20 [#permalink]

Show Tags

05 Jan 2014, 17:45
1
KUDOS
[quote="dzyubam"]Consider 11 numbers in ascending order to be $$x_1$$, $$x_2$$, $$x_3$$, ..., $$x_{11}$$.

The median of a set with odd number of elements is the middle number (when arranged in ascending or descending order), so the median of given set is $$x_{6}=25$$;

The range of a set is the difference between the largest and the smallest numbers of a set, so the range of given set is $$50=x_{11}-x_{1}$$ --> $$x_{11}=50+x_{1}$$;

We want to maximize $$x_{11}$$, hence we need to maximize $$x_{1}$$. Since all integers must be distinct then the maximum value of $$x_{1}$$ will be $$median-5=25-5=20$$ and thus the maximum value of $$x_{11}$$ is $$x_{11}=50+20=70$$.

The set could be {20, 21, 22, 23, 24, 25, 26, 27, 26, 29, 70}

its clear till since....distict
i was not able to follow after that..??? can u please explain just that area
Math Expert
Joined: 02 Sep 2009
Posts: 39040
Followers: 7750

Kudos [?]: 106487 [1] , given: 11626

Re: GMAT Diagnostic Test Question 20 [#permalink]

Show Tags

05 Jan 2014, 19:03
1
KUDOS
Expert's post
lindt123 wrote:
dzyubam wrote:
Consider 11 numbers in ascending order to be $$x_1$$, $$x_2$$, $$x_3$$, ..., $$x_{11}$$.

The median of a set with odd number of elements is the middle number (when arranged in ascending or descending order), so the median of given set is $$x_{6}=25$$;

The range of a set is the difference between the largest and the smallest numbers of a set, so the range of given set is $$50=x_{11}-x_{1}$$ --> $$x_{11}=50+x_{1}$$;

We want to maximize $$x_{11}$$, hence we need to maximize $$x_{1}$$. Since all integers must be distinct then the maximum value of $$x_{1}$$ will be $$median-5=25-5=20$$ and thus the maximum value of $$x_{11}$$ is $$x_{11}=50+20=70$$.

The set could be {20, 21, 22, 23, 24, 25, 26, 27, 26, 29, 70}

its clear till since....distict
i was not able to follow after that..??? can u please explain just that area

We know that the median, $$x_6$$, is 25. What is the maximum value of $$x_5$$. Since $$x_5<x_6$$, then the maximum value of $$x_5$$ is 24. Similarly the maximum value of $$x_4$$ is 23, the maximum value of $$x_3$$ is 22, the maximum value of $$x_2$$ is 21 and the maximum value of $$x_1$$ is 20.

Hope it's clear.
_________________
Intern
Joined: 19 Jul 2013
Posts: 23
Location: United States
GMAT 1: 340 Q27 V12
GPA: 3.33
Followers: 0

Kudos [?]: 6 [0], given: 9

Re: GMAT Diagnostic Test Question 20 [#permalink]

Show Tags

05 Jan 2014, 21:51
Bunuel wrote:
lindt123 wrote:
dzyubam wrote:
Consider 11 numbers in ascending order to be $$x_1$$, $$x_2$$, $$x_3$$, ..., $$x_{11}$$.

The median of a set with odd number of elements is the middle number (when arranged in ascending or descending order), so the median of given set is $$x_{6}=25$$;

The range of a set is the difference between the largest and the smallest numbers of a set, so the range of given set is $$50=x_{11}-x_{1}$$ --> $$x_{11}=50+x_{1}$$;

We want to maximize $$x_{11}$$, hence we need to maximize $$x_{1}$$. Since all integers must be distinct then the maximum value of $$x_{1}$$ will be $$median-5=25-5=20$$ and thus the maximum value of $$x_{11}$$ is $$x_{11}=50+20=70$$.

The set could be {20, 21, 22, 23, 24, 25, 26, 27, 26, 29, 70}

its clear till since....distict

i was not able to follow after that..??? can u please explain just that area

We know that the median, $$x_6$$, is 25. What is the maximum value of $$x_5$$. Since $$x_5<x_6$$, then the maximum value of $$x_5$$ is 24. Similarly the maximum value of $$x_4$$ is 23, the maximum value of $$x_3$$ is 22, the maximum value of $$x_2$$ is 21 and the maximum value of $$x_1$$ is 20.

Hope it's clear.

THANX A LOT....IT DID HELP A LOT!!!
Re: GMAT Diagnostic Test Question 20   [#permalink] 05 Jan 2014, 21:51
Similar topics Replies Last post
Similar
Topics:
14 GMAT Diagnostic Test Question 27 4 20 Dec 2012, 16:47
48 GMAT Diagnostic Test Question 25 28 05 Jan 2014, 23:27
44 GMAT Diagnostic Test Question 24 27 10 Mar 2014, 14:02
1 GMAT Diagnostic Test Question 22 18 20 Dec 2012, 16:27
2 GMAT Diagnostic Test Question 22 16 20 Dec 2012, 16:21
Display posts from previous: Sort by

GMAT Diagnostic Test Question 21

Moderator: Bunuel

 Powered by phpBB © phpBB Group and phpBB SEO Kindly note that the GMAT® test is a registered trademark of the Graduate Management Admission Council®, and this site has neither been reviewed nor endorsed by GMAC®.


text:
# Highlights

• Unsupervised method for removing artifacts from medical images.
• Unsupervised method for transferring artifacts from one image to another one.

# Method

The proposed method starts from two sets of images : some with artifacts and others without. Through a series of encoders and decoders, the system tries to learn the latent representation of

• Artifacts
• Images behind the artifacts
• Images without any artifacts

Since the method is unsupervised, two discriminator networks are used to learn an adversarial loss thus forcing the system to produce realistic images with and without artifacts. The proposed system is illustrated in Fig.1.

As one can suspect, the overall loss is quite thick:

The first two terms are adversarial losses which tries to fool the discriminators by showing real and fake artifact-free images

as well as real and fake artifacted images.

The third term is a simple L1 loss (used to train an auto-encoder)

The fourth term is a cycle loss which is a L1 distance function between the input artifact-free image $$y$$ and the recontructed atifact-free image obtained after adding artifacts to $$y$$

The last term is an L1 loss to force the reconstructed images to be not too different from the input images

## Results

Results are quite impressive, on par with those obtained by supervised methods.


text:
# Algebraic Relations among Matching Constraints of Multiple Images

1 MOVI - Modeling, localization, recognition and interpretation in computer vision
GRAVIR - IMAG - Graphisme, Vision et Robotique, Inria Grenoble - Rhône-Alpes, CNRS - Centre National de la Recherche Scientifique : FR71
Abstract : Given a set of $n\ge2$ uncalibrated views, for any corresponding point across $n$ views, there exist three types of matching constraints: bilinear constraints(for $n\ge2$), trilinear constraints (for $n\ge3$, \cite{shashua94c- }) and quadrilinear constraints (for $n \ge 4$, \cite{hartley94d,triggs95a,fau- geras95a}). The exact algebraic relations among these multi-linear constraints have not been elucidated by previous authors. This paper examines the relations between these matching constraints by singling out the degenerate view and point configurations. The key result that will be established is that for generic view configurations and generic points, all multi-linear constraints may algebraically be reduced to the algebraically independent bilinear constraints- . In other words, all matching constraints are contained in the ideal generated only by the bilinear constraints for generic views and points. As a consequence, $2n-3$ algebraically independent bilinearities from pairs of views completely describe the algebraic/geometric structure of $n$ uncalibrated views for generic views and points. For degenerate points of generic views, each type of constraint reduces differently. The exact reduced form of the matching constraints are also made explicit by computer algebra.
Keywords :
Document type :
Reports
Domain :
Complete list of metadatas

https://hal.inria.fr/inria-00073344
Contributor : Rapport de Recherche Inria <>
Submitted on : Wednesday, May 24, 2006 - 12:35:16 PM
Last modification on : Wednesday, April 11, 2018 - 1:52:10 AM
Long-term archiving on: Sunday, April 4, 2010 - 11:43:11 PM

### Identifiers

• HAL Id : inria-00073344, version 1

### Citation

Long Quan. Algebraic Relations among Matching Constraints of Multiple Images. RR-3345, INRIA. 1998. ⟨inria-00073344⟩

Record views

Files downloads


text:
Title: TOPICAL PHYTOTHERAPIES FOR PAIN AND INFLAMMATION CONTROL IN ELDERLY PEOPLE WITH OSTEOARTHRITIS: AN INTEGRATIVE REVIEW

Abstract:Objective: To identify in the literature the topical herbal medicines used to control pain and inflammation in the elderly with osteoarthritis. Method: integrative review performed in the MEDLINE / PubMed, CINAHL, Cochrane, Web of Science, SCOPUS and LILACS bibliometric index databases, totaling nine articles. Results: All studies are randomized controlled trials with evidence level II. The most prevalent herbal medicine was Zingiber montanum (ginger). The phytotherapics were found in the form of ointment, gel and oil. Artemisia absinthium, Arnica montana and Zingiber montanum gels were as effective in decreasing osteoarthritis symptoms as a gel containing non-asteroidal anti-inflammatory drugs. Artemisia absinthium, Zingiber montanum Z, Peganum harmala L, Lavandula angustifolia and Sphaeralcea angustifolia were found to improve pain, inflammation and daily life activities in the elderly with osteoarthritis. Arnica gel and chamomile oil, in addition to its analgesic and anti-inflammatory properties, improve rigidity. Conclusion: Although topical herbal medicines have low cost, few side effects and high efficacy in the treatment of osteoarthritis in the elderly, this practice still needs to be more widespread.

Title: A sequential bounded approximate unit formed of idempotent in Banach algebra

Abstract:In this paper we show that for all Banach commutative algebra $A$ had a sequential bounded approximate unit $(e_{n})_{n}$ such that $\left\Vert e_{n}\right\Vert <1$ and $\underset{n\rightarrow +\infty }{\lim \inf }\left\Vert e_{n}^{3}-e_{n}\right\Vert <\frac{2}{3\sqrt{3}}$. Then $A$ is a sequential bounded approximate unit formed of idempotent. Various properties related to this inequality are also studied. As an application, we provide the following example, the closed subalgebra $A$ generated by a semi-group $(T(t))_{t>0}$ continuous and bounded to the origin.

Title: MEANINGS ATTRIBUTED TO OBSTETRIC VIOLENCE BY NURSING ACADEMICS

Abstract:We aimed to understand the meanings attributed to obstetric violence by nursing students. Through a descriptive, exploratory, qualitative research with twenty Nursing students from a Public University of Piau閾�, through semi-structured interview analyzed with the precepts of thematic analysis. From the content analysis of the interviews emerged the categories: Meanings attributed to obstetric violence; The absence of information; and the role of nursing in confronting obstetric violence. Academics understand obstetric violence as a multifactorial offense; As sources of information on the theme, we point out social media and university education, and emphasize the importance of nursing in coping with this problem. It is necessary that this theme be increasingly discussed within the university environment, expanding the students\' reflexivity on such important topics that raise debates and sensitive views on the health care of pregnant women / pregnant women / women.

Abstract:Background: A lot of studies are focused on the ability of nickel-titanium engine-driven files to induce dentinal radicular microcracks. A recently developed single-file system is reported to shape the root canal system less aggressively without damaging the integrity of dentinal matrix. Objective: The aim of the current study was to assess the frequency of radicular dentinal microcracks observed after root canal preparation with Self-adjusting file by means of micro-computed tomography. Materials and methods: Twenty single-rooted, non-endodontically treated lower incisors with straight roots were included in the experiment. The specimens were scanned using high-resolution micro-computed tomographic imaging before and after root canal preparation with 1.5 mm Self-adjusting file. Afterwards, preoperative and postoperative cross-sectional images of the teeth were screened to identify the presence of dentinal defects. The McNemar test was used to determine significant differences before and after instrumentation. The level of significance was set at p≤0.05. Results: The Self-adjusting file system insignificantly increased the percentage rate of microcracks compared with preoperative specimens (p>0.05). Conclusions: The shaping of root canals of lower incisors with Self-adjusting file did not induce significant difference in the frequency of radicular dentinal microcracks.

Title: Understanding Differences in Schoolchildren Physical Fitness

Abstract:The aim of this research are the differences in the physical fitness level of school children. Changing the results in the level of physical fitness in children of a younger school age, regardless of gender, is always consistent with certain changes in muscular, bone-joint and endocrine systems, which can greatly facilitate or impede motor task performance. The research includes a sample of 60 participants (n1=31 boys n2 =29 girls, born in 2007-2008) attending the “Bosko Buha” elementary school in Pljevlja (Montenegro). To assess certain aspects of their motor skills, we used the EUROFIT system according to the recommendation of the Ministry of Education of the Republic of Montenegro as a tool for monitoring children and youth. The Eurofit test battery contains six standardized motor tests, such as: the Sit-and-Reach (flexibility), Standing Broad Jump (strength of the legs), Flamingo Balance test (balance), Sit-Ups in 30 seconds (strength of the abdominal muscles), Plate Tapping (coordination) and the Shuttle Run (velocity). We included basic anthropometric variables: Body height, Body mass and the Body mass index. The data were analyzed in the SPSS program using the parameters of descriptive statistics. In order to determine the gender differences in the level of physical fitness, a T-test for small independent samples was calculated. The results show that the boys achieved better results and statistically significant differences in the Standing Broad Jump (.002), Flamingo Balance test (.038) and Shuttle Run (.023). The variables for coordination, strength of the abdomen and flexibility did not show a statistically significant difference. Children of both genders have different life habits and they can influence the differences in motor skills performance. Such results match the scores of other authors who also studied the differences in the motor skills of boys and girls.

Title: Comparison of Nutritional and Mineral Contents of Some Edible Wild Plants Used in Herby Cheese

Abstract:Mineral composition is given for the six species of wild edible plants of Liliaceae consumed traditionally and still used in herby cheese manufacturing in eastern Anatolia-Turkey with a high ratio. This investigation carried out the first exhaustive mineral and nutrient determination on these species of plants. This research has discovered great variations inside the contents of mineral and nutritional properties (Na, Mg, K, S, Ca, P, Fe, Mn, Cu, Zn, Cr, Co, total ash, crude fibre, pH, N and crude protein) among these plant species. Except Allium schoenoprasum, the all plant samples were wealthy in a number of the important minerals like Fe, Cu, Ca, K, Mn, and Zn, that are proverbial to be vital in human health. The concentrations of observed heavy metals in the plant samples were found in the ranges: 17.25 - 25.47 mg kg-1 for copper, 18.45 - 34.14 mg kg-1 for zinc, 33.42 - 98.42 mg kg-1 for manganese, 0.12 - 0.54 mg kg-1 for chromium, 0.31 - 1.61 mg kg-1 cobalt. Many significant correlations were found among the parameters analyzed. The study present essential results on the availability of some vital minerals that could be useful or harmful to provide dietary information for designing value-added foods.

Title: The Determining Of The Chemical Composition And Nutrition Quality Of Hungarian Vetch Silage (Vicia pannonica CRANTZ) mixed with wheat (Triticum aestivum L.) and barley (Hordeum vulgare L.) at different rates

Abstract:This research was carried out to determine the quality values of Hungarian vetch (Vicia pannonica Crantz) silage mixed with wheat (Triticum aestivum L.) and barley (Hordeum vulgare L.) grown in winter in ecological conditions of Eastern Anatolia region of Turkey between 2017 and 2018. To determine the quality values and chemical composition of the mixture silages obtained from the different rates of Hungarian vetch, wheat and barley it was prepared as three replications and filled in two liter jars and then firmly suppressed and tightly closed so that they do not breathe. The mixture rates of Hungarian vetch (Anatolian pink), wheat (Syrena) and barley (Tokak 157/37), their pure sowed were 80 %, 60 %, 40 %, 20 % of barley (B)+20 %, 40 %, 60 %, 80 % of Hungarian vetch (HV)+ 80 %, 60 %, 40 %, 20 % of wheat (W). Silage jars were opened after 60 days and pH value, acid detergent fiber (ADF), neutral detergent fiber (NDF), crude protein content and organic acid values and contents of some macro elements of them were detected. \n The values for ADF, NDF, digestible dry matter (DDM), dry matter intake (DMI), relative feed value (RFV), dry matter (DM), crude protein (CP) of silages were 28.57-41.65%, 29.69-59.05%, 56.45- 66.63%, 2.62-4.05%, 89.78-201.62%, 22.22-33.00%, 8.15-17.27%, respectively. At the same time, values of lactic acid (LA), acetic acid (AA), butyric acid (BA) and propionic acid (PA), Calcium (Ca), phosphor (P) and Potassium (K) were 1.50-1.94%, 0.33-0.71%, 0.27-0.76%, 0.02-0.08%; was 0.30-1.68%, 0.33-0.62%, 1.93-4.48%, respectively. \n The pH of silage showed variation between 3.76-4.08 for all groups and ADF (28.57%), DDM (66.63%) and P (0.62%) in 100% B were the highest, whereas NDF (29.69% and 30.87%, respectively) and DMI (4.05% and 3.88%, respectively) in 100% HV and 80% HV+ 20% B of groups were the lowest. The highest RFV (201.62% and 188.66%, respectively) in 100% HV and 100% B; Ca in 100% B (33.00%); CP (17.27%) and Ca (1.68%)in 100% HV; K (4.48% and 4.47%, respectively) in 100% B and 100% W; LA (1.94%) in 80% HV + 20% W; AA (0.71%, 0.65% and 0.66%, respectively) in 100% HV, 100% W and 20% HV + 80% B; BA (0.73% and 0.76% respectively) in 100% HV and 80% HV + 20% B; PA (0.08% and 0.08%, respectively) in 80% HV + 20% W and in 60% HV + 40% W was obtained in pure and mixture sowing rates, while the highest pH value (4.08) was obtained from 60% HV + 40% W mixture. According to these results, it can be proposed that silages achieved from the Hungarian vetch + barley mixture have some superior properties for CP, ADF, NDF, RFV, Ca, P, and K, when compared with Hungarian vetch + wheat mixtures.

Title: Demand and capacity for the provision of social work services for cancer patients at the Vietnam National Cancer Hospital

Abstract:Cancer has seen a rise in incidence rates in many countries in recent years, Vietnam being no exception. Oncology social workers play a central role to assess patients’ needs and provide interventions in addressing their physical, intra-psychic, interpersonal and environmental problems. This paper is a mixed-methods cross-sectional study conducted from June to August 2017 in two branches of the Vietnam National Cancer Hospital. Data collection involved structured interviews with a total of 418 cancer patients, four in-depth interviews with related department heads, and one focus group discussions with 6 social workers. Findings from the study reveal patterns in patient demand and capacity for social work services provision. The paper concludes with brief recommendations to address gaps in service delivery, training, and research.

Title: Determination of The Effects of Salt (Nacl) Stress on Germination in Some Barley (Hordeum vulgare L.) Cultivars

Abstract:This study was carried out on the germination properties and seedling parameters effects of some NaCl doses (control (0) -50-100-150-200 mM) applied to three barley Hordeum vulgare L. cultivars (Kral-97, Altikat and Larende). The study was carried out in the Laboratory of field crops Department of the Faculty of Agriculture of Van Yuzunc Yil University in 2019 according to the experiment two way completely radomized design in petri dishes with 4 replications. According to results of germination parameters; the effects of cultivars on average germination time were significant (p <0.05). The effects of salt doses on all germination parameters were significant (p <0.05). The effects of varieties and NaCl interactions on the differences in all parameters were insignificant (p?0.05). According to the average, the lowest germination power and germination rates were taken from 150 mM NaCl applications and therefore it was observed that these two properties decreased by 15.56% compared to control (0). The effects of salt doses and NaCl interactions on all parameters were significant (p<0.05) while the effects of varieties other than hypocotyl length were insignificant (p ?0.05) and the effects on all remaining parameters were significant (P < 0.05). Increased salt doses have been observed to have a negative effect on all parameters. It was determined that the Larende cultivar had a more salt-resistant performance in terms of all its properties, followed by the Kral-97 variety in general.

Title: [SYLWAN., 163(9)]. ISI Indexed176Investigation of Transportation Attitude of Bicycle Commuters-Shifting from Car to Cycling.

Abstract:Recently, a significant volume of transport systems are being altered in the Middle East, contributing greatly to the actual predicament of congested traffic, polluted air, and road tragedies in the region. In Baghdad, the public transportation is not suitable for most people, especially private car users. A suitable way to resolve this issue is to convince the commuters to change from using personal vehicles to bicycles when traveling short trips. A survey was carried out where a totally of 510 questionnaires were distributed, and of those distributed; only 354 copies were actually used in this study. A comparison of two mode choice models, Artificial Neural Network (Pattern Recognition) and Logistic Regression (LR) was conducted to foretell the transportation mode choice with the purpose of evaluation the accuracy levels of the predictability of model. For the evaluation of car vs. bicycle, the predictability was 91.1% and 96.7% for the LR and the ANN respectively. For validating purposes, the predictability was 95.2% and 97.1% for the logistic Regression model and the ANN model respectively. The results show that the ANN model have superior outcome in terms of predictability and validation in comparison with logistic regression model.


text:
Towards learning primitive-based representations

Humans develop a common-sense understanding of the physical behaviour of the world, within the first year of their life. For example, we are able to identify 3D objects in a scene and infer their geometric and physical properties, even when only parts of these objects are visible. It has long been hypothesized that the human visual system processes the vast amount of raw visual input into compact parsimonious representations, where complex objects are decomposed into a small number of atomic elements (primitives) that can each be represented using low-dimensional descriptions. In the early days of computer vision, researches explored various shape primitives that could potentially mimic the human's perception such as 3D polyhedrals, generalized cylinders, geons and superquadrics. However, it proved very difficult to extract such representations from images due to the lack of computational resources and training data at that time.

Recently, shape primitives have been revisited in the context of deep learning. Primitive-based representations provide an interpretable alternative towards traditional shape extraction methods that do not take into consideration the constituent parts of the target object.

In CVPR, 2019
pdf code bib
In CVPR, 2020
pdf code
@inproceedings{Paschalidou2019CVPR,
title = {Superquadrics Revisited: Learning 3D Shape Parsing beyond Cuboids},
author = {Paschalidou, Despoina and Ulusoy, Ali Osman and Geiger, Andreas},
booktitle = {Proceedings IEEE Conf. on Computer Vision and Pattern Recognition (CVPR)},
month = jun,
year = {2019},
}

@inproceedings{Paschalidou2020CVPR,
title = {Learning Unsupervised Hierarhical Part Decomposition of 3D Objects from a Single RGB Image},
author = {Paschalidou, Despoina and Luc van Gool and Geiger, Andreas},
booktitle = {Proceedings IEEE Conf. on Computer Vision and Pattern Recognition (CVPR)},
month = jun,
year = {2020},
}

Inspired by the nature of the human’s cognitive system, that perceives an object as a decomposition of parts, researchers have proposed to represent objects as a set of atomic elements, which we refer to as primitives. Examples for such primitives include 3D polyhedral shapes, generalized cylinders and geons for decomposing 3D objects into a set of parts. In 1986, Pentland introduced a parametric version of generalized cylinders, based on deformable superquadrics. He proposed a system able to represent the scene structure using multiple superquadrics.

Superquadrics are a parametric family of surfaces that can describe cubes, cylinders, spheres, ellipsoids etc in a single continuous parameter space. They are fully described using 11 parameters: 6 for the pose, 3 for the size and 2 for the shape. One of the most important features of superquadric surfaces is their interchangeable implicit and explicit function definition. The explicit superquadric function defines the surface vector $$\mathbf{r}$$that can be used for sampling points on the superquadric surface \mathbf{r}(\eta, \omega) = \begin{bmatrix} \alpha_{1}\cos^{\epsilon_{1}}\eta \cos^{\epsilon_{2}}\omega \\ \alpha_{2}\cos^{\epsilon_{1}}\eta \sin^{\epsilon_{2}}\omega \\ \alpha_{3}\sin^{\epsilon_{1}}\eta \end{bmatrix} \quad \begin{aligned} -\pi/2 &\leq \eta \leq \pi/2\\ -\pi &\leq \omega \leq \pi \end{aligned} \label{eq:parametric_eq_supp}

where $$\mathbf{\alpha} = [\alpha_{1}, \alpha_{2}, \alpha_{3}]$$ determine the size and $$\mathbf{\epsilon} = [\epsilon_{1}, \epsilon_{2}]$$ determine the global shape of the superquadric. Below we visualize the shape of superquadrics for different values of $$\epsilon_{1}$$ and $$\epsilon_{2}$$. In addition to the shape parameters, each superquadric is associated with a rigid body transformation. This transformation is represented by a translation vector $$\mathbf{t} = [t_{x}, t_{y}, t_{z}]$$ and a quaternion $$\mathbf{q} = [q_{0}, q_{1}, q_{2}, q_{3}]$$ that determines the coordinate system transformation from world coordinates to local primitive-centric coordinates.

The implicit function can be used to decide the relative position of any 3D point w.r.t the superquadric surface. In particular, for any point $$\mathbf{x} \in \mathbb{R}^3$$, we can determine whether it lies inside or outside a superquadric using its implicit surface function which is commonly referred to as the inside-outside function. $$$$f(\mathbf{x}; \lambda) = \left(\left(\frac{x}{\alpha_{1}}\right)^{\frac{2}{\epsilon_{2}}} + \left(\frac{y}{\alpha_{2}}\right)^{\frac{2}{\epsilon_{2}}}\right)^{\frac{\epsilon_{2}}{\epsilon_{1}}} + \left(\frac{z}{\alpha_{3}}\right)^{\frac{2}{\epsilon_{1}}} \label{eq:implicit_sq}$$$$ If $$f(\mathbf{x}; \lambda) = 1.0$$, $$\mathbf{x}$$ lies on the surface of the superquadric, if $$f(\mathbf{x}; \lambda) < 1.0$$ the corresponding point lies inside and if $$f(\mathbf{x}; \lambda) > 1.0$$ the point lies outside the superquadric.

We provide an easy-to-use script that can be used for visualizing the superquadric surface given a set of parameters. Code is available here.

References
• Peter Elias and Lawrence G Roberts. Machine perception of three-dimensional solids. PhD thesis, Massachusetts Institute of Technology, 1963
• I Binford. Visual perception by computer. In IEEE Conference of Systems and Control, 1971
• Alan H Barr. Superquadrics and angle-preserving transformations. IEEE Computer Graphics and Applications (CGA), 1981
• Irving Biederman. Recognition-by-components: a theory of human image understanding. Psychological Review, 94(2):115, 1987
• Ales Jaklic, Ales Leonardis, and Franc Solina. Segmentation and Recovery of Superquadrics, volume 20 of Computational Imaging and Vision. Springer, 2000


text:
FORTH for the SHARP PC-E500 (S)
01-13-2022, 03:40 AM
Post: #61
 robve Member Posts: 297 Joined: Sep 2020
RE: FORTH for the SHARP PC-E500 (S)
(01-12-2022 11:06 PM)Helix Wrote:  I'm still learning Forth, following the book Starting Forth 2nd edition. (I know it's outdated, but it's didactic and enjoyable. I have also the Forth Programmer's Handbook for a more modern reference.)

I have a problem with the KEY? word. If no key is pressed, it returns "error -57" instead of 0.
The same problem occurs with EKEY? Furthermore, if a key is pressed, EKEY? returns 255. I think it should be -1.

It is good to hear you are putting Forth500 through its paces

You made a good point. The EKEY? word calls CHAR-READY? but then throws exception -57 if CHAR-READY? returns true. This is a small part of the older pceForth version, which looks wrong to me. The EKEY? Forth standard word requires EKEY? to return true or false.

I will correct this discrepancy soon and release an update.

I may also add a new module LOCALS.FTH that I wrote from scratch to implement the LOCALS word set (I heard that Forth purists turn their nose up to LOCALS, arguing that it is superfluous since everything can be done via the stacks.)

I was tinkering with some code I wrote to add dynamic scoping of arguments and locals to Forth definitions. This turns out to be surprisingly simple to implement in Forth itself, so I wouldn't be surprised if someone hasn't done this already.

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
01-16-2022, 09:22 PM
Post: #62
 robve Member Posts: 297 Joined: Sep 2020
RE: FORTH for the SHARP PC-E500 (S)
Helix,

The EKEY? and KEY? exception problem is fixed. That was annoying. Thanks for reporting. Sorry to have missed that. I try to test Forth500 as much as possible before releasing updates, but there is only so much time one person can put into this.

The Forth500 update includes the following changes:

- updated BREAK key pressing exception to display Break instead of <Error -28

- updated REPRESENT to produce 12 or 13 non-rounded digits for single floating point results instead of 10, which means that single precision arithmetic is practically performed with 12 or even 13 digits without rounding

- updated double floating point computation results to round to 20 digits rather than ignoring the guard digits

- fixed EKEY? issue that affected KEY? as well

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
01-18-2022, 12:32 AM
Post: #63
 Helix Member Posts: 239 Joined: Dec 2013
RE: FORTH for the SHARP PC-E500 (S)
Thank you for the update! Now EKEY? works as expected.

Jean-Charles
02-19-2022, 09:40 PM
Post: #64
 Helix Member Posts: 239 Joined: Dec 2013
RE: FORTH for the SHARP PC-E500 (S)
I think I have found another quirk.
M*/ ignores negative numbers.
For example -1. 1 1 M*/ D. gives 1 instead of -1
Same result with 1. -1 1 M*/

Jean-Charles
02-20-2022, 09:13 PM
Post: #65
 robve Member Posts: 297 Joined: Sep 2020
RE: FORTH for the SHARP PC-E500 (S)
(02-19-2022 09:40 PM)Helix Wrote:  I think I have found another quirk.
M*/ ignores negative numbers.
For example -1. 1 1 M*/ D. gives 1 instead of -1
Same result with 1. -1 1 M*/

It's easy to fix and I will update the repo soon. There is an internal RAM register clash that resets the sign bit of the result. This issue should not have happened. I may have overlooked this specific case when testing the latest round of speed optimizations and code size reductions to make the Forth500 system fit in about 20K

-Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
02-20-2022, 11:12 PM
Post: #66
 Helix Member Posts: 239 Joined: Dec 2013
RE: FORTH for the SHARP PC-E500 (S)
Thanks for the update

Jean-Charles
04-03-2022, 12:53 AM
Post: #67
 robve Member Posts: 297 Joined: Sep 2020
RE: FORTH for the SHARP PC-E500 (S)
I haven't had the time to work on a text file editor for Forth500 to edit Forth source code. I usually INCLUDE my programs from COM: or use CLOAD with the CE-126P. Editing text files on the RAM disk can be done with a separate BASIC program called edit500 available at: http://www.andrewwoods3d.com/pce500/

Or you could use my new Forth500 TLOAD command defined below that loads Forth from a TEXT file created in BASIC with the built-in BASIC editor:

Code:
\ TLOAD.FTH load TEXT file with line numbers as Forth source \ Author: Robert van Engelen \ TLOAD filename .( Loading TLOAD...) ANEW _TLOAD_ DECIMAL : TLOADED       ( c-addr u -- )   \ open file and save fileid to the return stack   R/O OPEN-FILE THROW >R   \ read header 16 bytes + 0 0 CR bytes   FIB 19 R@ READ-FILE 0= SWAP 19 = AND   \ and check if it is a TEXT file header   FIB 5 S\" \xff\x00\x08\x00\x34" S= AND IF     BEGIN       \ while not EOF and line number high byte is not $FF R@ READ-CHAR 0= SWAP$FF <> AND WHILE       \ read and nip line number low byte       R@ READ-CHAR NIP 0= WHILE       \ get line len byte       R@ READ-CHAR 0= WHILE ( -- len1 )       \ read the len number of bytes into the FIB       FIB OVER R@ READ-FILE 0= WHILE ( -- len1 len2 )       \ all bytes read?       OVER = WHILE ( -- len1 )       \ evaluate the line read       FIB SWAP ['] EVALUATE CATCH ?DUP IF         \ drop string that failed to evaluate, close file and rethrow         2DROP R> CLOSE-FILE DROP THROW       THEN     AGAIN     ELSE DROP THEN     ELSE 2DROP THEN     ELSE DROP THEN     THEN     THEN   ELSE     ." not TEXT"   THEN   \ pop fileid from the return stack and close file   R> CLOSE-FILE DROP ; : TLOAD         ( "name" -- ) PARSE-NAME TLOADED ;

This approach is similar to the PC-G850(V)(S) C programming with its built-in line-number-based text editor. It is a bit odd to use line numbers. But hey, this is a throwback to the 80s

1. in BASIC key in TEXT, the prompt will change to < to indicate the TEXT mode
2. type in your Forth program line-by-line with line numbers
3. use RENUM in case you can't insert a line
4. then SAVE "name" to save your program to RAM disk as name.BAS (don't forget this step!)
5. go back to Forth500 with CALL&B0000 (or CALL&B9000 on a 32K machine)
7. done!

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
04-03-2022, 11:06 PM (This post was last modified: 04-03-2022 11:10 PM by Helix.)
Post: #68
 Helix Member Posts: 239 Joined: Dec 2013
RE: FORTH for the SHARP PC-E500 (S)
(04-03-2022 12:53 AM)robve Wrote:  I haven't had the time to work on a text file editor for Forth500 to edit Forth source code. I usually INCLUDE my programs from COM: or use CLOAD with the CE-126P. Editing text files on the RAM disk can be done with a separate BASIC program called edit500 available at: http://www.andrewwoods3d.com/pce500/

Or you could use my new Forth500 TLOAD command defined below that loads Forth from a TEXT file created in BASIC with the built-in BASIC editor:

Thank you for this suggestion and for this clever program. However I'm currently busy with other things, and I will not test them soon.
I've just spent an hour trying the INCLUDE command, that I have never used so far, but for some reason it didn't work. Maybe I'm messing something in the file format, or I've forgotten one important detail, but I give up.
I will certainly return to Forth and to the PC-E500 next winter.

However, if this program works as expected, it should completly satisfy my needs .
So, thank you again!

Jean-Charles
04-04-2022, 12:47 AM (This post was last modified: 04-12-2022 02:17 AM by robve.)
Post: #69
 robve Member Posts: 297 Joined: Sep 2020
RE: FORTH for the SHARP PC-E500 (S)
(04-03-2022 11:06 PM)Helix Wrote:  I've just spent an hour trying the INCLUDE command, that I have never used so far, but for some reason it didn't work. Maybe I'm messing something in the file format, or I've forgotten one important detail, but I give up.

Have you tried this? To load from COM:, make sure to set the serial parameters first on the E500 to correspond to the settings of your sending program, which should be done once (and for all) in BASIC with OPEN "baud rate, parity, word length, stop bit, A, C, &H1A, XON" AS #1 then CLOSE #1. The file to send should have an ending &1A (ctrl-Z) end of file.

PS. I should add that commands like INCLUDE open and then close the file, even when an error occurred. However, if files or COM: cannot be opened, then try fileid CLOSE-FILE . for some fileid>0 values to close the file. This closes the file if for some reason it stayed open e.g. after a program aborted due to an error when files are open.

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
06-21-2022, 02:16 AM
Post: #70
 robve Member Posts: 297 Joined: Sep 2020
RE: FORTH for the SHARP PC-E500 (S)
Compute digits of pi.
The following Forth500 program is based on the C code to compute the digits of pi by Dik T. Winter, CWI Amsterdam. It computes up to 9864 digits of pi, but is memory-restricted to about 6000 digits max:
Code:
.( Loading BIG-PI...) ANEW _BIG_PI_ DECIMAL 0 VALUE b       0 VALUE c 0 VALUE e       0 VALUE g 0. 2VALUE d      \ array f located at HERE + 40 bytes (hold area) : f!    CELLS HERE + 40 + ! ; : f@    CELLS HERE + 40 + @ ; : big-pi    ( +n -- )   DUP 4 < ABORT" too small"   \ c=7*n/2; c-=c%14   7 UM* D2/ D>S DUP 14 MOD - TO c   \ check for sufficient space to store array f   c UNUSED 40 - 1 RSHIFT U> ABORT" out of memory"   \ f[0...c-1]=2000   c 0 DO 2000 I f! LOOP   \ e=0   0 TO e   CR   BEGIN     \ d=0; g=2*c-1; b=c     0. TO d     c 2* 1- TO g     c TO b     BEGIN       \ d+=f[b]*10000; f[b]=d%g; d/=g; g-=2; b--       b f@ 10000 UM* +TO d       d g 0 D/MOD       TO d       D>S b f!       -2 +TO g       -1 +TO b     b WHILE       \ d*=b       d b UMD* TO d     REPEAT     \ printf("%.4u",e+d/10000); e=d%10000     d 10000 SM/REM     e + 0 <# # # # # #> TYPE     TO e     \ c-=14     -14 +TO c   c 0= UNTIL ;

A screenful with the first 152 digits of pi (this takes one minute to compute):
Code:
152 big-pi 3141592653589793238462643383279502884197 1693993751058209749445923078164062862089 9862803482534211706798214808651328230664 70938446095505822317253594081284 OK[0]

A C program for the PC-G850(V)(S):
Code:
1 unsigned long a=10000,d; 2 unsigned b,c,e,*f,g; 3 main(){ 4  printf("digits?");scanf("%u",&c); 5  c=7*c/2;c-=c%14;f=malloc(4*c+4); 6  for(;b-c;)f[b++]=a/5; 7  for(;d=0,g=c*2;c-=14,printf("%.4lu",e+d/a),e=d%a) 8   for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b); 9 }

The PC-G850VS calculates the first 152 digits of pi in 1 minute and 15 seconds.

This slightly modified version in C with 64 bit integers correctly computes up to 54935 digits of pi:
Code:
uint64_t a=10000,b,c,d,e,*f,g; main(){printf("digits?");scanf("%llu",&c);c*=3.5;c-=c%14;f=malloc(sizeof(*f)*(c+1)); for(;b-c;)f[b++]=a/5;for(;d=0,g=c*2;c-=14,printf("%.4llu",e+d/a),e=d%a) for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);}

The 54936th digit is off by one, followed by 10000 instead of 0000:

362524395716152714669005814610000
___________________________^x____
where a 7 should appear in place of the 6, falling the 1 to carry over to the 6. When pushing for 100000 digits this happens a few more times. I reckon the algorithm can be fixed to perform the carry. But this algorithm is quite slow for long digit sequences. There are also better algorithms, e.g. BBP, Chudnovsky.

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
06-22-2022, 02:10 AM
Post: #71
 F-73P Junior Member Posts: 34 Joined: May 2020
RE: FORTH for the SHARP PC-E500 (S)
Thanks for sharing, these interesting algorithms will be a nice test for the C compiler I'm writing. I think once I've added integer division and remainder I can try the C program you provided for the PC-G850(V)(S).
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)


text:
# Picturing reference frames

1. Sep 18, 2008

### kehler

I picture two reference frames for two different objects moving relative to each other as two coordinate spaces S and S'. My question is, say both spaces start of on top of each other (ie both objects are initially stationary) and then the objects start moving relative to each other, would the whole coordinate space for one of the objects move or do their origins always coincide and one just expands/shrink but remains centered on the origin?

Is this a bad way to think of it? I've read my notes a few times but I'm still having a hard time trying to picture SR in my mind :(. Can anyone suggest any other ways to picture SR?

2. Sep 18, 2008

### haaj86

The way you should think about it is that the two observers are sitting at the origins, and the reference frames are their coordinate system. Therefore if the two observers are in a relative motion to each other their coordinate system moves with them, including the origin since they are sitting at it. You can picture a frame of reference as a lattice of synchronized clocks and meter sticks. The whole point of SR is not really to “see” how the frames would look like but rather to compare “measurements” between them.
To make the idea of the lattice more clear the following might help:
“A way to avoid this ambiguity is to remove the observers and simply fill up space
with a large rigid lattice of meter sticks and synchronized clocks. Different frames
are defined by different lattices. All of the meter sticks in a given frame are at rest
with respect to all the others, so there is no issue of length contraction within each
frame. To measure the length of something, we simply need to determine where
the ends are (at simultaneous times, as measured in that frame) with respect to the
lattice.
This lattice way of looking at things emphasizes that observers are not important,
and that a frame is defined simply as a lattice of space and time coordinates.
Anything that happens (an “event”) is automatically assigned a space and time
coordinate in every frame, independent of any observer.” Page 523, Introduction to classical mechanics with problems and solutions, 2008, David Morin

3. Sep 18, 2008

### Fredrik

Staff Emeritus
What you should do is learn about spacetime diagrams, i.e. you picture one time dimension and one spatial dimension.

4. Sep 18, 2008

### kehler

Thanks guys. Another thing I was wondering is will there be some kind of proportionality between events in frames? Say three events happens at t=0, t=1 and t=2 in one frame. The first two of those events happen at t=4 and t=6 in another frame. Will the third happen at t=8 then?
I also didn't quite get why geometry (x^2+y^2+z^2-(ct)^2) will be constant in all frames since there's length contraction? Does that mean that since the length in the direction parallel to motion has contracted, lengths in other axes must increase by the same amount? I'm assuming it would be the time x c component that increases...

Last edited: Sep 18, 2008
5. Sep 18, 2008

### yuiop

Lengths in axes orthogonal to the relative motion of the reference frames (usually taken to be the y and z axes with the relative motion of the frames parallel to the x axis) does not decrease or increase. It is the time dilation of time coordinate (ct) that adjusts to compensate for the length contraction of the x coordinate.

Last edited: Sep 18, 2008
6. Sep 18, 2008

### yuiop

You need to specify a time and a place to define an event. So let's say you have three events t=0, t=1 and t=2 in one frame that happen at the same place (x=0) from the point of view of that frame's observer. These coordinates would be denoted in (x,t) coordinates as (0,0), (0,1) and (0,2) in that frame.

In another frame S' with a relative velocity v/c of 0.866c to original frame S, the gamma factor $$\gamma$$ would be:

$$\gamma = \frac{1}{\sqrt{1 - \frac{v^2}{c^2}}} = 2$$

The Lorentz transformations for the t and x coords in the primed frame are given by :

$$t^{\prime} = \gamma \left( t - \frac{vx}{c^2} \right)$$

$$x^{\prime} = \gamma (x - vt)$$

The transformation of the three (x,t) events, (0,0), (0,1) and (0,2) is:

(x,t) --> (x' , t')

(0,0) --> (0 , 0)
(0,1) --> (-1.732 , 2)
(0,2) --> (-3.464 , 4)

The t coords of 0, 1 and 2 transform to 0, 2 and 4 in this specific example where the events all occur at x=0 in the rest frame of the original observer. It is important to note that the transformation of the time coordinate is interrelated to how the x coordinate of the events evolve in the rest frame of the original observer.

In an every day example if you invite people to an event, you might say "You are invited to a wedding on (date of event) at (place of event).


text:
# Technical Reports

Ajoy K. Datta, St\'ephane Devismes, Lawrence L. Larmore, S\'ebastien Tixeuil
Fast Leader (Full) Recovery despite Dynamic Faults (2012)

TR-2012-18.pdf

Keywords: self-stabilization, $k$-stabilization, leader election, leader recovery

Abstract: In this paper, we give a leader recovery protocol, \lek, that recovers a legitimate configuration where a single leader exists, after at most $k$ memory corruption faults hit the system in an arbitrary manner. That is, if a leader $\ell$ is elected before state corruption, the \emph{same} leader is elected after recovery. Our protocol works for an anonymous bidirectional, yet oriented, ring of size $n$, and does \emph{not} require that processes know $n$, although the knowledge of $k$ is assumed. If $n\ge 18k+1$, our protocol recovers the leader in $O(k^\malytwo)$ rounds using $O(\log k)$ bits per process, assuming unfair scheduling. Our protocol handles \emph{dynamic} faults in the sense that the $k$ memory corruption faults may occur while the network has started recovering the leader.

Contact | Plan du site | Site réalisé avec SPIP 3.1.12 + AHUNTSIC [CC License]

info visites 1534946


text:
# Calculus Solutions¶

In [ ]:
from sympy import *
from IPython.display import display # This, with init_printing(), will let us "print" to MathJax
init_printing()

For each exercise, fill in the function according to its docstring.

In [ ]:
x, y, z = symbols('x y z')

## Derivatives¶

Compute the following

$$\frac{d}{dx}\sin(x)e^x$$$$\frac{\partial}{\partial x}\sin(xy)e^x$$$$\frac{\partial^2}{\partial x\partial y}\sin(xy)e^x$$
In [ ]:
diff(sin(x)*exp(x), x)

In [ ]:
diff(sin(x*y)*exp(x), x)

In [ ]:
diff(sin(x*y)*exp(x), x, y)

Recall l'Hopital's rule, which states that if $$\lim_{x\to x_0}\frac{f(x)}{g(x)}$$ is $\frac{0}{0}$, $\frac{\infty}{\infty}$, or $-\frac{\infty}{\infty}$, then it is equal to $$\lim_{x\to x_0} \frac{f'(x)}{g'(x)}$$ (we will not consider other indeterminate forms here).

Write a function that computes $\lim_{x\to x_0}\frac{f(x)}{g(x)}$. Use the fraction function to get the numerator and denominator of an expression, for example

In [ ]:
fraction(x/y)

You may assume that the only indeterminate forms are the ones mentioned above, and that l'Hopital's rule will terminate after a finite number of steps. Do not use limit (use subs). Remember that after taking the derivatives, you will need to put the expression into the form $\frac{f(x)}{g(x)}$ before applying l'Hopital's rule again (what function did we learn that does this?).

In [ ]:
def lhopital(expr, x, x0):
"""
Computes limit(expr, x, x0) using l'Hopital's rule.

>>> lhopital(sin(x)/x, x, 0)
1
>>> lhopital(exp(x)/x**2, x, oo)
oo
>>> lhopital((x**2 - 4*x + 4)/(2 - x), x, 2)
0
>>> lhopital(cos(x), x, 0)
1
>>> lhopital((x + sin(x))/x, x, 0)
2
"""
expr = cancel(expr)
expr_num, expr_den = fraction(expr)
expr_num_eval, expr_den_eval = expr_num.subs(x, x0), expr_den.subs(x, x0)
indeterminates = [(0, 0), (oo, oo), (-oo, oo), (oo, -oo), (-oo, -oo)]
if (expr_num_eval, expr_den_eval) in indeterminates:
return lhopital(expr_num.diff(x)/expr_den.diff(x), x, x0)
return expr_num_eval/expr_den_eval

In [ ]:
lhopital(sin(x)/x, x, 0)

In [ ]:
lhopital(exp(x)/x**2, x, oo)

In [ ]:
lhopital((x**2 - 4*x + 4)/(2 - x), x, 2)

In [ ]:
lhopital(cos(x), x, 0)

In [ ]:
lhopital((x + sin(x))/x, x, 0)

## Integrals¶

Recall that the mean value of a function on an interval $[a, b]$ can be computed by the formula

$$\frac{1}{b - a}\int_{a}^{b} f{\left (x \right )} dx. % Why doesn't \, work?$$

Write a function that computes the mean value of an expression on a given interval.

In [ ]:
def average_value(expr, x, a, b):
"""
Computes the average value of expr with respect to x on [a, b].

>>> average_value(sin(x), x, 0, pi)
2/pi
>>> average_value(x, x, 2, 4)
3
>>> average_value(x*y, x, 2, 4)
3*y
"""
return integrate(expr, (x, a, b))/(b - a)

In [ ]:
average_value(sin(x), x, 0, pi)

In [ ]:
average_value(x, x, 2, 4)

In [ ]:
average_value(x*y, x, 2, 4)

Write a function that takes a list of expressions and produces an "integral table", like

1. $$\int \sin(x)dx = -\cos(x) + C$$
2. $$\int \cos(x)dx = \sin(x) + C$$
3. $$\int e^xdx = e^x + C$$
4. $$\int \log(x)dx = x(\log(x) - 1) + C$$
In [ ]:
def int_table(exprs, x):
"""
Produces a nice integral table of the integrals of exprs

>>> int_table([sin(x), cos(x), exp(x), log(x)], x)
⌠
⎮ sin(x) dx = C - cos(x)
⌡
⌠
⎮ cos(x) dx = C + sin(x)
⌡
⌠
⎮  x           x
⎮ ℯ  dx = C + ℯ
⌡
⌠
⎮ log(x) dx = C + x⋅log(x) - x
⌡
"""
C = symbols('C')

for expr in exprs:
display(Eq(Integral(expr, x), integrate(expr, x) + C))

In [ ]:
int_table([sin(x), cos(x), exp(x), log(x)], x)

Now use your function to compute the integrals in this Mathematica ad. Remember that the inverse trig functions are spelled like asin in SymPy.

The ad below probably has a typo, because one of the integrals is trivial to compute. Include what you think the integral should be, and see if SymPy can compute that as well.

In [ ]:
from IPython.core.display import Image
Image(filename='../imgs/Mathematica-ring-a.png')

In [ ]:
a, b, c, n = symbols('a b c n')
int_table([x*atanh(a), a*x**n + b*x + c, csc(a*x)*sec(a*x)**2, x*atanh(a*x)], x)

## Limits¶

Recall that the definition of the derivative of $f(x)$ at $x=x_0$ is $$f'(x_0) = \lim_{x\to x_0}\frac{f(x) - f(x_0)}{x - x_0}.$$ Write a function that computes the derivative using the limit definition, using limit.

In [ ]:
def lim_deriv(expr, x, x0):
"""
Computes the derivative of expr with respect to x at x0 using the limit definition.

>>> lim_deriv(x**2, x, 0)
0
>>> lim_deriv(cos(x*y), x, pi)
-y*sin(pi*y)

Note that we must use this trick to take the derivative without evaluating at a point.
>>> lim_deriv(exp(x**2), x, y).subs(y, x)
2*x*exp(x**2)
"""
return limit((expr - expr.subs(x, x0))/(x - x0), x, x0)

In [ ]:
lim_deriv(x**2, x, 0)

In [ ]:
lim_deriv(cos(x*y), x, pi)

The function you wrote above to compute limits using l'Hopital's rule is very fragile. And even if you try to make it sophisticated, it will still be unable to compute many limits. Try it on the following limits, and see what happens. Then try computing the same limits with limit.

1. $$\lim_{x\to 0}\frac{\log(x)}{x}$$
2. $$\lim_{x\to \infty}\frac{2^x}{3^x} \textbf{Warning: Be sure to save the notebook before you test this one, and be prepared to kill the kernel!}$$
3. $$\lim_{x\to \infty}x\sin{\left(\frac{1}{x}\right)}$$
4. $$\lim_{x\to 1}\arctan\left(\frac{1}{1 - x}\right)\; \text{Remember that \arctan is called }\mathtt{atan}\text{ in SymPy}$$
In [ ]:
lhopital(log(x)/x, x, 0)

In [ ]:
limit(log(x)/x, x, 0)

In [ ]:
lhopital(2**x/3**x, x, oo) XXX: Don't run. This hangs the notebook

In [ ]:
limit(2**x/3**x, x, oo)

In [ ]:
lhopital(x**(1/x**2), x, 0)

In [ ]:
limit(x**(1/x**.5), x, 0)

In [ ]:
lhopital(x*sin(1/x), x, oo)

In [ ]:
limit(x*sin(1/x), x, oo)

In [ ]:
lhopital(atan(1/(1 - x)), x, 1)

In [ ]:
limit(atan(1/(1 - x)), x, 1)

## Series¶

The Fibonicci sequence is rexcursively defined by

$$F_0 = 0,$$$$F_1 = 1,$$$$F_n = F_{n - 1} + F_{n - 2}.$$

The first few vales are 0, 1, 1, 2, 3, 5, 8, 13, 21, …

The Fibonicci sequence has a generating function given by $$s(x) = \frac{x}{1 - x - x^2}$$ (see http://en.wikipedia.org/wiki/Fibonacci_number#Power_series for a derivation). What this means is that if we expand $s(x)$ as a power series, the coefficients are the Fibonicci numbers, $$s(x) = \sum_{n=0}^\infty F_nx^n$$

Write a function that uses series to compute the nth Fibonicci number.

Hint: expr.coeff(x, n) will give the coefficient of $x^n$ in an expression. For example

In [ ]:
(1 + 2*x - x**2).coeff(x, 0)

In [ ]:
(1 + 2*x - x**2).coeff(x, 1)

In [ ]:
(1 + 2*x - x**2).coeff(x, 2)

In [ ]:
def fib(n):
"""
Uses series expansion and a generating function to compute the nth Fibonnicci number.

>>> fib(0)
0
>>> fib(4)
3
>>> fib(9)
34
"""
s = x/(1 - x - x**2)
return s.series(x, 0, n + 1).coeff(x, n)

In [ ]:
fib(0)

In [ ]:
fib(4)

In [ ]:
fib(9)

Note: if you really want to compute Fibonicci numbers, there is a function in SymPy called fibonicci that can do this far more efficiently.

In [ ]:
[fibonacci(i) for i in range(10)]

series is nice if you want a fixed power series, but what if you don't know ahead of time how many terms you want? For that, there is the lseries method, which returns a generator of series terms. This is more efficient than recomputing the whole series again if you determine you need more terms. Here is an example usage (Warning: since series are in general infinite, lseries will return an infinite generator. Here we use zip to limit the number of terms).

In [ ]:
for term, _ in zip(cos(x).lseries(x, 0), range(10)):
display(term)

Write a function that computes the number of terms of a series expansion of a given function are needed to compute the given value near the given point within the given accuracy. For example, in the expansion of cos(x) near $\pi$, suppode we wish to compute $\pi + 1$. Let us see if terms up to $O(x^6)$ are sufficient (remember that due to a limitation in SymPy, when computing the series away from 0 with series, we have to use a shift)

In [ ]:
a = cos(x).series(x, pi, 5).removeO().subs(x, x - pi).evalf(subs={x: pi + 1})
a

In [ ]:
b = cos(pi + 1).evalf()
b

So the expansion is accurate up to two places after the decimal point, i.e., within 0.01.

In [ ]:
abs(a - b) < 0.01

Note, with lseries, we do not need to worry about shifts

In [ ]:
for term, _ in zip(cos(x).lseries(x, pi), range(10)):
display(term)

Hint: to get the exponent from a term like 3*(x - 1)**5, use as_coeff_exponent.

In [ ]:
(3*(x - 1)**5).as_coeff_exponent(x - 1)

In [ ]:
def series_accuracy(func, expansion_point, evaluation_point, accuracy, x):
"""
Returns n such that series terms up to and including (x - expansion_point)**n
(i.e., O((x - expansion_point)**(n + 1)) are needed to compute func at
evaluation_point within the given accuracy.

>>> series_accuracy(cos(x), pi, pi + 1, 0.01, x)
4
>>> series_accuracy(exp(x), 1, 10, 1, x)
23
"""
# Make sure to compute as many digits as needed. evalf defaults to 15, so this
# is not actually needed for any of the doctest examples.
digits = max(15, round(1/accuracy) + 1)
real_value = func.evalf(digits, subs={x: evaluation_point})
expansion = 0
for term in func.lseries(x, expansion_point):
expansion += term
series_value = expansion.evalf(digits, subs={x: evaluation_point})
if abs(real_value - series_value) < accuracy:
return term.as_coeff_exponent(x - expansion_point)[1]

In [ ]:
series_accuracy(cos(x), pi, pi + 1, 0.01, x)

In [ ]:
series_accuracy(exp(x), 1, 10, 1, x)

In [ ]:


text:
# Probability to extract balls problem

1. Mar 22, 2015

### Nick666

My knowledge about this kind of problems is almost zero, so I need some help.

I know that if we have 20 balls in a urn, 1 to 20, the probability to extract 1 to 5 in a extraction is 5/20=1/4

But what if we have 4 extractions with the balls extracted put back in the urn? How do I calculate that ?

2. Mar 22, 2015

The number of ways of choosing a ball is 20C1. Therefore, the probability of getting a ball (say ball 4) is 1/20

Now you put it back. Say you are trying to find the probability distribution of getting ball 2 from the urn. The probability of success is 1/20 and probability of failure is 19/20.
Since you put back the ball, in the next trial, the probability of success and failure is same.
We call such trials as Bernoulli trials.
So in 4 trials, the probability of getting ball 2 r times is $$P(X=r)=^4C_r(\frac{1}{20})^r(\frac{19}{20})^{(n-r)}$$

3. Mar 22, 2015

If you did not understand the expression, then the topic you have to learn is "probability distribution" and "Bernoulli trials". Use a good mathematics book Or use Wikipedia.

4. Apr 2, 2015

### CAH

No! If you are saying the probability of choosing the balls 1,2,3,4,5 without replacing the balls back in the urn it goes like this:
P(extracting ball 1) multiplied by P(extracting ball 2) multiplied by P(extracting ball 3).. Etc.
(1/20)x(1/19)x(1/18)x(1/17)x(1/16) because once you take ball one out there's only 19 balls left in the urn and so on..!

However if your talking about extracting ball 1 and replacing it and then choosing ball 2 (with ball one back in the urn) it's out of 20 again. And will go like this...
P(1) -(probability of choosing ball 1)- times P(2) times P(3).. Etc...
(1/20)x(1/20)x(1/20)x(1/20)x(1/20)

Now that is the the probablility of choosing the balls in a specific order like, ball 1, then ball 2, then ball 3... So to get the probability of choosing them five balls out of the urn in ANY ORDER (1 then 3 then 5 then 2 then 4 PLUS 1,2,3,4,5 PLUS 2,3,1,4,5 and so on..) then we have to multiply but the number of balls 'factorial' so 5! (! Is the factorial sign, it is the same as 5x4x3x2x1)

5. Apr 2, 2015

### Nick666

But I wasnt talking about extracting one ball at a time, but 5 balls at one extraction. Lets consider it an electronic random extraction done by a computer that instantly eliminates 5 balls out of 20.

6. Apr 3, 2015


text:
Unless you’ve been sleeping under a rock, you’ve probably encountered Generative Adversarial Networks before. At least you’ve seen the pictures. For instance, you can create fake images of bedrooms, as done in this paper by Radford et al. in 2015.

At their heart, GANs use the notion that a data generator is good, if we cannot tell fake data apart from real data. In statistics, this is called a two-sample test - a test to answer the question whether datasets $$X = \{x_1, \ldots x_n\}$$ and $$X' = \{x_1', \ldots x_n'\}$$ were drawn from the same distribution. The main difference to most statistics papers is that GANs use this idea in a constructive way. In other words, rather than just telling a user that ‘hey, these two datasets don’t look like they came from the same distribution’, this allows us to improve the data generator until it is close to the real data. Or at least indistinguishable from it, as far as a classifier is concerned.

As you can see, there are two pieces to GANs - first off, we need a device (say, a deep network but it really could be anything, such as a game rendering engine) that might potentially be able to generate data that looks just like the real thing. Obviously, if we are dealing with images, this needs to generate images. If we’re dealing with speech, it needs to generate audio sequences, and so on. We call this the generator network. The second component is the discriminator network. It attempts to distinguish fake and real data from each other. Both networks are in competition with each other. The generator network attempts to fool the discriminator network. At that point, the discriminator network adapts to the new fake data. This information, in turn is used to improve the generator network, and so on.

Generator * Draw some parameter $$u$$ from a source of randomness, e.g. a normal distribution $$u \sim \mathcal{N}(0,1)$$. * Apply a function $$f$$ such that we get $$x' = g(u,w)$$ * Compute the gradient with respect to $$w$$ to minimize $$\log p(y = \mathrm{fake}|x')$$

Discriminator * Improve the accuracy of a binary classifier $$f$$, i.e. maximize $$\log p(y=\mathrm{fake}|x')$$ and $$\log p(y=\mathrm{true}|x)$$ for fake and real data respectively.

In short, there are two optimization problems running simultaneously, and the optimization terminates if a stalemate has been reached. There are lots of further tricks and details on how to modify this basic setting. For instance, we could try solving this problem in the presence of side information. This leads to cGAN, i.e. conditional Generative Adversarial Networks. We can change the way how we detect whether real and fake data look the same. This leads to wGAN (Wasserstein GAN), kernel-inspired GANs and lots of other settings, or we could change how closely we look at the objects. E.g. fake images might look real at the texture level but not so at the larger level, or vice versa.

Many of the applications are in the context of images. Since this takes too much time to solve in a Jupyter notebook on a laptop, we’re going to content ourselves with fitting a much simpler distribution. We will illustrate what happens if we use GANs to build the world’s most inefficient estimator of parameters for a Gaussian. Let’s get started.

In [1]:

from __future__ import print_function
import matplotlib as mpl
from matplotlib import pyplot as plt

import mxnet as mx
from mxnet import gluon
from mxnet import ndarray as nd
from mxnet.gluon import nn
import numpy as np

ctx = mx.cpu()

## Generate some ‘real’ data¶

Since this is going to be the world’s lamest example, we simply generate data drawn from a Gaussian. And let’s also set a context where we’ll do most of the computation.

In [2]:

X = nd.random_normal(shape=(1000, 2))
A = nd.array([[1, 2], [-0.1, 0.5]])
b = nd.array([1, 2])
X = nd.dot(X,A) + b
Y = nd.ones(shape=(1000,1))

# and stick them into an iterator
batch_size = 4
train_data = mx.io.NDArrayIter(X, Y, batch_size, shuffle=True)

Let’s see what we got. This should be a Gaussian shifted in some rather arbitrary way with mean $$b$$ and covariance matrix $$A^\top A$$.

In [3]:

plt.scatter(X[:, 0].asnumpy(),X[:,1].asnumpy())
plt.show()
print("The covariance matrix is")
print(nd.dot(A, A.T))

The covariance matrix is

[[ 5.          0.89999998]
[ 0.89999998  0.25999999]]
<NDArray 2x2 @cpu(0)>

## Defining the networks¶

Next we need to define how to fake data. Our generator network will be the simplest network possible - a single layer linear model. This is since we’ll be driving that linear network with a Gaussian data generator. Hence, it literally only needs to learn the parameters to fake things perfectly. For the discriminator we will be a bit more discriminating: we will use an MLP with 3 layers to make things a bit more interesting.

The cool thing here is that we have two different networks, each of them with their own gradients, optimizers, losses, etc. that we can optimize as we please.

In [4]:

# build the generator
netG = nn.Sequential()
with netG.name_scope():

# build the discriminator (with 5 and 3 hidden units respectively)
netD = nn.Sequential()
with netD.name_scope():

# loss
loss = gluon.loss.SoftmaxCrossEntropyLoss()

# initialize the generator and the discriminator
netG.initialize(mx.init.Normal(0.02), ctx=ctx)
netD.initialize(mx.init.Normal(0.02), ctx=ctx)

# trainer for the generator and the discriminator
trainerG = gluon.Trainer(netG.collect_params(), 'adam', {'learning_rate': 0.01})
trainerD = gluon.Trainer(netD.collect_params(), 'adam', {'learning_rate': 0.05})

## Setting up the training loop¶

We are going to iterate over the data a few times. To make life simpler we need a few variables

In [5]:

real_label = mx.nd.ones((batch_size,), ctx=ctx)
fake_label = mx.nd.zeros((batch_size,), ctx=ctx)
metric = mx.metric.Accuracy()

# set up logging
from datetime import datetime
import os
import time

## Training loop¶

In [6]:

stamp =  datetime.now().strftime('%Y_%m_%d-%H_%M')
for epoch in range(10):
tic = time.time()
btic = time.time()
train_data.reset()
for iter, batch in enumerate(train_data):
############################
# (1) Update D network: maximize log(D(x)) + log(1 - D(G(z)))
###########################
# train with real_t
data = batch.data[0].as_in_context(ctx)
noise = mx.nd.random_normal(shape=(batch_size, 2), ctx=ctx)

real_output = netD(data)
errD_real = loss(real_output, real_label)

fake = netG(noise)
fake_output = netD(fake.detach())
errD_fake = loss(fake_output, fake_label)
errD = errD_real + errD_fake
errD.backward()

trainerD.step(batch_size)
metric.update([real_label,], [real_output,])
metric.update([fake_label,], [fake_output,])

############################
# (2) Update G network: maximize log(D(G(z)))
###########################
output = netD(fake)
errG = loss(output, real_label)
errG.backward()

trainerG.step(batch_size)

name, acc = metric.get()
# logging.info('speed: {} samples/s'.format(opt.batch_size / (time.time() - btic)))
# print('discriminator loss = %f, generator loss = %f, binary training acc = %f at iter %d epoch %d' %(mx.nd.mean(errD).asscalar(), mx.nd.mean(errG).asscalar(), acc, iter, epoch))

iter = iter + 1
btic = time.time()

name, acc = metric.get()
metric.reset()
print('\nbinary training acc at epoch %d: %s=%f' % (epoch, name, acc))
print('time: %f' % (time.time() - tic))
noise = mx.nd.random_normal(shape=(100, 2), ctx=ctx)
fake = netG(noise)
plt.scatter(X[:, 0].asnumpy(),X[:,1].asnumpy())
plt.scatter(fake[:,0].asnumpy(),fake[:,1].asnumpy())
plt.show()

binary training acc at epoch 0: accuracy=0.757500
time: 1.485327

binary training acc at epoch 1: accuracy=0.642000
time: 1.451298

binary training acc at epoch 2: accuracy=0.553000
time: 1.649901

binary training acc at epoch 3: accuracy=0.534500
time: 1.585956

binary training acc at epoch 4: accuracy=0.503000
time: 1.499186

binary training acc at epoch 5: accuracy=0.510500
time: 1.433464

binary training acc at epoch 6: accuracy=0.508000
time: 1.429878

binary training acc at epoch 7: accuracy=0.491500
time: 1.523295

binary training acc at epoch 8: accuracy=0.501500
time: 1.444997

binary training acc at epoch 9: accuracy=0.503000
time: 1.445146

## Checking the outcome¶

Let’s now generate some fake data and check whether it looks real.

In [7]:

noise = mx.nd.random_normal(shape=(100, 2), ctx=ctx)
fake = netG(noise)

plt.scatter(X[:, 0].asnumpy(),X[:,1].asnumpy())
plt.scatter(fake[:,0].asnumpy(),fake[:,1].asnumpy())
plt.show()

## Conclusion¶

A word of caution here - to get this to converge properly, we needed to adjust the learning rates very carefully. And for Gaussians, the result is rather mediocre - a simple mean and covariance estimator would have worked much better. However, whenever we don’t have a really good idea of what the distribution should be, this is a very good way of faking it to the best of our abilities. Note that a lot depends on the power of the discriminating network. If it is weak, the fake can be very different from the truth. E.g. in our case it had trouble picking up anything along the axis of reduced variance.

In summary, this isn’t exactly easy to set and forget. For instance, check out Soumith Chintala’s handy list of tricks for how to babysit GANs.

For whinges or inquiries, open an issue on GitHub.


text:
# How to take the determinant of a rank(1,1) tensor?

I want to find the Jacobian matrix and its determinant of the generic infinitesimal transformation:

$$x'^\mu=x^\mu+\epsilon_\alpha\frac{\delta x^\mu}{\delta \epsilon_\alpha}$$ where $$\epsilon_\alpha$$ is small and might be dependant on $$x$$.

I think the Jacobian matrix is

$$\partial_\nu x'^\mu=\delta^\mu_\nu+\frac{\delta x^\mu}{\delta \epsilon_\alpha}\partial_\nu\epsilon_\alpha+\epsilon_\alpha\partial_\nu\frac{\delta x^\mu}{\delta \epsilon_\alpha}$$ where $$\partial_\nu=\frac{\partial}{\partial x^\nu}$$

where I suspect the last term to be zero since $$\partial_\nu\frac{\delta x^\mu}{\delta \epsilon_\alpha}=\frac{\delta \partial_\nu x^\mu}{\delta \epsilon_\alpha}=\frac{\delta \delta^\mu_\nu}{\delta \epsilon_\alpha}=0$$ in other words I suspect the derivative to commute with the functional derivative. So we get:

$$\partial_\nu x'^\mu=\delta^\mu_\nu+\frac{\delta x^\mu}{\delta \epsilon_\alpha}\partial_\nu\epsilon_\alpha$$.

Now I want to know the determinant of this expression but am not totally sure how to go about getting this properly.

The reason that I want this is to derive a general expression for the conserved current that I had previously not encountered:

$$j_\alpha^\mu=\Big[\frac{\partial \mathcal{L}}{\partial(\partial_\mu \Phi)}\partial_\nu \Phi-\delta^\mu_\nu\mathcal{L}\Big]\frac{\delta x^\nu}{\delta \epsilon_\alpha}-\frac{\partial \mathcal{L}}{\partial(\partial_\mu \Phi)}\frac{\delta F}{\delta \epsilon_\alpha}$$ where $$F=\Phi'(x')$$

This is encountered in the lecture notes of Joshua D. Qualls called "Lectures on Conformal Field Theory". The expression is given on p.35. There is an exercise on p.162 that is supposed to guide you through the derivation.