text:
# remove_lytaf_events_from_timeseries¶

sunpy.instr.lyra.remove_lytaf_events_from_timeseries(ts, artifacts=None, return_artifacts=False, lytaf_path=None, force_use_local_lytaf=False)[source] [edit on github]

Removes periods of LYRA artifacts defined in LYTAF from a TimeSeries.

Parameters: ts (sunpy.timeseries.TimeSeries) – artifacts (list of strings) – Sets the artifact types to be removed. For a list of artifact types see reference [1]. For example, if a user wants to remove only large angle rotations, listed at reference [1] as LAR, set artifacts=[“LAR”]. The default is that no artifacts will be removed. return_artifacts (bool) – Set to True to return a numpy.recarray containing the start time, end time and type of all artifacts removed. Default=False lytaf_path (str) – directory path where the LYRA annotation files are stored. force_use_local_lytaf (bool) – Ensures current local version of lytaf files are not replaced by up-to-date online versions even if current local lytaf files do not cover entire input time range etc. Default=False ts_new (sunpy.timeseries.TimeSeries) – copy of input TimeSeries with periods corresponding to artifacts removed. artifact_status (dict) – List of 4 variables containing information on what artifacts were found, removed, etc. from the time series. | artifact_status[“lytaf”] : numpy.recarray | The full LYRA annotation file for the time series time range | output by get_lytaf_events(). | artifact_status[“removed”] : numpy.recarray | Artifacts which were found and removed from from time series. | artifact_status[“not_removed”] : numpy.recarray | Artifacts which were found but not removed as they were not | included when user defined artifacts kwarg. | artifact_status[“not_found”] : list of strings | Artifacts listed to be removed by user when defining | artifacts kwarg which were not found in time series time range.

Notes

This function is intended to take TimeSeries objects as input, but the deprecated LightCurve is still supported here.

References

Examples

Remove LARs (Large Angle Rotations) from TimeSeries for 4-Dec-2014:

>>> import sunpy.timeseries as ts
>>> import sunpy.data.sample
>>> from sunpy.instr.lyra import remove_lytaf_events_from_timeseries
>>> lyrats = ts.TimeSeries(sunpy.data.sample.LYRA_LEVEL3_TIMESERIES, source='LYRA')
>>> ts_nolars = remove_lytaf_events_from_timeseries(lyrats, artifacts=["LAR"])

To also retrieve information on the artifacts during that day:
>>> ts_nolars, artifact_status = remove_lytaf_events_from_timeseries(
...        lyrats, artifacts=["LAR"], return_artifacts=True)


text:
# Final exam for Fall 2016

Submit your solutions on bitbucket in a repository named csci431-final or similar. Create a folder for each question. Answers are due by Thur Dec 15, 11:59pm. You may only look at these course notes, any linked page, and standard documentation for ProbLog and Weka. The exam is out of 100 points (but weighted 20% of your overall grade).

## Question 1: ProbLog (20 pts)

Code the following problem and perform queries to evaluate the question stated at the end. Use evidence() and query() in ProbLog as appropriate.

My car won’t start. It doesn’t seem to crank when I turn the key. It’s my understanding that starting a car works as follows. If the battery is good and the alternator works, the battery will have sufficient voltage (always). But if the battery is good but the alternator is not ok, there is a 60% chance the battery has sufficient voltage. The spark plugs will spark (always) if the battery has sufficient voltage and the spark plugs are ok. The starter system will cause the car to crank if there is sufficient voltage. Cranking plus sparks plus a working fuel system will almost always (90% of the time) cause the car to start. The other 10% of the time accounts for all the other possible causes that aren’t elucidated here. Additionally, sufficient battery voltage plus good headlight bulbs will cause the headlights to turn on, but they don’t in fact. I’m 80% confident the headlight bulbs are working, 90% confident the battery is ok since it’s only a couple months old, and entirely unsure about the alternator, fuel system, and spark plugs (i.e., 50% sure that each are in working order). The question is, is the battery bad or the spark plugs?

You should arrive at the following conclusions:

   battery_ok:  0.74463739
sparkplugs_ok:  0.45863126

## Question 2: Classification evaluation (5 pts)

### Part 1: Manual calculations (3/5 pts)

Given the following “ground truth” and predicted values, calculate precision, recall, and F-score, and write the confusion matrix. The values are given in the same order, e.g., case 1, case 2, …, case n.

Groundtruth: [negative, negative, positive, negative, positive, positive, negative]
Predicted:   [negative, positive, positive, negative, positive, positive, positive]

### Part 2: Weka (2/5 pts)

Refer to the Weka output below (on the Iris dataset) to answer the following questions:

• Which Iris species is the most “confused” by this classifier? Also, when the classifier misclassifies that species, which species does it usually misclassify it as?
• What does it mean to say the classifier has perfect precision and recall on Iris-setosa, as shown in the output? Don’t tell us the numbers; we can see they are 1.0 for precision and recall. Instead, describe what we should expect from the classifier, with respect to Iris-setosa, when we give it new flower measurements.
=== Summary ===

Correctly Classified Instances         137               91.3333 %
Incorrectly Classified Instances        13                8.6667 %
Kappa statistic                          0.87
Mean absolute error                      0.1642
Root mean squared error                  0.2331
Relative absolute error                 36.9555 %
Root relative squared error             49.4534 %
Total Number of Instances              150

=== Detailed Accuracy By Class ===

TP Rate  FP Rate  Precision  Recall   F-Measure  MCC      ROC Area  PRC Area  Class
1.000    0.000    1.000      1.000    1.000      1.000    1.000     1.000     Iris-setosa
0.960    0.110    0.814      0.960    0.881      0.820    0.980     0.956     Iris-versicolor
0.780    0.020    0.951      0.780    0.857      0.804    0.981     0.963     Iris-virginica
Weighted Avg.    0.913    0.043    0.922      0.913    0.913      0.875    0.987     0.973

=== Confusion Matrix ===

a  b  c   <-- classified as
50  0  0 |  a = Iris-setosa
0 48  2 |  b = Iris-versicolor
0 11 39 |  c = Iris-virginica

## Question 3: Feature engineering (20 pts)

### Part 1: Data cleanup (15/20 pts)

Grab the Orlando Crime Data. Produce a Weka ARFF file that is appropriate for predicting the Case Offense Category (Assault, Theft, Robbery, etc.) based on the hour of the day (0-23), street name (choose first street name if the crime took place at an intersection), latitude, longitude (separated from latitude), and location type (Residence/Single, Bar/Nightclub, etc.). Use appropriate data types in Weka (nominal, numeric, etc.), remove any rows that do not have the correct format or have missing data, and remove any columns/attributes that contain information that shouldn’t be exposed to the classifier or are otherwise irrelevant.

Also report the steps that you took in your clean up process, or submit code that performs the operations.

### Part 2: Information gain (5/20 pts)

Take the Iris dataset as an ARFF file and determine the top two most “useful” attributes in terms of information gain. Specify which attribute has highest information gain and which has second-highest.

## Question 4: K-nearest neighbor (10 pts)

Take the Iris dataset as an ARFF file and determine the best value of K (i.e., number of neighbors) for predicting iris species. Do not enable distance weighting. (Note, some different values of K yield the same highest accuracy; just give one such value.)

## Question 5: Decision trees (10 pts)

Take the mammographic masses dataset (as a CSV file) and load into Weka. Remove the “birad” column since the description of the dataset says it’s non-predictive. Next change “shape,” “margin,” and “severity” to nominals, as the description states.

Using Weka, “learn” a decision tree that has fewer than 10 leaves (“leaves” as reported by Weka). Report the classifier’s accuracy after 10-fold cross validation. Then describe this tree in English sentences so a non-expert can follow the logic and arrive at a conclusion.

## Question 6: Naïve Bayesian classification (15 pts)

### Part 1: Manual calculations (10/15 pts)

Referring back to the Bayesian inference notes, show all the math for computing the answer to the following scenario. Write the formula you are calculating above each calculation. Make up your own numbers for prior and conditional probabilities.

Suppose your friend attends Big State School and aced her computer science class. You can imagine two possible reasons for this: your friend either studied very hard and/or the class was very easy. If you are forced to choose only one of those options as the explanation, which option is more plausible?

### Part 2: Weka (5/15 pts)

Take the Iris dataset as an ARFF file and train a Naïve Bayes classifier. Copy-paste all Weka output for 10-fold cross validation.

## Question 7: Text processing (15 pts)

Take this Yelp review dataset (from UCI again) and process the first attribute containing restaurant review comments. (Note, the second column is 1 or 0 depending on whether the review is positive or negative.) (Also note, some reviews have offensive language.)

Transform the first attribute into distinct words. Keep the top 1000 words, lowercase all words, and stem all words. The resulting columns should contain word counts, not just binary values. Use normal English tokenization rules (or change the tokenization rules if you wish). Make sure the class column (Score) is the last attribute after processing. Submit the resulting ARFF file.

