text:
Math Help - integral of a square root

1. integral of a square root

how do you find the integral of a square root of a polynomial?

specifically,

the integral of the sqaure root of (t^2+t^4)

2. Originally Posted by cottekr
how do you find the integral of a square root of a polynomial?

specifically,

the integral of the sqaure root of (t^2+t^4)
$\sqrt{t^2+t^4}=\sqrt{t^2(1+t^2)}=|t|\sqrt{1+t^2}$

We can find an antiderviative when $t \ge 0$ or when $t < 0$

3. in the problem I have, its a definite integral from 0 to 1. but I'm not sure how to find the integral of anything under the square root

4. Originally Posted by cottekr
in the problem I have, its a definite integral from 0 to 1. but I'm not sure how to find the integral of anything under the square root
$\int_{0}^{1}t\sqrt{1+t^2}dt$

let $u=1+t^2 \implies du=2tdt \iff \frac{1}{2}du=tdt$

$\int_{1}^{2}\sqrt{u}\frac{1}{2}du=\frac{1}{2}\int_ {1}^{2}u^{1/2}du...$


text:
# Integration Involving the Absolute Function

How do I integrate the double integral of the form $|x^2-y|$ with the boundaries $-1\leq x\leq 1$ and $-1\leq y\leq 1$?

-
Separate the integral into two regions, one with $x^2>y$ and one with $x^2 \leq y$. – copper.hat Feb 11 '13 at 21:28

You can break it into two integrals, one inside the parabola where $y \gt x^2$ and one outside where $y \lt x^2$ So $$\int_{-1}^1\int_{-1}^1 |x^2-y|\; dy \; dx=\\ \int_{-1}^1\int_{-1}^{x^2}x^2-y \;dy \; dx+\int_{-1}^1\int_{x^2}^{1}y-x^2 \;dy \; dx$$

format: plain


text:
Simple IRC Bot in C#

This was a simple IRC bot I threw together a long time ago, found recently, and was curious as to if there were any kind of significant improvements that could be made.

using System;
using System.Net;
using System.Net.Sockets;
using System.IO;

public class IRCbot
{
// server to connect to (edit at will)
public static string SERVER = "irc.changeme.com";
// server port (6667 by default)
private static int PORT = 6667;
// user information defined in RFC 2812 (IRC: Client Protocol) is sent to the IRC server
private static string USER = "USER IRCbot 0 * :IRCbot";
// the bot's nickname
private static string NICK = "IRCbot";
// channel to join
private static string CHANNEL = "#opers";

static void Main(string[] args)
{
NetworkStream stream;
TcpClient irc;
string inputLine;
StreamWriter writer;

try
{
irc = new TcpClient(SERVER, PORT);
stream = irc.GetStream();
writer = new StreamWriter(stream);
writer.WriteLine("NICK " + NICK);
writer.Flush();
writer.WriteLine(USER);
writer.Flush();

while (true)
{
{
Console.WriteLine("<- " + inputLine);

// split the lines sent from the server by spaces (seems to be the easiest way to parse them)
string[] splitInput = inputLine.Split(new Char[] {
' '
});

if (splitInput[0] == "PING")
{
writer.Flush();
//continue;
}

switch (splitInput[1])
{
case "001":
writer.WriteLine("JOIN " + CHANNEL);
writer.Flush();
break;
default:
break;
}
}

// close all streams (to preserve memory)
writer.Close();
irc.Close();
}
}
catch (Exception e)
{
// shows the exception, sleeps for a little while and then tries to establish a new connection to the IRC server
Console.WriteLine(e.ToString());
string[] argv = {};
Main(argv);
}
}
}

• you should separate the IRCBot from the Main into its own class with it's own fields/properties
• you should specify all required parameters via the construtor so that it is not possible to create an invalid ircbot
• I don't think it's a good idea to make the retry recursive - IMHO it would be better to create a loop and limit the retries so that you don't have an infite loop (ok, unless it was desired)
• you really should use the using statement. In your current implementation the resources will be closed only if there was no execption - if an exception occurs the Closees won't be called. You also don't free the resources because you don't call the Dispose, you just close them and then create new resources on retry, this is a memory leak.

Here's an example:

public class IRCbot
{
// server to connect to (edit at will)
// server port (6667 by default)
// user information defined in RFC 2812 (IRC: Client Protocol) is sent to the IRC server

// the bot's nickname
// channel to join

public IRCbot(string server, int port, string user, string nick, string channel, int maxRetries = 3)
{
_server = server;
_port = port;
_user = user;
_nick = nick;
_channel = channel;
_maxRetries = maxRetries;
}

public void Start()
{
var retry = false;
var retryCount = 0;
do
{
try
{
using (var irc = new TcpClient(_server, _port))
using (var stream = irc.GetStream())
using (var writer = new StreamWriter(stream))
{
writer.WriteLine("NICK " + _nick);
writer.Flush();
writer.WriteLine(_user);
writer.Flush();

while (true)
{
string inputLine;
{
Console.WriteLine("<- " + inputLine);

// split the lines sent from the server by spaces (seems to be the easiest way to parse them)
string[] splitInput = inputLine.Split(new Char[] { ' ' });

if (splitInput[0] == "PING")
{
writer.Flush();
//continue;
}

switch (splitInput[1])
{
case "001":
writer.WriteLine("JOIN " + _channel);
writer.Flush();
break;
default:
break;
}
}
}
}
}
catch (Exception e)
{
// shows the exception, sleeps for a little while and then tries to establish a new connection to the IRC server
Console.WriteLine(e.ToString());
retry = ++retryCount <= _maxRetries;
}
} while (retry);
}
}