## Question 8: Multilayer perceptrons (5 pts)

Take the Iris dataset as an ARFF file and train an MLP with two hidden layers: first with 10 neurons, second with 5 neurons. Weka will decide the size of the inputs as well as the final output layer. Use a learning rate of 0.1 and 200 epochs. Copy-paste all Weka output for 10-fold cross validation.

CSCI 431 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.

format: plain


text:
1. ## Re:

Originally Posted by jeph
so would 4cos^2(theta) + 2cos(theta) -2 be equal to 4cos(theta)cos(theta) + 2cos(theta) -2? 0.o

oh i didnt see there was a second page. we learned polar coordinates in trig and now we are doing things with it in calc 2. i think its the differentiating thats getting me right now. i forget these things way too quickly after not doing it for a while...
Hi Jeph! Hope you are doing OK.

No

4cos^2(theta) + 2cos(theta) -2 does not yield 4cos(theta)cos(theta) + 2cos(theta) -2

2. oh! i wasnt trying to differentiate that equation

it started out as r=2+2cos(theta)
then i did y=rsin(theta)
dy/d(theta)=2cos(theta) + 2 cos^2(theta) - 2sin^2(theta) simplified down to
4cos^2(theta) + 2cos(theta) -2

so dy/dx = slope. i have to replace the thetas in 4cos^2(theta) + 2cos(theta) -2 with pi/2. but i dont know how to calculate 4cos^2(theta)......

3. Originally Posted by jeph
oh! i wasnt trying to differentiate that equation

it started out as r=2+2cos(theta)
then i did y=rsin(theta)
dy/d(theta)=2cos(theta) + 2 cos^2(theta) - 2sin^2(theta) simplified down to
4cos^2(theta) + 2cos(theta) -2

so dy/dx = slope. i have to replace the thetas in 4cos^2(theta) + 2cos(theta) -2 with pi/2. but i dont know how to calculate 4cos^2(theta)......
Ok, so this approach is incorrect. i did the question a few posts up, refer to it to see the correct approach to this problem.

but anyway, to answer your question, you would calculate 4cos^2(theta) as 4(cos(theta))^2

so 4cos^2(theta)
= 4(cos(theta))^2

at theta = pi/2, we get

= 4(cos(pi/2))^2
= 4 (0)^2
= 0

so anyway, not that this is the right problem but dy/d(theta) = 4cos^2(theta) + 2cos(theta) -2 at theta = pi/2:

dy/d(theta) = 4cos^2(pi/2) + 2cos(pi/2) -2 = 0 + 0 - 2 = -2

which is not the answer you're looking for. i believe you said the answer was 1. you want to find dy/dx not dy/d(theta)

4. oh! so you do cos(theta) first then square it...><

yeah i know. dy was only the top part. dx on the bottom equals -2 also so -2/-2=1

thank you!!

5. Originally Posted by jeph
oh! so you do cos(theta) first then square it...><

yeah i know. dy was only the top part. dx on the bottom equals -2 also so -2/-2=1

thank you!!
what i'm saying is you didn't have dy/dx, you had dy/d(theta), that's two different derivatives. dy/dx is that complicated function i derived

and even if you did, it wouldn't be dy = -2, it would be dy/dx = -2 so dx could only be -2 if dy = 4

6. what? but on the answer sheet it says dx/dt is -2sin(theta) - 4cos(theta)sin(theta)... i left out the dx/dt because i just needed help understanding the dy/dt part of it.

7. Originally Posted by jeph
what? but on the answer sheet it says dx/dt is -2sin(theta) - 4cos(theta)sin(theta)... i left out the dx/dt because i just needed help understanding the dy/dt part of it.
O ok, i get what you are trying to do now.

You want to find dy/d(theta) and dx/d(theta)

then dy/dx = dy/d(theta) * d(theta)/dx ..........since the d(theta)'s would cancel.

Ok, give me a sec and i'll post the solutions using your method

i take it you want a step by step walk-through when finding dy/d(theta) ?

8. let t be theta

r = 2 + 2cost, find dy/dt when t = pi/2
now in polar coordinates:

y = rsint

x = rcost

let's find dx/dt

x = rcost
since r = 2 + 2cost
=> x = (2 + 2cost)cost
=> x = 2cost + 2cos^2(t) .........we have to use the chain rule on cos^2(t)
=> dx/dt = -2sint + 4cos(t)*(-sint)
=> dx/dt = -2sint - 4sintcost
now when t = pi/2
dx/dt = -2sin(pi/2) - 4sin(pi/2)cos(pi/2)
=> dx/dt = -2(1) - 4(1)(0)
=> dx/dt = -2 at t = pi/2

let's find dy/dt

y = rsint
since r = 2 + 2cost
=> y = (2 + 2cost)sint
=> y = 2sint + 2costsint
now we are going to find dy/dt. note that we have to find the derivative of 2costsint by using the product rule, since we have a product of two functions.

To refresh your memory, the product rule says:
if x and y are functions, then
(xy)' = x'y + xy'
that is we take the derivative of the first function times the second, plus the derivative of the second function times the first (or vice versa)

so for sintcost we have:

(sint)' = cost
(cost)' = -sint

so (sintcost)' = (sint)'cost + sint(cost)' = costcost + sint(-sint) = cos^2(t) - sin^2(t)

that was quite a side bar, let's go back to the problem

we left off at:
y = 2sint + 2costsint ..............now take the derivative
=> dy/dt = 2cost + 2(costcost - sintsint)
=> dy/dt = 2cost + 2cos^2(t) - 2sin^2(t) ..........now simplifying this any further is unnecessary, since it's not the function itself we are concerned about but it's numerical value, there's no need to waste time making this form look pretty (in case you are wondering though, your simplifications were correct)

now when t = pi/2

dy/dt = 2cos(pi/2) + 2(cos(pi/2))^2 - 2(sin(pi/2))^2
=> dy/dt = 0 + 0 - 2(1)^2
=> dy/dt = -2

now, derivative notations are more than notations, you can actually treat them like fractions. you can multiply them, cancel them out, seprate them, do whatever with them you can do with fractions. In that spirit, we will find dy/dx by the following.

dy/dx = (dy/dt)/(dx/dt) or you can say dy/dt = dy/dt * dt/dx ....same thing

dy/dt = -2
dx/dt = -2

so dy/dx = -2/-2 = 1 ............The answer

if you wanted to use dy/dt = dy/dt * dt/dx

dy/dt = -2
dt/dx = 1/-2

=> dy/dx = -2 * 1/-2 = 1

any questions? I'll have to answer them a bit later since i have class now

I have to adimit, the length of the methods are about the same, but this is easier than the method i originally proposed. my method you could do relatively quickly if you are good with implicit differentiation, but this way is much simpler--which is what math is all about, making life simple

Page 2 of 2 First 12


text:
# How To Dab Cannabis

## Getting tired of bongs and joints? It could be time to dab cannabis.

#### We note that the subject contained in this article represents illegal activity in certain jurisdictions. Whilst we do not condone any acts which are contrary to any such laws, we understand that readers in those jurisdictions which have decriminalised cannabis may find this article of interest.

If you're a veteran cannabis fan, or even if you just keep an eye on the industry from time to time, chances are you've come across dabs.

When compared with smoking joints or bowls, dabbing often doesn't even look as if it exists within the same realm. You're no longer dealing with plant matter and instead you're suddenly handling a hook and blowtorch.

It's understandable that some users might be hesitant to dive into an ingestion method which is reminiscent of Breaking Bad, but there are plenty of reasons why more people are beginning to turn to dabs for their high.

Dabbing is a form of cannabis consumption which requires cannabis concentrates, such as wax, rosin, budder, shatter, or any kind of Butane Hash Oil (BHO.)

Concentrates, as we discussed in our recent article, are typically created using a solvent, which is often either butane or CO2, mixed with freshly ground plant matter. Then, via a technique known as solvent extraction, the essential oils are stripped from the plant, and the butane is boiled off. This leaves you with a highly concentrated honey-like substance.

But why all the effort? Why not just roll a joint?

#### What Are Cannabis Dabs?

Cannabis concentrates have been around almost as long as the plant itself, namely in the form of kief and hash. And, while these concentrates were certainly more powerful than traditional flower, cannabis dabs could easily knock them out of the park in terms of potency

On January 19th, 2005, Cannabis Culture released an online article called 'Beautiful Budder,' about a man named 'Budderking' who had invented a new form of hash oil called "budder."

According to Budderking, Budder was created after a decade of trying to make liquid cannabis honey oil. Eventually, this led Budderking and his colleagues to create a product called "Glass."

"It was refined oil made with a multi-step alcohol process. Then we took it further, and it hardened into something that looked and felt like amber. We liked it because it was very strong and easier to smoke than oil," Budderking said.