Usage:

void Main()
{
var ircBot = new IRCbot(
server: "irc.changeme.com",
port: 6667,
user: "USER IRCbot 0 * :IRCbot",
nick: "IRCbot",
channel: "#opers"
);

ircBot.Start();
}

• Yeach, and extract connection info in separate data structure. Then We should separate responsibility - connection, looping and answer strategy -> move this to separate classes. Ideally would be using(var client= clientFactory.Create(Clients.IRC, clientCredentials)){ await botStrategyFactory.Create(BotStrategy.PingPong, client.StreamToRead, client.StreamToWrite).RunAsync(); } :D Sep 28, 2016 at 10:01
• @tym32167 I agree, usually I'd separate everything but this is so tiny that I'd probably wouldn't bother. Sep 28, 2016 at 10:35
• oh, that was just joke, I agree with KISS (Keep it simple and stupid), we don want to overcomplicate here, you answer is pretty enough. Sep 28, 2016 at 10:42

In addition to t3schb0t's answer I'd also change your parsing logic. Your code is just few lines and it's already too complicate to read. After you moved code into a separate class then it's time for refactoring!

Abstract away read/write/log logic. You already have StreamReader, StreamWriter, Console and TcpClient. Current implementation is hard to test (because you need a TCP server and you must read data to/from streams.) More than that: it's almost impossible to test in isolation...let's introduce few more classes.

Abstract IrcServerConnection to handle connection (with its implementation TcpIrcServerConnection and probably a mock to test all the other logic without a true remote IRC server).