Compared to other cannabis concentrates, Budder is clearly in a league of its own. Dana Larsen, the editor of Cannabis Culture believes Budder could be the strongest cannabis concentrate in the world.

"BudderKing gave me two hits at the 'Beyond Prohibition' conference in Vancouver, using his propane torch and hot knife in the parking lot on the hood of his car," Larsen recounted.

"It hit me hard…. among the very highest pot highs I've ever had. It was very clean, but I also almost felt like I was on a psychedelic."

To consume his Budder, Budderking created a device that would let users to vaporize the concentrate. The device allowed users to place their budder onto a small, heated surface and inhale the resulting vapor through a pipe.  This device, while only available for a limited time, went on to become the blueprint for the current dabbing rigs that we see on the market today.

#### Why Do People Dab Cannabis?

People dab for several reasons. One of the main motivators is curiosity, as dabbing is one of the newer and more unique method of recreationally consuming cannabis.

Although the trend is certainly on the rise, with studies showing that cannabis concentrate sales increased 145.8% over two years (October 2014–September 2016), and comprised 21% of product sales.

Curiosity aside, people are also undoubtedly drawn to dabs due to their potency.

If you're smoking a joint, THC levels will typically be between 12-25%, with 25% being some really strong stuff. Dabs, on the other hand, boast THC levels that reach upwards of 90%.

You aren't just getting stoned when you take a hit off a dabbing rig, you're going interstellar. As a result, dabs have also proven to be popular with veteran smokers who have high tolerance levels thanks to years of smoking the plant.

Lastly, you're not smoking when you dab. You're heating the dabbing nail and then placing the wax on top of it, which avoids many of the negative carcinogens and toxins involved with traditional smoking. And, given the potency of budder, wax and shatter, it's unlikely you'll be vaping that much to begin with.

Having a small, but highly potent dose of a cannabis concentrate can also be a popular option for those who use the plant for medicinal purposes. Through dabbing, you can access all the benefits of cannabinoids in an accelerated sense, while only having to inhale a small amount of vapor.

This was, after all, the reason Budderking made Budder in the first place:

"I didn't create Budder so I could make money; I created it so people could inhale pure cannabinoids," explained BudderKing.

"I see Budder as a spiritual THC high and a harm reduction method. One Budder hit gives you two joints worth of cannabinoids all at once, and it's kind to your lungs."

#### How Can I Dab Cannabis?

Dabbing may look complex, but once you've got all the parts it's really quite simple. First, you'll want to get your hands on a cannabis concentrate. If you wish to make some yourself, rosin is your best bet. All you'll need is some parchment paper, a hair straightener, and some flower or kief.

For those who wish to access a more potent high, you can use Butane Hash Oils (BHO's) such as shatter, budder or wax. These are the concentrates where you'll find the highest amounts of THC and cannabinoids.

Though whatever you do, don't try to make these at home. BHO's can be highly explosive when made incorrectly, and many people have learned that lesson the hard way. Unfortunately, you'll have to leave it to the professionals when it comes to most cannabis concentrates.

And don't stress too much about whether you dab budder or shatter, as they're virtually the same thing. The only difference between different types of BHO's is their appearance, which is made through agitating the cannabis wax in different ways. BHO's will generally have the same THC levels among them.

Okay, now all that's out of the way, let's get into it. Once you've chosen your concentrate, then you'll need to pick out a dabbing rig.

The cost of a dabbing rig can range anywhere from $50 –$400 depending on the size, quality and design you wish to purchase. Some rigs can look very much like a bong, while others resemble something from a science fair. However, at the end of the day they all do the same thing; dab.

If you're struggling to decide what model to go with, keep in mind that both Snoop Dogg and Cheech and Chong each have their own signature dabbing rigs. Did that just make your decision easier or tougher?

From there you'll need a dabbing nail—either made from quartz, titanium or ceramic—and a dabber. To make things simpler, most people opt to buy dabbing rig sets which will also include a nail and dabber, rather than buying each part separately. After you've got those, you'll need a blowtorch and a Carb Cap. We'll explain later.

Now that you've got all the ingredients, it's time to dab!

First you'll need to load a tiny amount of wax onto your dabber, so that it's easily accessed. Then, using the blowtorch, heat up your nail until it goes red. Once red, pick up the dabber and slowly lower the wax onto the nail, and inhale the resulting vapor. To avoid losing any vapor while you inhale, you can also place the Carb Cap over the nail during inhalation.

Remember, the THC levels are going to be at least 3x stronger than joints or bongs, so start at a very low dose, and make sure you're seated comfortably when you first try it.

And if you're still uncertain about dabs, it's understandable. When it comes to cannabis, dabs are still extremely new and extremely different. As Dana Larsen said, dabs are so strong, that they almost make you feel like you're on a psychedelic drug.

Not only that, but because of how recently dabbing emerged on the scene, there are very few studies on the health impacts or effects of dabs over longterm use. Unfortunately, the verdict still isn't clear on what dabbing does to our bodies.

So by all means, don't rush into the dabbing craze, and if you do, pace yourself. Otherwise, you've got plenty of alternative avenues to get your hit – from vaping, to edibles to even microdosing your cannabis.

If you do, however, wish to proceed with dabbing, put your seatbelt on and prepare for a wild ride. Well, by seatbelt we mean have some tasty snacks beside you, because you certainly won't be running any marathons after a dab hit.

### Cannabis Concentrates – Everything You Need to Know

Smoking a joint might soon be a thing of the past…thanks to cannabis concentrates. Step aside joints and bongs, there's a new kid in town. Well, several new kids. There's hash, oil, vapes, shatters and rosin. In fact, the list is growing so quickly that smoking herb may soon be a thing of the past. […]

##### Get the Latest Marijuana News & Content in your Inbox!

All your support helps The Green Fund keep writing content for all you
marijuana enthusiasts and potential pot stock investors

###### Louis O'Neill

Louis is a writer based in Sydney with a focus on social and political issues. Having interviewed local politicians and entrepreneurs, Louis now focuses on cannabis culture, legislation & reform.

## There is 1 Commentin this post

1. Thanks for posting this article we believe its important for everyone to know how to dab safely! We want to educate everyone so they have a good experience and continue to dab.


text:
CFD: First Steps

1. Jan 26, 2009

Pooven

Hi there, I'm fairly new to Computation Fluid Dynamics and the engineering concepts as a whole. I believe CFD is generally a Chemical and Mechanical Engineering interest but I thought I'd post in this sub forum. I'd like to share what little I know and learn from others.

I understand that the basic idea is to model the continuous domain into a discrete domain usually by using a grid or mesh. I'm particularly interesting in the 3D discretization where the mesh is made up of http://en.wikipedia.org/wiki/Hexahedral" (and perhaps other) geometries. So the first step is to define the geometries to be used.

I think, that the next step is to simplify the https://www.physicsforums.com/showthread.php?t=6148" on Wikipedia for brief overview. Wikipedia refers to these as discretization methods.
I also read this tutorial which suggested the conversion from a differential equation to an algebraic equation (but it was within a 1D domain): http://courses.cit.cornell.edu/fluent/cfd/intro.pdf"

There is also a http://www.cfd-online.com/Wiki/Turbulence_modeling" that helps to describe the seemingly 'random' behaviour of particles.

What I'm a bit confused about is how the equations are solved over the geometries of the mesh. Suppose I have a hexahedral celled mesh... would the equations be different from a mesh with tetrahedral cells? Is it the discretization method that adapts the equations to the chosen geometries? The equations I mention here refer to the governing mass and momentum equations for the flow.

Any suggestions or insight would be deeply appreciated.
Kind regards,
Pooven

Last edited by a moderator: Apr 24, 2017 at 10:39 AM
2. Jan 26, 2009

minger

Firstly, my adviser would frown for you calling turbulence random. Many of us prefer chaotic, but that's another story. You have the steps fairly understood. My area of background is in fully structured, finite difference codes. Structured means that essentially any grid point in the domain can be referenced by a single index for each dimension. Think of an evenly spaced cartesian grid. I can reference any point by a simple (i,j,k) pointer.

With grids like this, the discretization can be fairly easy. Whereas finite volume is an integral approach (summing fluxes in and out of an element), finite difference takes derivatives at grid points to determine the time derivatives.

In finite differencing there is an additional step between meshing and actually solving. Analysis of the Taylor series derivative approximations show that they are very unstable in two or more dimensions. To avoid the unnessesary terms, we "convert" the grid to a "perfect" evenly spaced cartesian grid. This is done by taking derivatives of the grid itself to form the Jacobian grid metrics. Once the grid is converted into what we refer to as computational space, we can start taking derivatives.

You did not mention one, and possible the most important part of the process: boundary conditions. Boundary conditions specify what happens at walls and the ends of the domain. For years, these have been a pain the ***, and just as much work goes into avoiding the use of them as does the refinment of them.

As far as solving between different mesh shapes, the answer is yes and no. In the most general case, we are solving the same equations
$$\frac{\partial \vec{Q}}{\partial t} + \frac{\partial \vec{E}}{\partial x}+\frac{\partial \vec{F}}{\partial y}+\frac{\partial \vec{G}}{\partial z} = S$$
However, what changes is, as you mentioned, the discretization methods. The methods will be difference for the different shapes. Further more, there are different stencils for each shape. In our world of finite differences, we have one-sided schemes such as:
First-Order Backwards
$$\frac{du}{dx} = \frac{u_{i+1}-u_{i}}{\Delta x}$$
Two-sided schemes such as the second-order central
$$\frac{du}{dx} = \frac{u_{i+1}-u_{i-1}}{2\Delta x}$$
Additionally there are high order DRP schemes which play with the coefficients to get high accuracy at lower grid spacing, there are compact schemes which use derivatives themselves to obtain the derivatives. It can get confusing.

Last edited by a moderator: Jan 28, 2009
3. Jan 26, 2009

Pooven

Hi minger , thank you for reply! I actually agree with your advisor about turbulence not being random. I think there are cumulative forces in nature that act together and can perfectly explain phenomena such as turbulence - I was making reference to the explanation given on the http://www.cfd-online.com/Wiki/Intr...e/Nature_of_turbulence#What_is_turbulence.3F" website.

I do remember reading about structured grids and how they are stored in memory (using a 3D array if I recall properly - but it corresponds to what you just said anyway). On that note, under the FAQ section of http://www.cfd-online.com/Wiki/General_CFD_FAQ" that unstructured meshes over a terrain (for use with air movement) has proven successful - though I'm not sure how much more successful over a structured mesh.

In the tutorial I mentioned, they did explain the use of the Tylor series in the infinite difference method - and about the truncation error. Though the extra step seems to need a good understanding of the physics. And then I'm confronted again with the question of the more appropriate method to use. Albeit I haven't read up on this enough, all I know is that Wikipedia states that the finite volume method is the standard or classical approach.

I did read about the boundary conditions - and failed to mention them because I was still unable to understand how the equations governing motion was applied to the primitive elements of the different meshes. I'm actually hoping that I can ignore the boundary conditions but it's quite possible that I don't fully understand them; in my case, if I had a 90mx90m area of land, would the boundary conditions specify what happens at the cells adjacent to the perimeter of my land? If so, can I not solve for the other cells ignoring those at the boundary (since I'm not that interested about the air movement in those cells)? In the literature I read, a boundary condition similar to the work by Richards and Hoxey (2003) was used - though I'm not sure what that means! You did mention that effort was placed in trying to avoid using boundary conditions... so can it be avoided?

So based on the geometry used, I will have fewer discretization methods that are applicable? I am at a loss with the mention of different stencils for each shapes... I've started reading 'https://www.amazon.com/exec/obidos/ASIN/0070016852/cfdonline" by John David Anderson' (recommended via the book guide on cfd-online.com), so I'll hopefully understand what you spoke about soon Is there a cheat-sheet of sorts that provides a guideline that shows which methods are applicable to which mesh geometries?

Last edited by a moderator: Apr 24, 2017 at 10:39 AM
4. Jan 26, 2009

minger

OK, let's try to answer some of these for you:

The first main advantage of unstructured meshes are the meshing process themself. Unstructured meshes are extremely easy to make, and computers are very efficient at creating them. Furthermore, they are easy to refine as well. If I have a group of triangular elements, I can refine that area by simply splitting a group of triangles into more, and adjusted the connectivity.

With structured meshes, because the gridlines extend all the way to the boundary, refining meshes can not only be a tedious process, but it also typically forces the grid refinement all the way to the boundary, which is computationally expensive. Not good.

The advantage of structured meshes, aside from easy storage is the derivative stencils themselves, with particular importance to high-order schemes. Because structured grids have grid lines which extend all the way to the boundaries, we can develop derivative schemes that employ lots of data (6th-order DRP scheme is an 11-point stencil!). This gives the derivative schemes high order of accuracy. DO NOT confuse order of accuracy with accuracy. The order of a scheme dictates how the numerical solution approaches the actual solution as the grid becomes more fine.

In my area of aero-acoustics, we are trying to resolve waves that are orders of magnitude smaller than the mean flow. That means we need great accuracy. Let's examine two schemes to look at number of grid points vs accuracy.

A first-order backwards scheme obviously has an order of 1. This means that if I double the grid, the error decreases by a factor of:
$$\Delta\epsilon = 2^n = 2^1 = 2$$
However, a sixth order scheme is:
$$\Delta\epsilon = 2^n = 2^6 = 32$$
We see that the the high-order scheme approaches the actual solution 16 times faster than the first-order scheme. At this point it's important to say that the low order scheme might perform better than the high order scheme with a coarse grid. However, if one wants a certain small accuracy, then using a high-order scheme will produce better results with lower number of grid points. Using low-order schemes is possible to get CAA results, but typically the amount of grid needed to resolve high gradient areas is staggering.

You are correct about the boundary conditions. However, no matter how far away you place them, any numerical run is finite and needs them. The boundary conditions essentially try to replicate the real world. You want the code to think that they're not there. However, they can cause all sorts of problems.

Some of the first types of boundary conditions are the Thompson-style BCs. They are whats called characteristic style. They specifiy the characteristic waves as they leave the domain. A common implementation is to specifiy a constant stagnation pressure. Think of a wave leaving the domain. In order to maintain a constant stagnation pressure at the outlet, the BC will send an incoming wave back into the domain in order to maintain this pressure.

The problem is that you now have reflecting waves bouncing all over the place and its hard to determine what is real, and whats not. Some of the first attempts to get around this was grid stretching. Essentially if you dig a little deeper into derivative stencils, you'll see that the dissipation of schemes is related to the grid spacing. If I stretch the grid, the grid is no longer able to resolve the propagating waves, and the wave will "die". If these waves are "dead" before they get to the boundary, then the BC has no work to do; the BC can't screw anything up.

You have a good start with Anderson; anything that he writes is worth reading. There is no "cheat-sheet" of sorts, and many people in the craft will say that CFD even now is quite the "gray" art. Two different CFD'ers can get quite different results. If you're using commercial software, then my strategy is just to try and get brick elements, otherwise just let it do what it wants, you typically can't tell it what to do anyways, nor do you know how its solving.

So hopefully some of this helps.

5. Jan 29, 2009

Pooven