Now you have to abstract input stream, let's introduce a IrcDataPipe (here I'd avoid to call it channel because it may cause confusion with IRC channel but a better name is required...) It may expose ReadLines() (which returns IEnumerable<string>, an infinite loop until connection is closed may be appropriate), WriteLine() for generic write operations and Send() to explicitly write a command (see later.) If required you may want to introduce two views of this pipe accessible through two properties like Request and Response (but I'd not go too far at the beginning.)

Also note that NetworkStream is not buffered then you do not need to call Flush() after each write.

You may want to introduce a Log class with its LogWriter (which may be console by default). In this way you may also differentiate between errors and informative messages. Console output may be, for example, colored and you may want a different format for file log (note that command line redirection is always possible.)

inputLine.Split(new Char[] {' '}); may be simplified to inputLine.Split(' ');

Be consistent with variable naming, PongReply should be pongReply.

I'd suggest to remove all those magic constants. If you do not want to introduce an IrcCommand class you may at least use constants. Here is how I'd like to see it (at first step):

pipe.Send(new PongCommand(splitLine[1]));

I'd simplify parsing. For commands for which you have a mandatory response you may use a dictionary (or Reflection...) For example a generic IrcCommand derived class may be something like this:

[InResponseTo(IrcServerMessages.Ping)]
sealed class PongCommand : IrcCommand {
public override string GetResponse(IrcServerMessage message) {
return message.Parameters.Single();
}
}

As you can see I introduced an IrcServerMessage class which both hide parsing and encapsulate parameters. Your processing loop will be as simple as:

using (var connection = CreateConnection().Open())
using (var pipe = connection.OpenPipe())
{

foreach (var message in pipe.ReadLines().Select(x => new IrcServerMessage(x))
ProcessKnownMessages(message);
}

Where LogIn(pipe) is something like this:

private static void LogIn(IrcPipe pipe) {
pipe.Send(
new NickCommand(_nick),
new UserCommand(_nick)
);
}

Note multiple commands on the same line (Send(params IrcCommand[] commands)) to denote a batch which I want to fail/succeed all together.

Now let's move connection into a separate method to use your class like this:

using (var connection = new IrcConnection(CreateConnection))
using (var bot = new IrcBot(connection) {
connection.Open();
bot.StartChatting();
}

You may automatically start bot when connection is open (just add a ConnectionStateChanged event in your IrcConnection class and automatically call LogIn() there) Now your chat loop will simply be:

using (var pipe = Connection.OpenPipe()) {
foreach (var message in pipe.ReadLines().Select(x => new IrcServerMessage(x))
ProcessKnownMessages(message);
}

Now that your bot has state you may want to encapsulate those status into an IrcClient class (to handle basic log-in, keep track of open channels and so on.) In this way you will even be able to operate on multiple channels (or with multiple bots). Again a proof of concept:

using (var connection = new IrcConnection(CreateConnection))
using (var client = new IrcClient(connection) {
using (var bot = new IrcBot(client) {
client.Open(); // Client will open connection if required
bot.StartChatting();
}

As you can see if you name things your code will be more clear, easy to extend and feature-rich...

Also note that you should never catch Exception if you want to perform any recovery logic. Will you attempt a new server connection if you get OutOfMemoryException? What if you have AccessViolationException? Note that for logging purposes you may also want to flatten aggregate exceptions (and some others with an InnerExceptions - note it's plural - property.)

To retry at this outer level may be useful but you should carefully choose which exceptions you may ignore. For example:

try {
}
catch (Exception e) when (IsNotCriticalException(e)) {
}

Also note that in some circumstances you may want to ignore some exceptions (let's also introduce parsing exceptions like ServerMessageFormatException) but you have to know them otherwise you will not have a reliable software but a software that reliably repeatedly fails. Having specific exceptions will also help you to test failure scenarios: if your test will pass with [ExpectedException(typeof(Exception))] you will never be sure if it passed because you correctly handled that scenario or because your code is faulty and it generated NullReferenceException...

• @tym32167 is this what you mean? ;-D Good job Adriano +1 ;-) but for this micro app perhaps a little bit over engineered. Sep 28, 2016 at 13:38
• @t3chb0t I agree, of course OP code has to be "reduced" to fit question size then I'm always in doubt about how big his application is. For a true IRC bot I'd start immediately with a more complex implementation, overhead is small (IMO) compared to time you will save just few days later ;) Sep 28, 2016 at 14:09
• I have to admit, that this general idea of separating all of the small tasks is what I've personally wanted to do with my project, and I love the way this looks. But wow would I be in over my head with how you were describing all that... I can never find good practical code like this in tutorials or what not. May 5, 2017 at 5:34


text:
SEARCH HOME
 Math Central Quandaries & Queries
 Question from Natalie, a student: Is 22/7 bigger or smaller than 3.14?

Hi Natalie,

I would put 22/7 in decimal form by dividing 7 into 22. My calculator gives

$\frac{22}{7} = 3.14285714285714$

The challenge in comparing this to 3.14 is that I am not sure what you mean by 3.14.

• 3.14 might be exactly three and fourteen hundredths, that is $3 \large \frac{14}{100}$ which is 3.140000, with the zero repeating.

• 3.14 might be the result of calculation where you have rounded the result to two decimal places.

• It might be that 3.14 is the result of a measurement where your measurement tool is only accurate to two decimal places.

In the first case 22/7 is larger than 3.14 but in the second and third cases the best I can say is that 22/7 and 3.14 agree to two decimal places.

I hope this helps,
Harley

Math Central is supported by the University of Regina and the Imperial Oil Foundation.


text:
# A Swimming Pool Is 20M In Length, 15M In Breadth And 4M In-Depth. Find The Cost Of Painting Its Four Walls At The Rate Of Rs. 20 Per Square Metre.

Given:

Length = 20m

Height = 4m

The Area of floor = Length × Breadth

$$\Rightarrow 20 * 15$$ $$\Rightarrow 300 m^{2}$$

The Area of walls = 2 (Lh + Bh) $$cm^{2}$$ $$\Rightarrow 2 (20 × 4 + 15 × 4)$$ $$\Rightarrow 2 (80 + 60)$$ $$\Rightarrow 2 (140)$$ $$\Rightarrow 280 m^{2}$$

Sum of areas of floor and four walls = Area of floor + Area of walls

$$\Rightarrow 300 + 280$$ $$\Rightarrow 580 m^{2}$$

Given, Cost for repairing 1 $$m^{2} area = Rs 20$$

Therefore, the cost for repairing 580 $$m^{2}$$ $$\Rightarrow 580 * 20$$ $$\Rightarrow Rs 11600$$

Explore more such questions and answers at BYJU’S.


text:
# Talk:Indeterminate (variable)

WikiProject Mathematics (Rated Start-class, Mid-priority)
This article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of Mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Mathematics rating:
 Start Class
 Mid Priority
Field:  Algebra

## Unclear definition

The definition "a quantity that is not known, and cannot be solved for" is not clear.

• Chaitin's constant is not known, and cannot be solved for. Does that mean it is an indeterminate?
• The text implies that an indeterminate is not a variable. This does not fit with the common use of the term "variable" as I know it.
• In the text "the polynomial ${\displaystyle X-1}$", X is not known and cannot be solved for. In the text "the polynomial equation ${\displaystyle X-1=0}$", X is not known but can be solved for. Does that mean X is an indeterminate in the polynomial by itself but not in the polynomial used in the polynomial equation?  --Lambiam 17:39, 24 July 2008 (UTC)
I agree with the criticism; this definition should be rewritten. In fact, I would say an indeterminate is a symbol that is not used to designate any (other) known or unknown quantity: it is neither an unknown (initially unspecified value, but which with some good luck can be solved for), nor a parameter (value supposed to be given and fixed in the problem at hand, but not explicitly known), nor a formal variable (as the bound variable in some syntactic construction like a summation, or the variable used for the argument in a function definition; in both cases such a variable stands for many different values at once). Note that parameters nor formal variables are known, and cannot be solved for either, showing again the defect of the current definition.
What distinguishes indeterminates is that by standing for nothing else, they become bona fide values in their own right. So for instance by constructing the polynomial ring Z[X], the symbol X acquires the status of indeterminate (but many other formal constructions can introduce indeterminates as well). This is a rather fundamental conceptual step that ought to be described properly in this article. But to answer your last question: indeed, if a polynomial is used in a polynomial equation, its indeterminates lose their status, and become unknowns; regarding ${\displaystyle X-1=0}$ as an equation of formal polynomials it just states an unconditional falsehood (both members are distinct polynomials, period). Marc van Leeuwen (talk) 10:51, 2 August 2008 (UTC)
• I find this entry confusing. In case 2, doesn't

2 + 3x = a + bx

actually mean

'2 + 3x' = ˹Φ + ψx˺

where the funny brackets are quasi-quotes and Φ and ψ are meta-variables?Adam.a.a.golding (talk) 01:57, 21 December 2009 (UTC)

• The final example given in the section "Polynomials" (regarding 0-0^2=0, 1-1^2=0, with modulo 2) seems to lack an additional note for it in the main page which might cause some misunderstanding? We can find that another modulo 2 value of '-1' gives the form (-1)-(-1)^2=(-1)-1=-2, which results in the answer of -2 which in modulo 2 also equals 0 (yes, there is a small mistake in doing this which i'll get to soon, but the statement is not incorrect). There is a bit of trickiness in seeing that binding a range limit (ie. Must be an integer, and must have value equivalence after applying modulo 2) to some unknown x; is trying to give an example too complicated which a student might get confused (because it's perfectly fine for the intermediate X to be limited as well -- say 'must only be an integer').

Getting back to why (-1)-(-1)^2=(-1)-1=-2, isn't a concern; we need to remember that for our function, the modulo 2 property is a requirement of the Domain. The numerical output structure is the Range (which can be defined as something else). Our target output of 0 needs to make sense for what we define the Range to be. THIS is the reason why doing modulo 2 on such output is not correct. I believe what the author of the equation example tried to do was to say "hey.. there's some function that generates an intended result value with a source of unknown x (the structure of x is defined by some Domain. We are talking about particular Numbers here, not a fancy matrix) which generates more than 1 solution, but this unknown x is not an indeterminate X; because an indeterminate (with a structure defined by the Domain) requires that the function will ALWAYS generate the intended result value regardless of what value of X is." 60.240.106.190 (talk) 00:52, 11 February 2015 (UTC)

## why is x the unknown

Perhaps it is worth to mention, why we use in general x as unknown. http://www.ted.com/talks/terry_moore_why_is_x_the_unknown.html --77.186.34.177 (talk) 21:12, 2 July 2012 (UTC)


text:
Back in 2016, there was discussion and excitement for data containers. Two recent developments have told me that now is the time to address this once more:

• The knowledge that containers don't necessary need an operating system.
• The ability to create a container from scratch supported by Singularity (pull request here).

I was also invited to speak at dataverse and thought it would be a great opportunity to get people thinking again about data containers. I had less than a week to throw something together, but with a little bit of thinking and testing, this last week and weekend I have a skeleton, duct-taped together, preliminary cool idea to get us started! You can continue reading below, or jump to read the container database site for detailed examples.

## What are the needs of a data container?

Before I could build a data container, I wanted to decide what would be important for it to have, or generally be. I decided to take a really simple perspective. Although I could think about runtime optimization, for my starting use case I wanted to be asap - as simple as possible! If we think of a “normal” container as providing a base operating system to support libraries, small data files, and ultimately running scientific software,

then we might define a data container as:

a container without an operating system optimized for understanding and interacting with data

That’s right, remove the operating system and all the other cruft, and just provide the data! With this basic idea, I started by creating a data-container repository to play around with some ideas. I knew that I wanted:

• a container without an operating system
• an ability to interact with the container on its own to query the data (metadata)
• an ability to mount it via an orchestrator to interact with the data
• flexibility to customize the data extraction, interaction, metadata.

If we need to interact with the data still, although we won’t have an operating system, we’ll need some kind of binary in there.

### How do we develop something new?

I tend to develop things with baby steps, starting with the most simple example and slowly increasing in complexity. If you look at the data-container repository, you’ll likely be able to follow my thinking.

hello world

I started by building a hello world binary on the host (in Golang) and then adding it to a scratch container as an entrypoint. These basic commands I’ll show once - they are generally the same for the following tests that I did. This is how we compile a GoLang script on my host.

GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o hello

Here is how we add it to a container, and specify it to be the entrypoint.

FROM scratch
COPY hello /
CMD ["/hello"]

And then here is how we build and run the container. It prints a hello world message. Awesome!

$docker build -f Dockerfile.hello -t hello .$ docker run --rm hello
Hello from OS-less container (Go edition)

sleep

The next creation was a “sleep” type entrypoint that I could use with a “docker-compose.yml” file to bring up the container with another, and bind (and interact with) the data. Running the container on it’s own would leave your terminal hanging, but with a “docker-compose.yml” it would keep the container running as a service, and of course share any data volumes you need with other containers.

in memory database

Once that was working, I took it a step further and used an in-memory database to add some key value pair, and then print it to the terminal. After this worked it was smooth sailing, because I’d just need to create an entrypoint binary that would generate this database for some custom dataset, and then build it into a container. I wanted to create a library optimized for generating the entrypoint.

## How do we generate it?

Great! At this point I had a simple approach that I wanted to take: to create a executable with an in-memory database to query a dataset. The binary, along with the data, would be added to an “empty” (scratch) container. I started a library cdb (and documentation here) that would be exclusively for this task. Since Python is the bread and butter language for much of scientific programming (and would be easier for a scientist to use) I decided to implement this metadata-extraction, entrypoint-generation tool using it. Let’s walk through the generation steps.

### Entrypoint

Adding data to a scratch base is fairly trivial - it’s the entrypoint that will provide the power to interact with the data. Given that we have a tool (cdb) that takes a database folder (a set of folders and files) and generates a script to compile:

# container database generate from the "data" folder and output the file "entrypoint.go"
$cdb generate /data --out /entrypoint.go  We can create a multi-stage build that will handle all steps from metadata generation, to golang compile, to generation of the final data container. If you remember from above, we had originally compiled our testing Go binaries on our host. We don’t need to do that, or even to install the cdb tool, because it can be done with a multi-stage build. We will use the follow stages: • Stage 1 We install cdb to generate a GoLang template for an in-memory database. • Stage 2 We compile the binary into an entrypoint • Stage 3 We add the data and the binary entrypoint to a scratch container (no operating system). In stage 1, both the function for extraction and the template for the binary can be customized. The default will generate an entrypoint that creates the in-memory database, creates indices on metadata values, and then allows the user to search, order by, or otherwise list contents. The default function produces metadata with a file size and hash.  import os from cdb.utils.file import get_file_hash def basic(filename): """Given a filename, return a dictionary with basic metadata about it """ st = os.stat(filename) return {"size": st.st_size, "sha256": get_file_hash(filename)}  You can imagine writing a custom function to use any kind of filesystem organization (e.g., BIDS via pybids) or other standard (e.g., schema.org) to handle the metadata part. I will hopefully be able to make some time to work on these examples. We’d basically just provide our custom function to the cdb executable, or even interact from within Python. Before I get lost in details, let’s refocus on our simple example, and take a look at this multi-stage build. Someone has likely done this before, it’s just really simple! ### The Dockerfile Let’s break the dockerfile down into it’s components. This first section will install the cdb software, add the data, and generate a GoLang script to compile, which will generate an in-memory database. stage 1  FROM bitnami/minideb:stretch as generator ENV PATH /opt/conda/bin:${PATH}
ENV LANG C.UTF-8
RUN /bin/bash -c "install_packages wget git ca-certificates && \
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda && \
rm Miniconda3-latest-Linux-x86_64.sh"

# install cdb (update version if needed)
RUN pip install cdb==0.0.1

# Add the data to /data (you can change this)
WORKDIR /data
COPY ./data .
RUN cdb generate /data --out /entrypoint.go

stage 2

Next we want to build that file, entrypoint.go, and also carry the data forward:

FROM golang:1.13-alpine3.10 as builder
COPY --from=generator /entrypoint.go /entrypoint.go
COPY --from=generator /data /data

# Dependencies
RUN apk add git && \
go get github.com/vsoch/containerdb && \
GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /entrypoint -i /entrypoint.go

stage 3

Finally, we want to add just the executable and data to a scratch container (meaning it doesn’t have an operating system)

FROM scratch
LABEL MAINTAINER @vsoch
COPY --from=builder /data /data
COPY --from=builder /entrypoint /entrypoint

ENTRYPOINT ["/entrypoint"]

And that’s it! Take a look at the entire Dockerfile if you are interested, or a more verbose tutorial.

### Building

We have our Dockerfile that will handle all the work for us, let’s build the data container!

$docker build -t data-container .  ### Single Container Interaction We then can interact with it in the following ways (remember this can be customized if you use a different template). You can watch me interact in the asciinema here: or continue reading. metadata If we just run the container, we get a listing of all metadata alongside the key. $ docker run data-container

list

We can also just list data files with -ls

$docker run data-container -ls /data/avocado.txt /data/tomato.txt  orderby Or we can list ordered by one of the metadata items: $ docker run data-container -metric size
Order by size

search

Or search for a specific metric based on value.

$docker run data-container -metric size -search 8 /data/tomato.txt 8$ docker run entrypoint -metric sha256 -search 8

get

Or we can get a particular file metadata by it’s name:

$docker run data-container -get /data/avocado.txt /data/avocado.txt {"size": 9, "sha256": "327bf8231c9572ecdfdc53473319699e7b8e6a98adf0f383ff6be5b46094aba4"}  or a partial match: $ docker run data-container -get /data/

start

The start command is intended to keep the container running, if we are using it with an orchestrator.

$docker run data-container -start  ### Orchestration It’s more likely that we want to interact with files in the container via some analysis, or more generally, another container. Let’s put together a quick docker-compose.yml to do exactly that.  version: "3" services: base: restart: always image: busybox entrypoint: ["tail", "-f", "/dev/null"] volumes: - data-volume:/data data: restart: always image: data-container command: ["-start"] volumes: - data-volume:/data volumes: data-volume:  Notice that the command for the data-container to start is -start, which is important to keep it running. After building our data-container, we can then bring these containers up: $ docker-compose up -d
Starting docker-simple_base_1   ... done
Recreating docker-simple_data_1 ... done

$docker-compose ps Name Command State Ports --------------------------------------------------------- docker-simple_base_1 tail -f /dev/null Up docker-simple_data_1 /entrypoint -start Up  We can then shell inside and see our data! $ docker exec -it docker-simple_base_1 sh
/ # ls /data/

The metadata is still available for query by interacting with the data-container entrypoint:

\$ docker exec docker-simple_data_1 /entrypoint -ls
/data/tomato.txt

Depending on your use case, you could easily make this available inside the other container.

## Why should I care?

I want you to get excited about data containers. I want you to think about how such a container could be optimized for some organization of data that you care about. I also want you to possibly get angry, and exclaim, “Dinosaur, you did this all wrong!” and then promptly go and start working on your own thing. The start that I’ve documented here and put together this weekend is incredibly simple - we build a small data container to query and show metadata for two files, and then bind that data to another orchestration setup. Can you imagine a data container optimized for exposing and running workflows? Or one that is intended for being stored in a data registry? Or how about something that smells more like a “results” container that you share, and have others run the container (possibly with their own private data bound to the host) and then write a result file into an organized namespace? I can imagine all of these things!

I believe the idea is powerful because we are able to keep data and interact with it without needing an operating system. Yes, you can have your data and eat it too!

Combined with other metadata or data organizational standards, this could be a really cool approach to develop data containers optimized to interact with a particular file structure or workflow. How will that work in particular? It’s really up to you! The cdb software can take custom functions for generation of metadata and templates for generating the GoLang script to compile, so the possibilities are very open.

## What are next steps

I’d like to create examples for some real world datasets. Right now, the library extracts metadata on the level of the file, and I also want to allow for extraction on the level of the dataset. And I want you to be a part of this! Please contribute to the effort or view the container database site for detailed examples! I’ll be slowly adding examples as I create them.

Suggested Citation:
Sochat, Vanessa. "Data Containers." @vsoch (blog), 14 Jun 2020, https://vsoch.github.io/2020/data-containers/ (accessed 28 Nov 22).


text:
futhark-0.11.0: An optimising compiler for a functional, array-oriented language.

Description

Facilities for inspecting the data dependencies of a program.

Synopsis

# Documentation

A mapping from a variable name v, to those variables on which the value of v is dependent. The intuition is that we could remove all other variables, and v would still be computable. This also includes names bound in loops or by lambdas.

dataDependencies :: Attributes lore => Body lore -> Dependencies Source #

Compute the data dependencies for an entire body.


text:
# Direct Materials and Direct Labor Budgets The production department of Priston Company has...

Direct Materials and Direct Labor Budgets

The production department of Priston Company has submitted the following forecast of units to be produced by quarter for the upcoming fiscal year.

 1st Quarter 2nd Quarter 3rd Quarter 4th Quarter Units to be produced . . . . . . . . 6,000 7,000 8,000 5,000

In addition, the beginning raw materials inventory for the 1st Quarter is budgeted to be 3,600 pounds and the beginning accounts payable for the 1st Quarter is budgeted to be $11,775. Each unit requires three pounds of raw material that costs$2.50 per pound. Management desires to end each quarter with a raw materials inventory equal to 20% of the following quarter’s produc- tion needs. The desired ending inventory for the 4th Quarter is 3,700 pounds. Management plans to pay for 70% of raw material purchases in the quarter acquired and 30% in the following quarter. Each unit requires 0.50 direct labor-hours and direct labor-hour workers are paid \$12 per hour.

Required:

1.       Prepare the company’s direct materials budget and schedule of expected cash disbursements for purchases of materials for the upcoming fiscal year.

2.       Prepare the company’s direct labor budget for the upcoming fiscal year, assuming that the direct labor workforce is adjusted each quarter to match the number of hours required to produce the forecasted number of units produced.


text:
# Is my proof that every linearly independent set of E is a subset of a basis of E correct?

Asking this because I'm not sure how "mathematically valid" is the argument that I used in my demonstration. Please note that my question is not about how to prove the theorem, but about whether my demonstration is correct. If the proof is incorrect, is there any way to make it more "valid mathematically"? If it's correct, my question is: what can be done to improve it?

Theorem. Let $E$ be a finite vector space with dimension $N$. Every linearly independent set $X=\{v_1, ..., v_m\}$ of $E$ is a subset of a basis for $E$.

Proof.

Firstly, note that $m<N$. Due to the hypothesis, we know that $\exists v\in E-Span(\{v_1,...,v_m\})$. From here, there are two possibilities:
(A) $Span(\{v_1,...,v_m,v\})=E$
(B) There still exists another $\exists v\in E - Span(\{v_1, ..., v_m, v\})$

In either scenario, $\{v_1,...,v_m, v\}$ is linearly independent. If (A) is true, then we are done. In the case of (B), we repeat the process with $\{v_1,...,v_m,v\}$ instead of $\{v_1,...,v_m\}$ until we get (A).

(Part that I don't know whether it is necessary or not:)

We claim that the process described happens in a finite number of times. In fact, there's no way for it to happen more times than $N$ times. If the process were to be repeated, let's say $N+1$ times, then we would obtain a linearly independent set that has a cardinality greater than $\dim{E}$, which is absurd.

• For it is perfect. If fact, if I had had to proved the theorem I would do this. – Dog_69 May 16 '18 at 15:14
• You said $m<N$ but this was not given. Rather, $m>N$ is impossible and $m=N$ implies $X$ is basis. The other case, $m<N$, your proof is good. I think it is correct to consider the vector space $E\setminus\text{Span}(X)$. You are guaranteed this vector space has a basis, say $Y$, so that $X\cup Y$ is a basis for $E$. Then $X\subseteq X\cup Y$. – M. Nestor May 16 '18 at 15:21

It is correct, but you should never use the same symbol for two distinct objects. I'm talking about $v$ here.
There is a problem with your notation: you should have written $E\setminus\operatorname{Span}(\{e_1,\ldots,e_n\})$ instead of $E-\operatorname{Span}(\{e_1,\ldots,e_n\})$ (it is ambiguous).
Finally, it would be more elegant to express your proof as an inductive proof on $N-m$.
• If $N-m=0$, then $X$ is already a basis. Now, suppose that it is true that, for some $k\in\mathbb{Z}_+$, whenever $N-m=k$, then you can extend $X$ to a basis. Now, if $N-m=k+1$, you apply your method in order to prove that there is a vector $v$ such that $X'=X\cup\{v\}$ is linearly independent. But then $\#X'=\#X+1$ and therefore you can apply the induction hypothesis to $E$ and $X'$. So, you know that you can extend $X'$ to a basis $B$ of $E$ and $B$ will be an extension of $X$ too. – José Carlos Santos May 16 '18 at 15:31


text:
# Tag Info

## New answers tagged uncertainty-principle

0

Your situation is a little confusing since the velocity of the wave packet is not related to the momentum. If you want to speak about the uncertainty principle for classical waves, the 'momentum' is proportional to the inverse wavelength $\lambda^{-1}$. In this situation the speed of the wave does not depend on the wavelength, only things like the density of ...

4

I think you have misunderstood the meaning of the equation $$\Delta X \Delta P \geq \hbar / 2 \, .$$ This is not surprising given that the notation used here is really, really misleading. It should be written like this $$\sigma_X \sigma_P \geq \hbar / 2 \, .$$ To understand this we have to explain what $\sigma_X$ and $\sigma_P$ mean. Suppose you have a ...

1

Given two observables $A$ and $B$ such that $[A,B] = iC$, the most general form of the uncertainty principle is $$\Delta_\omega(A)\Delta_\omega(B)\geq\frac12|\omega(C)|,$$ where $\omega$ is any state of the algebra of observables. By the Riesz-Markov theorem, there is a regular probability measure such that $$\omega(f(A)) = \int_{\sigma(A)}f(\lambda)\ \text ... 0 With the uncertainty priciple, you cannot know the position and momentum of a particle (or anything for that matter) beyond a maximum precision. You can know where and how fast a particle is moving, just not with infinite precision in both variables. It's not just a measurement issue, but a fundamental fact. So a particle accelerator can still focus a ... 1 To answer your first point, as far as I know, a test beam is used to calibrate the position and accuracy of the system, before the main beam is sent, to avoid, as you point out, any damage to the equipment. An indication of how few actual collisions there are is given by the fact that in 1978, a scientist did get a high energy beam right in the face, not at ... 0 If the pencil were at absolute zero it would necessarily assume its lowest energy state, which is not the vertical state. If the pencil were modeled as a quantum rotor with an infinite potential barrier covering half its solid angle space (i.e. the table) then there are certainly excited but stable states where the pencil remains in a more or less vertical ... 0 Here \rho is the density matrix for a pure state, but it's nonetheless a density matrix (simply one with von Neumann entropy of nought, but that doesn't matter). Recall that for any Hermitian operator \hat{M}, the n^{th} moment of the probability distribution of the measurement made by \hat{M} is \mathrm{tr}(\rho\,\hat{M}^n). See, for example, the ... 0 GIVE IT A SPIN, with the max possible rpm for such massive object. Do the experiment at the ISS, well above Earth surface. Unconstrain the problem from the 'surface' issue. Remove the 'surface' below the atom tip -- where is bellow without gravity? -- or approximate the surface as much as you can but without contact (the atom's electronic cloud prevent this, ... 0 If your measurement would give you an exact upper and/or lower bound, but no more information (i.e. a probability distribution), the state would collapse into the projection onto the subspace of possible values, so it would still be a superposition. More generally and realistically, we would measure a value, and assign decreasing (classical) probabilities ... 2 If black holes have mass but no size, does that imply zero uncertainty in position? If so, what does that imply for uncertainty in momentum? I mean to say that the particles which were originally separate have theoretically come to occupy the same point in space. Does the uncertainty principle apply to this phenomenon? Zero size doesn't ... 4 General relativity is a classical theory. The Heisenberg uncertainty principle does not apply to it. The research frontier in physics now exists in quantizing gravity and unifying it with the other three forces (strong , weak, electromagnetic). Once that is done the solution for the black hole will become a probability distribution and the Heisenberg ... 1 Did you cover the uncertainty principle? In quantum mechanics there is and uncertainty between energy and time:$$ \Delta E \Delta t > \frac{h}{4\pi}$$this means that if you try to measure Energy with perfect accuracy you will have a great uncertainly in time (actually an infinity uncertainty). I guess this is what the professor was referring to, and ... 1 First of all I think I should clarify the confusion of the terminology "uncertainty in x". What we mean by uncertainty is simply the standard deviation of the observable defined by:$$\Delta x= \sqrt{ \left< x^2 \right> - \left< x \right>^2} where $<A>$ denotes the expectation value of the operator $A$ is some state $\psi$. You should ...

Top 50 recent answers are included


text:
# Variation of a strongly bounded measure is strongly bounded too

Let $\mathcal{A}$ be a field of subsets of a set $\Omega$, $X$ a Banach space and $\mu:\mathcal{A}\rightarrow X$ a finitely additive vector measure.

The variation of $\mu$ is the extended nonnegative function $|\mu|$ whose value on a set $E\in\mathcal{A}$ is given by $$|\mu|(E)=\sup_\pi\sum_{A\in\pi}\|\mu(A)\|,$$ where the supremum is taken over all partitions $\pi$ of $E$ into a finite number of pairwise disjoint members of $\mathcal{A}$.

It can be shown that $|\mu|$ is also a finitely additive measure.

A finitely additive measure $\mu$ is said to be exhaustive (or strongly bounded) if for every $(E_n)$ sequence of pairwise disjoint members of $\mathcal{A}$, then $\lim_n\mu(E_n) = 0$.

It is easy to show that $|\mu|$ exhaustive implies $\mu$ exhaustive for every $X-$valued finitely additive measure. If $\mu$ is real-valued or complex-valued and bounded, it can be shown that $\mu$ exhaustive implies $|\mu|$ exhaustive.

Does a bounded $\mu$ that is exhaustive imply $|\mu|$ exhaustive for an $X-$valued finitely additive measure?

I am unsure of how to prove this and I was wondering if I could get a hint.

Thanks!

## 1 Answer

If I understood well, you are supposing that given a bounded exhaustive measure $\mu$, its total variation $\vert\mu\vert$ is also an exhaustive measure. I believe that this is not true for all infinite dimensional spaces.

Firs of all, please note that every exhaustive measure is bounded (see Corollary 19 at page 9 of Vector measure by Diestel and Uhl), so if your conjecture were true then every exhaustive measure would automatically have bounded variation. This last assertion is not true in general, as shown in the example 16 at page 7 of Vector Measure (by Diestel and Uhl).

In any case, if $X$ is a Banach space, $\Sigma$ a field of subsets of $\Omega$ and $\mu\colon \Sigma\to X$ is an exhaustive measure, it can be proved that $\vert\mu\vert$ is exhaustive if and only if $\vert\mu\vert$ is bounded. This means that your conjecture is true whenever $X$ is such that every exhaustive measure has bounded variation, which are just the finite dimensional spaces by the Dvoretsky-Rogers theorem.

I hope this answer your question, even if such a long time has passed.

Niccolò


text:
# poly2sym

Create symbolic polynomial from vector of coefficients

## Syntax

``p = poly2sym(c)``
``p = poly2sym(c,var)``

## Description

example

````p = poly2sym(c)` creates the symbolic polynomial expression `p` from the vector of coefficients `c`. The polynomial variable is `x`. If `c = [c1,c2,...,cn]`, then ```p = poly2sym(c)``` returns ${c}_{1}{x}^{n-1}+{c}_{2}{x}^{n-2}+...+{c}_{n}$.This syntax does not create the symbolic variable `x` in the MATLAB® Workspace.```

example

````p = poly2sym(c,var)` uses `var` as a polynomial variable when creating the symbolic polynomial expression `p` from the vector of coefficients `c`.```

## Examples

### Create Polynomial Expression

Create a polynomial expression from a symbolic vector of coefficients. If you do not specify a polynomial variable, `poly2sym` uses `x`.

```syms a b c d p = poly2sym([a, b, c, d])```
```p = a*x^3 + b*x^2 + c*x + d```

Create a polynomial expression from a symbolic vector of rational coefficients.

`p = poly2sym(sym([1/2, -1/3, 1/4]))`
```p = x^2/2 - x/3 + 1/4```

Create a polynomial expression from a numeric vector of floating-point coefficients. The toolbox converts floating-point coefficients to rational numbers before creating a polynomial expression.

`p = poly2sym([0.75, -0.5, 0.25])`
```p = (3*x^2)/4 - x/2 + 1/4```

### Specify Polynomial Variable

Create a polynomial expression from a symbolic vector of coefficients. Use `t` as a polynomial variable.

```syms a b c d t p = poly2sym([a, b, c, d], t)```
```p = a*t^3 + b*t^2 + c*t + d```

To use a symbolic expression, such as `t^2 + 1` or `exp(t)`, instead of a polynomial variable, substitute the variable using `subs`.

```p1 = subs(p, t, t^2 + 1) p2 = subs(p, t, exp(t))```
```p1 = d + a*(t^2 + 1)^3 + b*(t^2 + 1)^2 + c*(t^2 + 1) p2 = d + c*exp(t) + a*exp(3*t) + b*exp(2*t)```

## Input Arguments

collapse all

Polynomial coefficients, specified as a numeric or symbolic vector. Argument `c` can be a column or row vector.

Polynomial variable, specified as a symbolic variable.

## Output Arguments

collapse all

Polynomial, returned as a symbolic expression.

## Tips

• When you call `poly2sym` for a numeric vector `c`, the toolbox converts the numeric vector to a vector of symbolic numbers using the default (rational) conversion mode of `sym`.

## Version History

Introduced before R2006a