Hi again minger. Thank you for explaining some of the advantages and disadvantages of the two methods... I'm not sure how to phrase this, but I'd assume that the mesh representing the object should as close as possible of a match to the geometry of the object; that is, for my situation (where a digital elevation model is used), the larger the gap between the generated mesh and the actual topography of the land, the less accurate the results might be? Though I suppose this too could be negligible considering the many other factors influence the flow of air over land (such as terrain cover - grass, forest, etc) and such properties will not be accurately represented.
I suppose what I really asking is, how important is grid refinement? I hope I'm not misunderstand grid refinement > I think it's the process of making the grid match the geometry with greater precision? In industrial processes, I suppose grid refinement is very important especially since the flow, say through a tube, is controlled (since it's free from the effects of say ambient wind).
I suppose we should always aim for a complete as possible system and so I think in my situation where there are complex geometries, an unstructured mesh would be better suited not only because it's easier to implement but because it's easier to refine?

I was reading up on stencils - http://en.wikipedia.org/wiki/Five-point_stencil")? And as you said, different shapes have different stencils, which now makes sense A quick question, do all discretization methods use stencils?

Was was going to ask if higher order is in reference to the truncation of the Taylor series? I suppose in a way; I read, 'High-Order Compact (HOC) Schemes, in the context of my research, are numerical approximations which achieve high-order accuracy on a http://www.cisl.ucar.edu/css/staff/spotz/research/hoc.html#compact"
This concept is still a bit abstract to me since I haven't done any applications... is the order of accuracy directly related to which term the http://en.wikipedia.org/wiki/Taylor_series" truncation occurred? And this is different from a higher-order scheme? I think I should read more before I ask these question so let's put that on hold.

As for the boundary conditions, in the Dr. Anderson's book it reads, 'Finally, the physical boundary conditions and their appropriate mathematical statements will be developed. The governing equations must be solved subject to these boundary conditions.' - Ch2. Not that I was doubting you, just reaffirming what you said. Thank you for the example, that added much clarity... the events that occur at the boundary could impact the overall fluid flow and this can't be ignored anyway.

I find that this discussion has been quite useful; especially with my overall understand of the subject matter - as I am just a beginner. So I'm very grateful to you minger! Thank you ever so much :D

Last edited by a moderator: Apr 24, 2017 at 10:44 AM
6. Feb 19, 2009

Pooven

Salome

I'm trying to generate a mesh over my terrain but I'm not sure if my approach is correct. I'm using Salome and I've failed to find any tutorials online... If anyone knows of such tutorials, please let me know. I did find this one: http://www.caelinux.org/wiki/index.php/Doc:CAETutorials
Which was really cool since I want to use the mesh in OpenFOAM. My problem arises because of the specific nature of the tutorial.

I basically want to generate a mesh (of some fixed height) over a digital elevation model (DEM). The DEM is made up of a matrix of points (in essence) and so to test my ability to simulate fluid (in my case air), I fabricated points for the DEM. Here's what I've done in Salome:
Once I had a grid of points (on the floor of the DEM and parallel above the floor to form a 'roof') I used the New Entity > Blocks > Quadrangle Face option to join four adjacent points together to form tiles until eventually I had a closed object.

I used the Boolean > Fuse option to combine the quadrangle shapes together (which took allot of effort since you can only fuse two objects together at a time?) and finally the New Entity > Group > Create option to define walls.

Am I going about this the wrong way? When I try to compute the mesh I end up with an error
I'm hoping there's some with experience in Salome (I'm using 4.1.4) that has some suggestions/hints for me? Hmmm, I wonder if I should start this as a new topic

Last edited: Feb 19, 2009
7. Feb 19, 2009

minger

Yes

There should be no gap 'ideally' between your mesh and physical model. When considering terrain, I would assume that the cover is part of the boundary conditions. When we model something such as pipe flow, there is inherent roughness in the pipes. Of course we can't actually model that roughness, our grid spacing would be thousandths of an inch. So, we model some nominal diameter of the pipe and then the pipe roughness gets factored into the boundary conditions.

Grid refinment is very important. Remember that you will end with a discrete set of data. That means that you don't really know what's happening between grid points. So, if something is change a lot in an area with little gridpoints, then you aren't "resolving" what's there. Imagine trying to draw a sine wave with only three points. Imagine how it would look.

Discretization is simply the process by which a continuous distribution of data is converted into a finite set of data. Because there won't be a closed form of the Navier-Stokes equations, we need to discretize in order to "solve" the equations.

Your are correct. Using the Taylor series derived stencils, if we use more data (i.e. more grid points) we can knock more and more terms out. When we write the derivatives, there are actually an infinte number of terms in the equation. If I take two grid points (at i-1, and i+1), and subtract them from each other, and divide by the spacing, I end up with
$$\frac{u_{i+1}-u_{i-1}}{2\Delta x} = \left.\frac{du}{dx}\right\vert_i + .....$$
Now, it happens that this stencil is second order accurate. This means that the first term that shows up besides the derivative that we're looking for the second order term. The general form of the "next" term looks like:
$$\frac{\Delta x^n}{n!}\frac{d^n u}{dx^n}$$
Where n is the order. We then try and say that "hopefully" this term is small enough compared to the derivative that we can ignore it. By adding more data, we can algebraically eliminate these terms.

Could and almost always certainly will.

edit: Also, I'm sorry but I'm really not familiar with the meshing package that you're using. I can't really help you with that.

Last edited by a moderator: Apr 24, 2017 at 11:17 AM
8. Feb 25, 2009

Pooven

Thank you so very much for answering my questions minger! I truly understand the content so much more because of you. I especially like the way you explain things :)

Do you (or anyone else) have any Open Source recommendation to meshing solutions? I'm going to use the mesh tool provided with OpenFOAM but I'd really like to compare the results with another meshing tool.

9. Feb 25, 2009

minger

I'm not familiar with any other opensource meshing packages. When all else fails, try to do it yourself. You said that you have a "elevation" map. As a first cut, if these points were taken in a grid, try just connecting the grid into a structured grid. So, for example, lets say you have an array that is (n²,3) long: points(n²,3), so basically the person took n points, took a step over, then repeated n times, with the second indice representing x,y,z. You can do something like this:
Code (Text):

DO i=1,n
DO j=1,n
ii = ii + 1
x(i,j,1) = points(ii,1)
y(i,j,1) = points(ii,2)
z(i,j,1) = points(ii,3)
END DO
END DO

!--"Fill" in the rest of the x,y locations
!--You now have your surface grid points
vPoints = 10      !--vertical points
vMax    = 100.0  !--ceiling

DO k=1,vPoints
x(:,:,k) = x(1,1,k)
y(:,:,k) = y(1,1,k)
z(:,:,k) = z(1,1,k)
END DO

!--evenly space grid points above surface points
counter = 0.0
DO i=1,n
DO j=1,n
int = (vMax - z(i,j,1)) / vPoints
DO k=1,vPoints
counter = counter + int
z(i,j,k) = counter
END DO
counter = 0
END DO
END DO


text:
# What is the formula for this numerical series?

I'm developing a questions game. My goal is that the score for each correct answer will increase as the user answers more questions. Initially there are 15 points for each correct answer. Every 4 questions adds 2 points to the previous value. In terms of numerical series would be something like:

15 15 15 15 17 17 17 17 19 19 19 19 21 21 21 21.

I trying to find the formula for this numerical serie but I have not had success. If anyone sees in this numerical series a "challenge" and wants to help me find the formula I will be very grateful.

-
Check FindGeneratingFunction. It is generating equation. –  Rorschach Oct 16 '13 at 18:58
Related: oeis.org/A129756 –  Michael E2 Oct 18 '13 at 1:04

If I understand correctly:

f[n_] := 13 + Ceiling[n, 4]/2;

f[Range[20]]

{15, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 19, 21, 21, 21, 21, 23, 23, 23, 23}

More general approach:

sample = {15, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 19, 21, 21, 21, 21};
linrec = FindLinearRecurrence[sample]

 {1, 0, 0, 1, -1}

f2[n_] := LinearRecurrence[linrec, sample[[1 ;; Length[linrec]]], n];
f2[20]

{15, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 19, 21, 21, 21, 21, 23, 23, 23, 23}

-

Use FindGeneratingFunction and SeriesCoefficient:

FindGeneratingFunction[
{15, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 19, 21, 21, 21, 21, 23, 23, 23, 23}, x]

(15 - 13*x^4)/((-1 + x)^2*(1 + x + x^2 + x^3))

The formula:

FullSimplify[SeriesCoefficient[%, {x, 0, n}], Element[n, Integers] && n >= 0]

(1/4)*(57 + (-1)^n + 2*n + 2*Cos[(n*Pi)/2] + 2*Sin[(n*Pi)/2])

Verification:

Table[%, {n, 0, 30}]

{15, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 19, 21, 21, 21, 21,
23, 23, 23, 23, 25, 25, 25, 25, 27, 27, 27, 27, 29, 29, 29}

-

A nice use for the outer product:

Flatten@Outer[Times, Range[15, 23, 2], {1, 1, 1, 1}]

{15, 15, 15, 15, 17, 17, 17, 17, 19, 19, 19, 19, 21, 21, 21, 21, 23, 23, 23, 23}

-


text:
Lesson 12

Solve Problems

Warm-up: Estimation Exploration: Large Denominators (10 minutes)

Narrative

The purpose of this estimation exploration is for students to reason about the size of a complex fraction sum with large denominators. Students can see that 1 is a good estimate because one fraction is small and the other is close to 1. In the synthesis they refine this estimate to explain why the value of the sum is a little larger than 1.

Launch

• Groups of 2
• Display the expression.
• “What is an estimate that’s too high?” “Too low?” “About right?”
• 1 minute: quiet think time

Activity

• 1 minute: partner discussion
• Record responses.

Student Facing

What is the value of the sum?

$$\frac{3}{17}+\frac{17}{19}$$

Record an estimate that is:

too low about right too high
$$\phantom{\hspace{2.5cm} \\ \hspace{2.5cm}}$$ $$\phantom{\hspace{2.5cm} \\ \hspace{2.5cm}}$$ $$\phantom{\hspace{2.5cm} \\ \hspace{2.5cm}}$$

Student Response

For access, consult one of our IM Certified Partners.

Activity Synthesis

• “How do you know that the sum is greater than 1?” ($$\frac{17}{19}$$ is $$\frac{2}{19}$$ short of a whole. Since 17ths are bigger than 19ths, adding $$\frac{3}{17}$$ makes it greater than 1.)

Activity 1: Priya’s Salad Dressing (20 minutes)

Narrative

The purpose of this activity is for students to add and subtract fractions and estimate sums and differences of fractions using the context of a recipe. Students may have different responses and reasoning for the estimation questions. In both cases, they can calculate and compare fractions but they may have different thoughts about how these differences would affect the recipe or what exactly it means for the recipe to make “about $$1\frac{1}{2}$$ cups.” In the synthesis, students discuss the reasonableness of the estimates and how to make precise calculations (MP6). When students relate their calculations to Priya's salad dressing they reason abstractly and quantitatively (MP2).

Reading: MLR6 Three Reads. Keep books or devices closed. Display only the problem stem, without revealing the questions. “We are going to read this question 3 times.” After the 1st Read: “Tell your partner what this situation is about.” After the 2nd Read: “List the quantities. What can be counted or measured?” Reveal the question(s). After the 3rd Read: “What strategies can we use to solve this problem?”

Launch

• Groups of 2
• “What kind of ingredients do you like to put in your salad?” (lettuce, cabbage, beans, seeds, beets, tomatoes, cheese)

Activity

• 1–2 minutes: quiet think time
• 6–8 minutes: small-group work time
• Monitor for students who:
• estimate to determine that Priya’s recipe will make about $$1\frac{1}{2}$$ cups of dressing
• add $$\frac{3}{4} + \frac{1}{3}+\frac{1}{2}$$ to determine the precise amount of dressing Priya’s recipe will make

Student Facing

• $$\frac{3}{4}$$ cup olive oil
• $$\frac{1}{3}$$ cup lemon juice
• $$\frac{1}{2}$$ cup mustard
• Pinch of salt and pepper

1. Priya has $$\frac{2}{3}$$ cup of olive oil. She is going to borrow some more from her neighbor. How much olive oil does she need to borrow to have enough to make the dressing?

2. 1 tablespoon is equal to $$\frac{1}{16}$$ of a cup. Priya decides that 1 tablespoon of olive oil is close enough to what she needs to borrow from her neighbor. Do you agree with Priya? Explain or show your reasoning.

3. Priya says her recipe will make about $$1\frac{1}{2}$$ cups of dressing. Do you agree? Explain or show your reasoning.

Student Response

For access, consult one of our IM Certified Partners.

Activity Synthesis

• “If Priya borrows a tablespoon of olive oil from her neighbor and uses it to make dressing, will she be putting in more or less olive oil than the recipe calls for?” ($$\frac{1}{16}$$ is smaller than $$\frac{1}{12}$$ so she will be putting in less olive oil.)
• “Do you think 1 tablespoon is close enough?”
• Poll the class.
• “How might Priya’s decision to use 1 tablespoon of olive oil change the salad dressing?” (It won’t make a difference because the difference is so small. It might taste more lemony or more mustardy because there is not as much oil. It might affect the consistency of the dressing a little.)
• Ask previously selected students to share their estimates for the amount of salad dressing in the given order.
• “Why might Priya estimate that the recipe makes $$1\frac{1}{2}$$ cups of salad dressing?” ($$\frac{3}{4}$$ is $$\frac{1}{4}$$ away from 1 and $$\frac{1}{3}$$ is close to $$\frac{1}{4}$$.)
• “Does the recipe make more or less than $$1\frac{1}{2}$$ cups? How do you know?” (More because $$\frac{1}{3}$$ is more than $$\frac{1}{4}$$.)
• “How many cups does Priya’s recipe make? How do you know?” ($$1\frac{7}{12}$$, I added $$\frac{1}{3}$$, $$\frac{3}{4}$$, and $$\frac{1}{2}$$.)

Activity 2: More Problems to Solve (15 minutes)

Narrative

The purpose of this activity is for students to solve multi-step problems involving the addition and subtraction of fractions with unlike denominators. Students work with both fractions and mixed numbers and can use strategies they have learned such as adding on to make a whole number. When students connect the quantities in the story problem to an equation, they reason abstractly and quantitatively (MP2).

Representation: Access for Perception. Read both problems aloud. Students who both listen to and read the information will benefit from extra processing time.
Supports accessibility for: Conceptual Processing, Language

Launch

• Groups of 2
• “You and your partner will each choose a different problem to solve and then you will discuss your solutions.”

Activity

• 3–5 minutes: independent work time
• 3–5 minutes: partner discussion

Student Facing

1. Choose a problem to solve.

Problem A:

Jada is baking protein bars for a hike. She adds $$\frac{1}{2}$$ cup of walnuts and then decides to add another $$\frac{1}{3}$$ cup. How many cups of walnuts has she added altogether?

If the recipe requires $$1\frac{1}{3}$$ cups of walnuts, how many more cups of walnuts does Jada need to add? Explain or show your reasoning.

Problem B:

Kiran and Jada hiked $$1 \frac{1}{2}$$ miles and took a rest. Then they hiked another $$\frac{4}{10}$$ mile before stopping for lunch. How many miles have they hiked so far?

If the trail they are hiking is a total of $$2\frac{1}{2}$$ miles, how much farther do they have to hike? Explain or show your reasoning.

2. Discuss the problems and solutions with your partner. What is the same about your strategies and solutions? What is different?
3. Revise your work if necessary.

Student Response

For access, consult one of our IM Certified Partners.

Activity Synthesis

• “How were the problems the same? How were they different?” (For both problems I had to add fractions first and then subtract that total from another number. There were mixed numbers in both problems.)
• “How did you use equivalent fractions to solve these problems?” (All the fractions we worked with had different denominators so we had to find equivalent fractions with the same denominators in order to add or subtract.)

Lesson Synthesis

Lesson Synthesis

“Today we solved problems that required adding and subtracting fractions.”

“What strategy did you use to find out how much salad dressing Priya’s recipe makes?” (The denominators for the fractions are 2, 3 and 4 so I used 12 because I know that it is a multiple of 2, 3, and 4. I put the half and fourths together first since I could use 4 as a common denominator and then I used 12 to add the fourths and third.

Display: $$\frac{1}{12} - \frac{1}{16}$$

“What strategy did you use to find this difference for the olive oil?” (I knew that 48 is $$4 \times 12$$ and $$3 \times 16$$ so I used that as a common denominator. I used $$12 \times 16$$ as a common denominator.)

“How do you decide which strategy to use?” (It depends on the numbers. If I know a small common multiple of the denominators, I use that. If I don’t, I can always use the product of the denominators.)

Cool-down: Evaluate Expressions (5 minutes)

Cool-Down

For access, consult one of our IM Certified Partners.


text:
# A Short Proof of the Two-sidedness of Matrix Inverses

by Raymond A. Beauregard (University of Rhode Island)

Mathematics Magazine
April, 2007

Subject classification(s): Matrix Algebra | Linear Algebra | Algebra and Number Theory
Applicable Course(s): 3.8 Linear/Matrix Algebra

The paper gives a proof that for any $$n$$ x $$n$$ matrices $$A$$ and $$C$$ over a field of scalars, $$AC = I$$ if and only if $$CA = I$$.

A pdf copy of the article can be viewed by clicking below. Since the copy is a faithful reproduction of the actual journal pages, the article may not begin at the top of the first page.


text:
# The signal $\cos(2 \pi t )$ is an eigenfunction of every LTI system?

for $\sin(2 \pi t)$: Apparently that it's not an eigenfunction real-valued impulse response $h(t)$ but it's a eigenfunction for real-valued and even impulse response $h(t)$

What gives?

Here's what gives: the actual eigenfunctions are those of the form $e^{i\omega t}$. In particular, we have $$h(t)*e^{i\omega t} = \int_{-\infty}^\infty h(\tau)e^{i\omega (t-\tau)}\,d\tau = \left[\int_{-\infty}^\infty h(\tau)e^{-i\omega \tau}\,d\tau\right]e^{i\omega t} := H(\omega)e^{i\omega t}$$ It follows that $$h(t)*\cos(\omega t) = h(t) * \frac 12 \left[e^{i \omega t} + e^{-i \omega t} \right] = \frac12 \left[H(\omega)e^{i \omega t} + H(-\omega)e^{-i \omega t}\right]$$ This will be a multiple of the original function exactly when $H(\omega) = H(-\omega)$. So, as long as $H(2 \pi) = H(- 2 \pi)$, $\cos(2 \pi t)$ will be an eigenfunction.


text:
## hba Group Title Find the domain and range of the following functions: (a)y=secx one year ago one year ago

1. uri Group Title

K.

2. yaho021 Group Title

$x \neq \frac{ \Pi }{ 2 }, \frac{ 3\Pi }{ 2 }, \frac{ 5\Pi }{ 2 }, . . . . . . .$ $range : y \ge 1 and y \le -1$

3. hba Group Title

Ahm @yaho021 Domain=R-{x=n(pi/2)} Where pi=1,3,5........ Couldn't get the range thing :/

4. hba Group Title

How do we determine the range ?

5. ParthKohli Group Title

$\sec(x) = \dfrac{1}{\cos(x)}$The range of values is $$(\infty , -\infty)$$.

6. ParthKohli Group Title

I may be wrong... let's see

7. hba Group Title

Everyone is confusing me :/

8. ParthKohli Group Title

No, I meant when $$\cos(x)$$ tends to $$0$$ from the right side, then $$\sec(x)$$ goes towards $$\infty$$. And when it tends to $$0$$ from the left, then $$\sec(x)$$ goes towards $$-\infty$$.

9. ParthKohli Group Title

So the range is all real numbers.

10. hba Group Title

Okay someone said it would be All real numbers-(-1,1)

11. ParthKohli Group Title

That's the range of $$\cos(x)$$, not $$\sec(x)$$

12. ParthKohli Group Title

Think about the range of $$\dfrac{1}{x}$$. Whenever $$x$$ is near zero, $$\dfrac{1}{x}$$ is near infinity.

13. ParthKohli Group Title

$\dfrac{1}{0.0000001} = 1000000$

14. hba Group Title

@Mimi_x3 lol so true :p

15. ParthKohli Group Title

YAY! I was right! I thought I'd make a fool of myself


text:
# Suitable environment for answers to exercises

There are different packages out there to add answers to exercises to a document, like answers and exercise, however they're all a bit overkill, e.g. they re-format and re-number the list of exercises in my document.

What I want to achieve is juist this: I have a list of exercises, which are formatted in a standard enumerate-environment, and I want to put the solutions just underneath, but in the beginning of my document I want to be able to define some kind of 'flag'. If the flag is 'on', then the document should print out my lecture notes with solutions, if it's 'off', it should just skip the solutions and print out the document as if the solutions were never there (so also not leave blank space or something similar.

Ideally, something like this:

List of exercises:

\begin{enumerate}
\item 2+2
\begin{solution}
4
\end{solution}
\item 3-1
\begin{solution}
2
\end{solution}
\item 5+2
\begin{solution}
7
\end{solution}
\end{enumerate}

If the flag is off, all solutions should be downright skipped.

Is there a way to do this, preferably as simple as possible?

• Take a look at the comment package, it should suit your needs. – Alexis Nov 6 '16 at 9:28

Without an environment, simply \solution:

\documentclass{article}
\newif\ifsolution
\def\solution#1{\ifsolution #1 \else \relax\fi}

\begin{document}

\solutiontrue

\begin{enumerate}

\item 2+2

\solution{4}
\item 3-1

\solution{2}
\item 5+2

\solution{7}
\end{enumerate}

\solutionfalse

\begin{enumerate}
\item 2+2

\solution{4}
\item 3-1

\solution{2}
\item 5+2

\solution{7}
\end{enumerate}

\end{document}

• Yes, that's what I'm looking for! Thanks a lot! :) – Werner Nov 6 '16 at 14:52


text:
# Implementation of quicksort algorithm

I'm currently doing an algorithms course and implemented this version of the quicksort algorithm. I would like to know if it is an efficient implementation. I've seen a couple others where there is a partition function that partitions the list is that a superior method to what I did?

def quickSort(aList):
first = []
second = []
size = len(aList)
if size ==0:
return []
elif size == 1:
return aList
elif size ==2:
if(aList[1]<aList[0]):
return list([aList[1],aList[0]])
else:
return aList
else:
key = aList[0]
for i in range(1,size):
if aList[i]<key:
first.append(aList[i])
else:
second.append(aList[i])
first.append(key)
return quickSort(first) + quickSort(second)

You've implemented a very basic version of the Quicksort algorithm, where you choose the first element as pivot element.

The running time of the quicksort algorithm is however very dependent on the quality of the pivot element. (The pivot should try to split the problem in equal problems). Making it fixed isn't really useful.

For example: say you want to run quicksort on an already sorted list. If you keep using the first element as pivot element, you will end up with a quadratic running time.

A 'solution' is to use random pivot elements, where in each recursive call you choose the pivot randomly (each element has an equal chance). You can find more on this approach online. But the idea is to end up with an average running time of $O(n*log(n))$

In addition you implement it by creating 2 new lists and merging them together. Quicksort normally has the advantage that everything can happen in-place, which is a great advantage memory wise.

• You're right I should have thought this through a bit more thanks for the response. – imakeApps Mar 22 '15 at 11:06

a) You've implemented a basic version of partition() function in your code.

partition(Array, start, end, pivot_index)

b) partition should - switch between the given pivot Array[pivot_index] and the first element Array[start]. - then, partition should run your "append" code, only with cleverly swapping elements so that there is no need for more than a single element of extra memory.

Here is some pseudocode that includes the use of a factory that takes care of picking the right pivot once it is given information about the array.

Partition(A, l, r, pivot_factory)
"""
Array A, l Left boundary, r Right boundary
Input: A[l:r]
"""
p = pivot_factory.get_pivot(A,start,end)
i = l+1
for j=l+1 to r:
if A[j] < p:    # if A[j] > p, do nothing
swap A[j] and A[i]
i += 1
swap A[l] and A[i-1]

QuickSort(array A, length n)
If n=1 return
p = ChoosePivot(A,n)
Partition A around p
Recursively sort 1st part
Recursively sort 2nd part

Your version just gives p the first item on the array as pivot - which is expected to give mediocre results as far as runtime is concerned.


text:
Copied to
clipboard

G = C2×C3⋊D21order 252 = 22·32·7

Direct product of C2 and C3⋊D21

Aliases: C2×C3⋊D21, C6⋊D21, C421S3, C32D42, C216D6, C326D14, C14⋊(C3⋊S3), (C3×C6)⋊2D7, (C3×C42)⋊1C2, (C3×C21)⋊6C22, C72(C2×C3⋊S3), SmallGroup(252,45)

Series: Derived Chief Lower central Upper central

 Derived series C1 — C3×C21 — C2×C3⋊D21
 Chief series C1 — C7 — C21 — C3×C21 — C3⋊D21 — C2×C3⋊D21
 Lower central C3×C21 — C2×C3⋊D21
 Upper central C1 — C2

Generators and relations for C2×C3⋊D21
G = < a,b,c,d | a2=b3=c21=d2=1, ab=ba, ac=ca, ad=da, bc=cb, dbd=b-1, dcd=c-1 >

Subgroups: 552 in 60 conjugacy classes, 27 normal (9 characteristic)
C1, C2, C2, C3, C22, S3, C6, C7, C32, D6, D7, C14, C3⋊S3, C3×C6, C21, D14, C2×C3⋊S3, D21, C42, C3×C21, D42, C3⋊D21, C3×C42, C2×C3⋊D21
Quotients: C1, C2, C22, S3, D6, D7, C3⋊S3, D14, C2×C3⋊S3, D21, D42, C3⋊D21, C2×C3⋊D21

Smallest permutation representation of C2×C3⋊D21
On 126 points
Generators in S126
(1 75)(2 76)(3 77)(4 78)(5 79)(6 80)(7 81)(8 82)(9 83)(10 84)(11 64)(12 65)(13 66)(14 67)(15 68)(16 69)(17 70)(18 71)(19 72)(20 73)(21 74)(22 91)(23 92)(24 93)(25 94)(26 95)(27 96)(28 97)(29 98)(30 99)(31 100)(32 101)(33 102)(34 103)(35 104)(36 105)(37 85)(38 86)(39 87)(40 88)(41 89)(42 90)(43 123)(44 124)(45 125)(46 126)(47 106)(48 107)(49 108)(50 109)(51 110)(52 111)(53 112)(54 113)(55 114)(56 115)(57 116)(58 117)(59 118)(60 119)(61 120)(62 121)(63 122)
(1 62 33)(2 63 34)(3 43 35)(4 44 36)(5 45 37)(6 46 38)(7 47 39)(8 48 40)(9 49 41)(10 50 42)(11 51 22)(12 52 23)(13 53 24)(14 54 25)(15 55 26)(16 56 27)(17 57 28)(18 58 29)(19 59 30)(20 60 31)(21 61 32)(64 110 91)(65 111 92)(66 112 93)(67 113 94)(68 114 95)(69 115 96)(70 116 97)(71 117 98)(72 118 99)(73 119 100)(74 120 101)(75 121 102)(76 122 103)(77 123 104)(78 124 105)(79 125 85)(80 126 86)(81 106 87)(82 107 88)(83 108 89)(84 109 90)
(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21)(22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42)(43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63)(64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84)(85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105)(106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126)
(1 74)(2 73)(3 72)(4 71)(5 70)(6 69)(7 68)(8 67)(9 66)(10 65)(11 64)(12 84)(13 83)(14 82)(15 81)(16 80)(17 79)(18 78)(19 77)(20 76)(21 75)(22 110)(23 109)(24 108)(25 107)(26 106)(27 126)(28 125)(29 124)(30 123)(31 122)(32 121)(33 120)(34 119)(35 118)(36 117)(37 116)(38 115)(39 114)(40 113)(41 112)(42 111)(43 99)(44 98)(45 97)(46 96)(47 95)(48 94)(49 93)(50 92)(51 91)(52 90)(53 89)(54 88)(55 87)(56 86)(57 85)(58 105)(59 104)(60 103)(61 102)(62 101)(63 100)

G:=sub<Sym(126)| (1,75)(2,76)(3,77)(4,78)(5,79)(6,80)(7,81)(8,82)(9,83)(10,84)(11,64)(12,65)(13,66)(14,67)(15,68)(16,69)(17,70)(18,71)(19,72)(20,73)(21,74)(22,91)(23,92)(24,93)(25,94)(26,95)(27,96)(28,97)(29,98)(30,99)(31,100)(32,101)(33,102)(34,103)(35,104)(36,105)(37,85)(38,86)(39,87)(40,88)(41,89)(42,90)(43,123)(44,124)(45,125)(46,126)(47,106)(48,107)(49,108)(50,109)(51,110)(52,111)(53,112)(54,113)(55,114)(56,115)(57,116)(58,117)(59,118)(60,119)(61,120)(62,121)(63,122), (1,62,33)(2,63,34)(3,43,35)(4,44,36)(5,45,37)(6,46,38)(7,47,39)(8,48,40)(9,49,41)(10,50,42)(11,51,22)(12,52,23)(13,53,24)(14,54,25)(15,55,26)(16,56,27)(17,57,28)(18,58,29)(19,59,30)(20,60,31)(21,61,32)(64,110,91)(65,111,92)(66,112,93)(67,113,94)(68,114,95)(69,115,96)(70,116,97)(71,117,98)(72,118,99)(73,119,100)(74,120,101)(75,121,102)(76,122,103)(77,123,104)(78,124,105)(79,125,85)(80,126,86)(81,106,87)(82,107,88)(83,108,89)(84,109,90), (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)(22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42)(43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63)(64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84)(85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105)(106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126), (1,74)(2,73)(3,72)(4,71)(5,70)(6,69)(7,68)(8,67)(9,66)(10,65)(11,64)(12,84)(13,83)(14,82)(15,81)(16,80)(17,79)(18,78)(19,77)(20,76)(21,75)(22,110)(23,109)(24,108)(25,107)(26,106)(27,126)(28,125)(29,124)(30,123)(31,122)(32,121)(33,120)(34,119)(35,118)(36,117)(37,116)(38,115)(39,114)(40,113)(41,112)(42,111)(43,99)(44,98)(45,97)(46,96)(47,95)(48,94)(49,93)(50,92)(51,91)(52,90)(53,89)(54,88)(55,87)(56,86)(57,85)(58,105)(59,104)(60,103)(61,102)(62,101)(63,100)>;

G:=Group( (1,75)(2,76)(3,77)(4,78)(5,79)(6,80)(7,81)(8,82)(9,83)(10,84)(11,64)(12,65)(13,66)(14,67)(15,68)(16,69)(17,70)(18,71)(19,72)(20,73)(21,74)(22,91)(23,92)(24,93)(25,94)(26,95)(27,96)(28,97)(29,98)(30,99)(31,100)(32,101)(33,102)(34,103)(35,104)(36,105)(37,85)(38,86)(39,87)(40,88)(41,89)(42,90)(43,123)(44,124)(45,125)(46,126)(47,106)(48,107)(49,108)(50,109)(51,110)(52,111)(53,112)(54,113)(55,114)(56,115)(57,116)(58,117)(59,118)(60,119)(61,120)(62,121)(63,122), (1,62,33)(2,63,34)(3,43,35)(4,44,36)(5,45,37)(6,46,38)(7,47,39)(8,48,40)(9,49,41)(10,50,42)(11,51,22)(12,52,23)(13,53,24)(14,54,25)(15,55,26)(16,56,27)(17,57,28)(18,58,29)(19,59,30)(20,60,31)(21,61,32)(64,110,91)(65,111,92)(66,112,93)(67,113,94)(68,114,95)(69,115,96)(70,116,97)(71,117,98)(72,118,99)(73,119,100)(74,120,101)(75,121,102)(76,122,103)(77,123,104)(78,124,105)(79,125,85)(80,126,86)(81,106,87)(82,107,88)(83,108,89)(84,109,90), (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21)(22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42)(43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63)(64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84)(85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105)(106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126), (1,74)(2,73)(3,72)(4,71)(5,70)(6,69)(7,68)(8,67)(9,66)(10,65)(11,64)(12,84)(13,83)(14,82)(15,81)(16,80)(17,79)(18,78)(19,77)(20,76)(21,75)(22,110)(23,109)(24,108)(25,107)(26,106)(27,126)(28,125)(29,124)(30,123)(31,122)(32,121)(33,120)(34,119)(35,118)(36,117)(37,116)(38,115)(39,114)(40,113)(41,112)(42,111)(43,99)(44,98)(45,97)(46,96)(47,95)(48,94)(49,93)(50,92)(51,91)(52,90)(53,89)(54,88)(55,87)(56,86)(57,85)(58,105)(59,104)(60,103)(61,102)(62,101)(63,100) );

G=PermutationGroup([[(1,75),(2,76),(3,77),(4,78),(5,79),(6,80),(7,81),(8,82),(9,83),(10,84),(11,64),(12,65),(13,66),(14,67),(15,68),(16,69),(17,70),(18,71),(19,72),(20,73),(21,74),(22,91),(23,92),(24,93),(25,94),(26,95),(27,96),(28,97),(29,98),(30,99),(31,100),(32,101),(33,102),(34,103),(35,104),(36,105),(37,85),(38,86),(39,87),(40,88),(41,89),(42,90),(43,123),(44,124),(45,125),(46,126),(47,106),(48,107),(49,108),(50,109),(51,110),(52,111),(53,112),(54,113),(55,114),(56,115),(57,116),(58,117),(59,118),(60,119),(61,120),(62,121),(63,122)], [(1,62,33),(2,63,34),(3,43,35),(4,44,36),(5,45,37),(6,46,38),(7,47,39),(8,48,40),(9,49,41),(10,50,42),(11,51,22),(12,52,23),(13,53,24),(14,54,25),(15,55,26),(16,56,27),(17,57,28),(18,58,29),(19,59,30),(20,60,31),(21,61,32),(64,110,91),(65,111,92),(66,112,93),(67,113,94),(68,114,95),(69,115,96),(70,116,97),(71,117,98),(72,118,99),(73,119,100),(74,120,101),(75,121,102),(76,122,103),(77,123,104),(78,124,105),(79,125,85),(80,126,86),(81,106,87),(82,107,88),(83,108,89),(84,109,90)], [(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21),(22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42),(43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63),(64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84),(85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105),(106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126)], [(1,74),(2,73),(3,72),(4,71),(5,70),(6,69),(7,68),(8,67),(9,66),(10,65),(11,64),(12,84),(13,83),(14,82),(15,81),(16,80),(17,79),(18,78),(19,77),(20,76),(21,75),(22,110),(23,109),(24,108),(25,107),(26,106),(27,126),(28,125),(29,124),(30,123),(31,122),(32,121),(33,120),(34,119),(35,118),(36,117),(37,116),(38,115),(39,114),(40,113),(41,112),(42,111),(43,99),(44,98),(45,97),(46,96),(47,95),(48,94),(49,93),(50,92),(51,91),(52,90),(53,89),(54,88),(55,87),(56,86),(57,85),(58,105),(59,104),(60,103),(61,102),(62,101),(63,100)]])

66 conjugacy classes

 class 1 2A 2B 2C 3A 3B 3C 3D 6A 6B 6C 6D 7A 7B 7C 14A 14B 14C 21A ··· 21X 42A ··· 42X order 1 2 2 2 3 3 3 3 6 6 6 6 7 7 7 14 14 14 21 ··· 21 42 ··· 42 size 1 1 63 63 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ··· 2 2 ··· 2

66 irreducible representations

 dim 1 1 1 2 2 2 2 2 2 type + + + + + + + + + image C1 C2 C2 S3 D6 D7 D14 D21 D42 kernel C2×C3⋊D21 C3⋊D21 C3×C42 C42 C21 C3×C6 C32 C6 C3 # reps 1 2 1 4 4 3 3 24 24

Matrix representation of C2×C3⋊D21 in GL4(𝔽43) generated by

 1 0 0 0 0 1 0 0 0 0 42 0 0 0 0 42
,
 3 20 0 0 23 39 0 0 0 0 3 35 0 0 7 39
,
 4 33 0 0 10 29 0 0 0 0 2 3 0 0 35 10
,
 4 33 0 0 23 39 0 0 0 0 1 42 0 0 0 42
G:=sub<GL(4,GF(43))| [1,0,0,0,0,1,0,0,0,0,42,0,0,0,0,42],[3,23,0,0,20,39,0,0,0,0,3,7,0,0,35,39],[4,10,0,0,33,29,0,0,0,0,2,35,0,0,3,10],[4,23,0,0,33,39,0,0,0,0,1,0,0,0,42,42] >;

C2×C3⋊D21 in GAP, Magma, Sage, TeX

C_2\times C_3\rtimes D_{21}
% in TeX

G:=Group("C2xC3:D21");
// GroupNames label

G:=SmallGroup(252,45);
// by ID

G=gap.SmallGroup(252,45);
# by ID

G:=PCGroup([5,-2,-2,-3,-3,-7,122,483,5404]);
// Polycyclic

G:=Group<a,b,c,d|a^2=b^3=c^21=d^2=1,a*b=b*a,a*c=c*a,a*d=d*a,b*c=c*b,d*b*d=b^-1,d*c*d=c^-1>;
// generators/relations

׿
×
𝔽