text:
# Find solutions to a quadratic equation

I've started to get far more familiar with C (and coding in general) and the way to use function to my advantage to create more complex programs. As a way of doing something actually useful instead of my "Starting Programming with C: For Dummies" book I decided to make a simple program to help me cheat my way through maths class, a program that calculates the quadratic equation.

However due to the fact that I've never seen a piece of code that is longer than 60 lines outside of a youtube videos and my for Dummies book, I don't exactly know if the way I format functions is readable to other people.

/*El programa calcula la ecuación general de segundo grado,
no tiene mayor proposito más que practicar C y hacer trampa en los exámenes -w-,
trato de usar funciones claras para hacer más legible el código, tómese nota de que me gusta
main en primer lugar main y luego el resto de funciones.*/
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void value_input();
int discriminante(int b, int a, int c);
void display();
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
void main(){
value_input();
b=-b; //como todas las operaciones con "b" son su multiplicación *-1 y su cuadrado, decidí solo volver b negativo (o positivo dependiendo del caso)
discriminante(b,a,c);

display();
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
//value_input solo le pregunta al usuario los valores de a, b y c en la ecuación y los aloca a las variables correspondientes.
void value_input(){
printf("Dame el valor de a: ");
scanf("%d", &a);
printf("Dame el valor de b: ");
scanf("%d", &b);
printf("Dame el valor de c: ");
scanf("%d", &c);
}
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
//La función calcula la discriminante y devuelve su valor
int discriminante(int b, int a, int c){
int result;
b*=b;
c=4*a*c;
total=b-c;
}
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
//display calcula el divisor de la ecuación y determina como imprimir la ecuación basado en el discriminante
void display(){
a*=2; //se calcula el divisor
//se calcula valor del discriminante y dependiendo de éste se imprime el resultado
if(total>0){    //es mayor que 0
total=sqrt(total);
}
else if(total<0){       //es menor que 0
total=abs(total);
total=sqrt(total);
}
else if(total=0){       //es igual a 0
}
}

I think that it is mostly understandable for anyone that wants to review the code in general, but I think that it can become a little convoluted in some places, specially the display() function.

How could I make it clearer?

• @IñakiUlibarri Please edit your question to include only your code file's content, not the visuals of your editor. In case you have only nano at hand, use M-# to disable the line numbering temporarily. – Zeta Apr 22 at 13:48
• I see you've edited the question title, but it still only mentions your concerns about the code - here on Code Review, the title should describe what real-work task your program solves. Please see How to get the best value out of Code Review: Asking Questions for guidance on writing good question titles. I've edited with what I think the code does. – Toby Speight Apr 22 at 15:41
• @IñakiUlibarri b*=b; c=4*a*c; both can overflow int math. Is that a concern for you? are you just making this code to handle small integer values? – chux - Reinstate Monica Apr 22 at 19:21
• @chux, it's even worse - see the integer division right at the end! – Toby Speight Apr 23 at 6:51
• @chux-ReinstateMonica Yes, I made this to practice my C and cheat my way through my Highschool maths class, you'll imagine that I rarely input negative values into it, let alone fractions and other whatnots. You'll also see that it's amateurish and generally sucky all around, that is because this is literally my first ever piece of functional, functioning code :-), I came here because I've found my "For Dummies" book to be quite unresponsive when I asked for suggestions, so I figured that having good feedback from the start would be good to avoid bad habits, and this place seems good for that. – Iñaki Ulibarri Apr 23 at 16:17

I would find it easier to understand if the comments were in English, but I'm not the one who will be making changes later, so write your comments for that person (whatever is most useful to future-you).

What I find actively harmful is the very long lines such as

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------

and

        b=-b; //como todas las operaciones con "b" son su multiplicación *-1 y su cuadrado, decidí solo volver b negativo (o positivo dependiendo del caso)

For the first, I think an empty line would be better; for the second, consider word-wrapping it as a block comment.

The global variables a, b, c, total and resultado make it harder to reason about each function in isolation. I can't even see where that last one is actually used. Prefer to pass values to and from functions rather than communicating via globals.

These function declarations would be better as prototypes (i.e. specify that they take no arguments, rather than unspecified ones):

void value_input(void);
void display(void);

I'd declare all the helpers with static linkage (this becomes more important when you write programs with multiple source files, but it's a good habit to form), and I'd accept the arguments to discriminante() in the less surprising order a, b, c.

void main() is incorrect - the main function must return an int, so we need int main(void). Your compiler should have warned you about this; make sure you're enabling enough warning options (e.g. gcc -Wall -Wextra).

When we read input using scanf(), it's important to use the return value that indicates how many conversions were successful. I would write a function to get a single value (and accept non-integer coefficients, since that's what we can expect from real equations - pun intended):

double read_double(const char *prompt)
{
for (;;) {
printf("%s: ", prompt);
double x;
int conversions = scanf("%lf", &x);
if (conversions == 1) {
return x;
}
if (conversions == EOF) {
/* not much we can do now */
exit(1);
}
/* consume the invalid input and start again */
puts("Input should be a valid number");
scanf("%*[%\n]");
}
}

discriminante() declares total which it never uses, and returns a value that gets ignored. There's clearly something wrong there.

This line doesn't do what you think it does:

   else if(total=0){

Thankfully, it's harmless, since if total>0 and total<0 are both false, we know that total is already zero, and the assignment has no effect.

When we know a number n is negative, we can make it positive simply with -n rather than calling abs().

# Modified code

Here's what I ended up with after fixing the above:

/* El programa calcula la ecuación general de segundo grado, no tiene
mayor proposito más que practicar C y hacer trampa en los exámenes
-w-, trato de usar funciones claras para hacer más legible el
código, tómese nota de que me gusta main en primer lugar main y
luego el resto de funciones.
*/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

static double discriminante(double a, double b, double c);
static void display(double a, double b, double d);

int main(void)
{
const double a = read_double("Dame el valor de a");
const double b = read_double("Dame el valor de b");
const double c = read_double("Dame el valor de c");

const double d = discriminante(a, b, c);

display(a, b, d);
}

{
for (;;) {
printf("%s: ", prompt);
double x;
int conversions = scanf("%lf", &x);
if (conversions == 1) {
return x;
}
if (conversions == EOF) {
/* not much we can do now */
exit(1);
}
/* consume the invalid input and start again */
puts("Input should be a valid number");
scanf("%*[%\n]");
}
}

// La función calcula la discriminante y devuelve su valor
static double discriminante(double a, double b, double c)
{
return b * b - 4 * a * c;
}

// display calcula el divisor de la ecuación y determina como imprimir
// la ecuación basado en el discriminante
static void display(double a, double b, double d)
{
if (d > 0) {
printf("(%g±%g)/%g\n", -b, sqrt(d), a);
} else if (d < 0) {
printf("(%g±%gi)/%g\n", -b, sqrt(-d), a);
} else {                /* total == 0 */
printf("%g/%g\n", -b, a);
}
}

• Yes. I was going to say something about that function being hard to do well, and I inadvertently proved it! Now improved. – Toby Speight Apr 22 at 19:00
• From what I understand, scanf exhibits UB when the input isn't representable with the given type, so this still doesn't really work. C99, 7.19.6.2, p10: [The] input item [...] is converted to a type appropriate to the conversion specifier. [The] result of the conversion is placed in the object pointed to by the first argument following the format argument that has not already received a conversion result. If this object does not have an appropriate type, or if the result of the conversion cannot be represented in the object, the behavior is undefined. – JCC Apr 22 at 19:57
• @JCC, what would you recommend instead? – Toby Speight Apr 23 at 6:49
• The only way to do this correctly that I'm aware of is to read the entire line, and then parse it using strto*, which can indicate an error if one appears. See ramblings.implicit.net/c/2014/05/04/…. – JCC Apr 23 at 9:29
• Ah, yes, that's good. That said, "reading an entire line" is harder than it sounds, in the general case. Thankfully, we can get away with reading, say, up to 40 chars of a line, and if the line is longer and fails conversion, then perform additional reading to discard the rest of the line. – Toby Speight Apr 23 at 9:41

Readability in code is highly subjective, so take everything in this section with a grain of salt.

## Line lengths

Most styles used in the wild will explicitly limit the length of the lines to less than 100 characters if possible. Whether it's 72, 80, 96 or another random value isn't important, but >140 is too much.

## Language

Unless you're the only developer working on the software, you should use English identifiers and documentation. But even if you're the only developer working on a piece of code at the moment, you might not be the only dev working on it forever. It's easier to start in an international format first than to change everything later.

## Giving space to breathe

Have a look at the following two code snippets:

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int a,b,c,total,result; //total is used for the result of different operations of the equation, result is the final result of the equation.
void value_input();

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int a, b, c;
int total;  // total is used for the result of different operations of the equation,
int result; // result is the final result of the equation.

void value_input();

Have a look at both variants. Both contain the same code. Which one would you prefer to read in a few weeks after you forgot about this snippet? Which one is easier to overview?

Space is important. While it doesn't matter to your compiler, it matters to you, the human. Patterns get a lot easier to recognize if they're isolated from each other, and space provides the necessary isolation.

Also, we were able to cut down the line length by a lot by splitting total and result into their own lines. There's no scrollbar anymore, and we can see the full comments without any hassle.

Spacing also makes it easier to recognize a bug in the current code:

void display(){
// <snip>
else if(total=0){       //es igual a 0
}
}

Do you notice the bug? How about now:

void display(){
// <snip>
else if(total = 0){       //es igual a 0
}
}

That's an assignment, not an equality test.

Note that I would use a single line per declaration, but before that, let's talk about the proper place about those declarations.

# Global variables and hard maintainability

You probably wondered about the "(light)" part in the previous section. While those changes in your formatting and spacing make it easier to read your code, global variables handicap reasoning about code.

In order to know how a, b, c, total and result change, we need to inspect all functions, because any function from the same file might change it. There might even be a typo somewhere, e.g.

//          whoops:                 v
int discriminante(int b, int a, int d) {
int result;
b *= b;
c = 4 * a * c;                   // oh no, global c changed!
total = b - c;

Suddenly, we're changing the global c instead of the local one, because we accidentally called our argument d. Usually, a compiler with proper configuration will throw a warning at our face at that point, but that might not be the default configuration. Also, the unused result variable should yield a warning, but that's another issue.

format: plain


text: dc.creator Zhou, C. en_US dc.creator Balfour, W. J. en_US dc.creator Cao, J. en_US dc.creator Qian, C. X. W. en_US dc.date.accessioned 2006-06-15T19:05:25Z dc.date.available 2006-06-15T19:05:25Z dc.date.issued 1998 en_US dc.identifier 1998-RI-08 en_US dc.identifier.uri http://hdl.handle.net/1811/18968 dc.description $^{a}$ F. Illas, J. Rubio, J. canellas and J.M. Ri***, J. Chem. Phys., 93, 2603(1990) $^{b}$ P.B. Ar*** and J.L. Beauchamp, Acc. Chem. Res., 22, 315(1989) en_US dc.description Author Institution: Department of Chemistry, University of Victoria en_US dc.description.abstract Electronic transitions have been observed with LIF techniques in a supersonic molecular beam of He doped with $H_{2}$ and $D_{2}$ and laser-ablated Rh vapor. Bands of RhH have been found near 464.73 and 438.38 nm, which are assigned as (0,0) and (1,0) vibrational bands of a ${^{3}}\Delta_{3} - X^{3} \Delta_{3}$ electronic transition. There is a sudden disapperance of the rotational structure in the (1,0) band of RhH above $J^{\prime}=7$ and the spectra associated with higher vibrational levels in the excited states are missing. These observations are attributed to predissociation. Its onset agrees with an ab intio calculation of $22 664-23 955 cm^{-1a}$ and the estimate of $20 650 \pm 1 750 cm^{-1}$ from $thermochemistry.^{b}$ The RhH(0,0) band also shows irregular A-doubling. The corresponding (0,0) and (1,0) transitions in RhD appear at 463.40 and 443.02 nm. Analyses of the spectra indicate that the ground state of RhH is an inverted ${^{3}}\Delta$ state, which is believed to derive from the electronic configuration $\ldots \delta^3 \pi^{1} \sigma^{1}$ and provide the following RhH molecular constants($cm^{-1}: B^{\prime \prime}_{0}= 6.546[r^{\prime \prime}_{0}= 0.1610 nm], B^{\prime}_{0}=6.175, B^{\prime}_{1}= 5.823, \omega^{\prime \prime}_{e}= 1927, \omega^{\prime \prime}_{e}x^{\prime \prime}_{e}= 35.7, \omega^{\prime}_{e}=1645, \omega^{\prime}_{e}x^{\prime}_{e}= 174$. The observed ground state symmetry and internuclear distance agree with ab initio $predictions.^{a}$ Six additional bands have been found for RhD: near $445.15 nm(\Omega^{\prime} =3 - \Omega^{\prime \prime}=3), 428.05 nm(\Omega^{\prime} =3 - \Omega^{\prime \prime}=3)427.83 nm(\Omega^{\prime} =3 - \Omega^{\prime \prime}=3), 424.40 nm(\Omega^{\prime} =2 - \Omega^{\prime \prime}=3), 422.58 nm(\Omega^{\prime} =3 - \Omega^{\prime \prime}=3),$ and $409.24 nm(\Omega^{\prime} =4 - \Omega^{\prime \prime}=3)$. en_US dc.format.extent 153991 bytes dc.format.mimetype image/jpeg dc.language.iso English en_US dc.publisher Ohio State University en_US dc.title ELECTRONIC SPECTRA OF RhH AND RhD en_US dc.type article en_US


text:
# Show that $\mathbb{Z_3 x Z_4}$ is a cyclic group

Q. Show that $\mathbb{Z_3 x Z_4}$ is a cyclic group.

So my question is there a faster way besides listing all the elements and besides knowing the theorem.

Since the process I am doing is:

I know: $\mathbb{Z_3 x Z_4}=\{(0,0),(0,1),(0,2),(0,3),(1,0),(1,1),(1,2),(1,3),(2,0),(2,1),(2,2),(2,3)\}$

and I've been taking each element and figuring out the order such as:

$$(1,0): (1,0); (1,0)+(1,0)=(2,0);(2,0)+(1,0)=(0,0)$$ which is order 3.

and I believe I have to keep doing this until I find the element that gives me order 12.

but I realize that is kinda tedious. So my question is, is there a simpler way or would be it suggested to continue on the method I am doing.

• try $(1,1)$, strategy: don't pick elements with zeros.. – MAM Mar 14 '15 at 23:00

You can calculate the order of an element without listing every element. For example, you can show that $(1,0)$ has order $3$ and $(0,1)$ has order $4$.

So $(1,1)$ has order divisible by $3$, since the first element has order $3$. Similarly its order must be divisible by $4$. Hence, it must have order $12$ since $3,4$ are coprime and the order of the group is $12$.

This is a group theoretic way of phrasing the Chinese Remainder theorem.

To find an element of order $12$ don't check elements randomly: think about which elements might possibly be of order $12$. For example, if for $(x,y)\in \mathbb{Z}_3\times\mathbb{Z}_4$ one of the components is not a generator for it's group, you won't possible generate all $12$ different elements. So why don't you look at a pair $(x,y)$ where $x$ is a generator for $\mathbb{Z}_3$ and $y$ is a generator for $\mathbb{Z}_4$.

Taking $(1,1)$ in $\mathbb{Z_3 x Z_4}$, we have $12(1,1)=0$ and $n(1,1)\neq0$ if $n<12$. That is, it is cyclic.

This is the abstract version of the Chinese Remainder Theorem::

If $m$ and $n$ are two coprime integers, then $\mathbf Z/m\mathbf Z\times \mathbf Z/n\mathbf Z\simeq \mathbf Z/mn\mathbf Z$.

In the present case, consider the canonical morphism: \begin{align*} \varphi \colon\mathbf Z\ &\rightarrow \mathbf Z/3\mathbf Z\times \mathbf Z/4\mathbf Z\\ x&\mapsto (x\bmod 3,x\bmod 4) \end{align*} Bézout's identity for $3$ and $4$ is simply $4-3=1$. It is easy to see $\varphi$ is surjective. Indeed, if $(\bar a, \bar b)$ is an element of $\mathbf Z/3\mathbf Z\times \mathbf Z/4\mathbf Z$, we have: $$\varphi(4a-3b)=(4a-3b\bmod 3, 4a-3b\bmod 4)=(a\bmod 3, b\bmod 4)$$ since $4\equiv 1\mod 3$, $-3\equiv 1\mod 4$. Now $x\in \ker\varphi$ if and only if $x$ is divisible by both $3$ and $4$, i.e. $x$ is divisible by $12$, whence an isomorphism; $$\bar\varphi\colon \mathbf Z/12\mathbf Z\rightarrow \mathbf Z/3\mathbf Z\times \mathbf Z/4\mathbf Z.$$

This isomorphism proves $\mathbf Z/3\mathbf Z\times \mathbf Z/4\mathbf Z$ is cyclic, of order $12$.

The fastest "minimal computation" way:

$6(1,1) = (0,2) \neq (0,0)$

$4(1,1) = (1,0) \neq (0,0)$. Therefore, $(1,1)$ has order $12$ (thanks to Bill Dubuque).

• Note: even if you didn't know to test $(1,1)$, you could just test the $6$ elements $(a,b)$ with $a,b \neq 0$. So, $12$ computations at most (actually less, since we have $4$ elements of order $12$, so even if we hit the "bad" $2$ elements first, we'd hit success on the $3$rd try, so $6$ computations). – David Wheeler Mar 15 '15 at 1:37


text:
Hi, I am Martin Ueding, a physicist (Dr., M.Sc.), machine learning researcher and software developer.

Although I am German, most of the content on this website is in English as both science and programming is communicated mostly in English. Lately I have written a lot of traffic policy and cycling, which is in German.

Since 2011, I studied Physics at Bonn university. I have finished my Bachelor degree in 2014 and my Master thesis in 2017. My dissertation was finished in 2020. See the studies section for the study related material.

At the age of 13 I started programming with C. Then I looked into HTML and CSS, started to use PHP and then MySQL. Looking for something to write software with a nice user interface with, I came to Java. Then I looked into more languages like Bash, Python, JavaScript, GNU Octave, VimScript, Fish. From then on, I tried to do most things in either Python 3 or C++11, so that I only have two languages, which I know well. For my work I now use R and also picked up the Wolfram Language, personally I looked into Haskell. See my portfolio.

My most popular project are the thinkpad-scripts which I wrote to get all the screen and digitizer features working effortlessly on my ThinkPad. It is a collection of Python modules that take care of docking and screen rotation.

For several years now, I have been almost paperless. The main challenges are papers I get from other people and hand written notes. The former can be faced with a scanner, the latter was more interesting. I own a Wacom Tablet since long before I started to become paperless, but I never had a good software for note taking. Since I did not find one at first, I wrote jscribbe. After I was almost done with that, I discovered Xournal which I now use most of the time.

You can also find me on other platforms:

On Twitter one can often see people who have more to say than the character limit allows in a single tweet. They usually then reply to their own tweet and create a thread by doing so. One can feel that the medium isn't made for short articles. This is why I like my blog, I can just write as much text as I want. I can include more than four images. And I can structure the paragraphs like I want. People can share the URL as one tweet, or send me an e-mail discussing the whole post.

In order to take the rough edges off twitter threads, there are multiple apps to unroll these threads. This usually then looks like this:

The application replies with a link to an unrolled thread. One can then read it on a website where each tweet is turned into a paragraph. But one has to answer to the original tweet and people often don't check whether anyone else has used the app already. So one finds many more such posts:

# Lacking Uncertainty Estimations in Natural Language Processing Papers

My university background is physics, which is an empirical science. All measurements or derived quantities must be quoted with an error estimate. This should ideally include both a statistical and a systematic error. If you take a look at the paper from my thesis, you will find this table:

It contains the comparison of a certain quantity (pion scattering length) from various other publications and our result. There are uncertainties given, either as a combined value or as separate statistical and systematic ones. One result by the ETMC even has asymmetric systematic errors quotes. You can look at these numbers and figure out whether the result from that work lies within the error budget of the other works. The raw table isn't as meaningful as a plot, but you could create a plot from the table. And one can see that our result has a one standard deviation confidence interval of $[-0.0567, -0.0395]$, so it easily encompasses all previous work. Also it has the largest error of all results, so it is the least precise addition to the field. This is okay as it was just an auxiliary result and we weren't aiming for precision there.

In my new field, natural language processing (NLP), I cannot say the same thing. There are no error estimates whatsoever! And it really annoys me, you cannot really derive any conclusion from the data. Take for instance the paper on BERT. They show a table where they compare two variants of the BERT model with other language models in various tasks:

# Papiercontainer an der Siegburger Str.

An der Siegburger Straße standen bisher drei Altpapiercontainer auf Höhe der Integrierten Gesamtschule Bonn-Beuel. Karte von OpenStreetMap.org:

Dort ist aber ein geteilter Geh- und Radweg (Zeichen 241), sodass Autofahrer dort nicht parken dürfen. Sie taten es natürlich regelmäßig trotzdem, obwohl dort zwei Fahrstreifen für den Autoverkehr vorhanden sind. Immer wieder hatte ich also solche Situationen wie diese hier.

Der Autofahrer war sich sogar nicht zu blöd mir zu erklären, dass er auf der Fahrbahn gar nicht halten dürfe, und daher eben auf dem Radweg parken dürfte. Irgendwo müsste er ja schließlich parken um sein Altpapier zu entsorgen. Ich verabschiedete mich mit »Sie bekommen dann Post!« und fuhr weiter.

Auf Twitter habe ich mit Leuten diskutiert und herausgefunden, dass man auf der Fahrbahn tatsächlich nicht halten darf.

Ich habe immer wieder die gleichen Diskussionen beim Thema Verkehr. Daher habe ich jetzt einfach mal ein paar Dinge als Argumentationshilfe gesammelt.

# Obsidian Markdown

A while ago I have written about note-taking software. At the time the most promising candidates were Joplin and just flat Markdown files. A colleague has told me about Obsidian. It is an awesome note taking application as it satisfies all the needs that I have: It uses plain Markdown files to store the notes, there is on siloization into an opaque database. But it provides a file explorer to quickly switch between notes. It also has some gadgets like a link graph, but I haven't used these yet.

Other great features is HTML import from the clipboard, which makes copying snippets from webseites much easier. It also supports split windows, which can serve as editor, preview and outline panes in any combination. It also manages attachments by copying them into the notes directory. And one can have multiple note directories, which are called “vaults”.


text:
Home > Cannot Use > Cannot Use Classic Compiler

# Cannot Use Classic Compiler

As a point of order, if you leave both in the directory and try to do a build, the 1.4.1 version is used. Since it's not, that product you evaluated clobbered your 1.4 install and it might cause other problems later (not just in Eclipse). “„ Reply to this topic © 2016 Manning Publications awt.toolkit : sun.awt.windows.WToolkit java.vm.info : mixed mode java.version : 1.4.1_02 java.ext.dirs : c:\j2sdk\jre\lib\ext sun.boot.class.path : c:\j2sdk\jre\lib\rt.jar;c:\j2sdk\jre\lib\i18n.jar;c:\j2sdk\jre\lib\sunrsasig n.jar;c:\j2sdk\jre\lib\jsse.jar;c:\j2sdk\jre\lib\jce.jar;c:\j2sdk\jre\lib\ch arsets.jar;c:\j2sdk\jre\classes java.vendor : Sun Microsystems Inc. Report message to a moderator Re: ANT Compile Error in Eclipse: Modern compiler not found [message #117794 is a reply to message #117783] Mon, 17 November 2003 20:58 weblink

I have set the *SYS level JAVA_HOME > environment variable to /QIBM/ProdData/Java400/jdk13/. Could you tell which version of Ant you use and what is in your classpath. (Try Ant -version then you get the version an compile date of your Ant) >Is there That is to say Eclipse isn't using javac from the PATH but the Ant it launches most definitely is. Talk to your friends online with Yahoo! https://coderanch.com/t/107581/tools/error-classic-compiler

The error msg pointed to a javaw.exe in C:WINNTsystem32. Classic is 1.1 and 1.2. To verify its availability, Ant tries to load sun.tools.javac.Main. Regards.

• If you add it into your CLASSPATH, Ant should work okay.
• For Ant, modern compiler is anything 1.3 and above, so it should work.
• Stefan Stefan Bodewig at Nov 30, 2000 at 3:54 pm ⇧ Joe Faith wrote:I keep getting the error messageCannot use classic compiler, as it is not availablewhen trying to compile Java
• Also, if you're using the PDE to run Ant, PDE has its own source/class version settings in the preferences.
• I added the tools.jar for Java SDK 1.4.2 to Ant's classpath via the Window->Preferences menu.
• That is to say Eclipse isn't using javac from the PATH but the > Ant it launches most definitely is.
• I have ensured my classpath includes > %JAVA_HOME%/lib/tools.jar as well.... > Your classpath should not have %JAVA_HOME%/lib/tools.jar, in fact your classpath is best left empty.
• Your buildfile may causes changes in the behavior that is beyond Eclipse's control...but I have not seen your buildfile.
• At that point I realized my PATH environment variable had the Microsoft directories ahead of the java distribution directories.

ibm ! Messenger. Tony, I would check to make certain that %JAVA_HOME%/bin/javac exists and that the PATH environmental variable is set in your context and includes %JAVA_HOME%/bin . Use this link http://marc.theaimsgroup.com/?l=ant-user&r=1&w=2 Yours Stefan S [prev in list] [next in list] [prev in thread] [next in thread] Configure | About | News | Addalist | SponsoredbyKoreLogic Search:[]List[]Subjects[]Authors[]Bodies (mustpickalistfirst)

Post Reply Bookmark Topic Watch Topic New Topic programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums Forum: Ant, Maven I am using Eclipse 2.1.2. Ant file does not work in WSAD 5.1 with the following error. http://grokbase.com/t/ant/user/00by19415b/cannot-use-classic-compiler-as-it-is-not-available Total time: 1 second ____________________________________________ Report message to a moderator Re: ANT Compile Error in Eclipse: Modern compiler not found [message #117747 is a reply to message #117724]

A common solution is to > set the environment variable JAVA_HOME to your jdk directory. > > Total time: 1 second > > ____________________________________________ > > Report message to a moderator Perhaps JAVA_HOME does not point to the JDK Total time: 1 second -----Original Message----- From: Jesse Stockall [mailto:[email protected]] Sent: Monday, May 05, 2003 5:10 PM To: Ant Users List Subject: RE: The second message comes because Ant tries to fallback to the classic compiler. The best solution in my opinion is to start Eclipse using the -vm arg to point to a specific JDK install.

Check that your PATH is set up so that you're picking up the 'java' command (not javac) from the same JDK that you're getting tools.jar from. http://marc.info/?l=ant-user&m=97738282223257 As a result however, Eclipse no longer started. A common solution is to set the environment variable JAVA_HOME to your jdk directory. Thanks for any help Tony Don Stadler Ranch Hand Posts: 451 posted 12 years ago Poolman may be expecting the jsdk 1.4.

All Rights Reserved. [email protected] Matthew Sinclair at Dec 21, 2000 at 10:08 pm ⇧ Stefan,Ok one reason of this problem could be thattools.jar is missing in the classpath ...Almost as soon as I sent Did anybody have the same before? See iftools.jar is there and no typo occurred.The easiest way to ensure that Ant will pick up tools.jar is settingJAVA_HOME correctly and invoke Ant via its ant shell script BTW, noneed

The external Ant build works fine and building with Eclipse itself works fine. I haven't seen this error before but since it says "class version error", it could mean that you're trying to run a jar file from one JRE version (say, 1.4.2) using Anotherpossibility is that if you have set it, you've only set it as a shellvariable, rather than an actual environment variable (the difference between'set' and 'setenv'). You should set it to /usr/java (assuming that you've got the tree /usr/java/jre.....).

Please provide some more details: Value of %JAVA_HOME% Version of Ant, Value of %ANT_HOME% if you are running Ant 1.5.1 or greater, the output from 'ant -diagnostics' would be useful as I suspect it would do that even if you give Eclipse a JDK with the -vm switch -- have not tried that. Even though I defined JAVA_HOME-C:jdk1.3.1_09 and PATH C:jdk1.3.1_09in Can you help me ?

## Buildfile: build.xml init: idl: prepare: clean-jar: [delete] Deleting: C:\xindice\java\lib\xindice.jar [delete] Unable to delete file C:\xindice\java\lib\xindice.jar src: [echo] Compiling Source [javac] Compiling 324 source files to C:\xindice\java\classes BUILD FAILED file:c:/xindice/build.xml:123: Unable to

Xindice Build System -------------------- Building with classpath c:\j2sdk\lib\tools.jar;.\java\lib\ant.jar;.\java\lib\examples.jar;.\java\lib \infozone-tools.jar;.\java\lib\openorb-1.2.0.jar;.\java\lib\openorb_tools-1. 2.0.jar;.\java\lib\xalan-2.0.1.jar;.\java\lib\xerces-1.4.3.jar;.\java\lib\xi ndice.jar;.\java\lib\xml-apis-1.0.jar;.\java\lib\xmldb-sdk.jar;.\java\lib\xm ldb-xupdate.jar;.\java\lib\xmldb.jar Starting Ant... The external Ant build works fine and building with Eclipse itself > works fine. I decided to delete the 1.3.1 JRE. Is there somewhere that the mailing list archive can be searched?

This is what is invoked on your PC via ant.bat and it is this class that automatically adds tools.jar into your classpath. The conclusion is that the Ant Eclipse is using gets its javac from the PATH. Post Reply Bookmark Topic Watch Topic New Topic Similar Threads Classic Compiler error while running ant. We use WSDc 5.0 > to develop our project.

Page generated in 0.03877 seconds .:: Contact :: Home ::. The antscript doesn't use $JAVA_HOME to decide which 'java' to use to launch ant,it uses$PATH instead.-----Original Message-----From: faith [mailto:faith]On Behalf Of Joe FaithSent: Friday, 1 December 2000 3:11 AMTo: [email protected]: Does "jar tf /home/java/jdk1.2.2/lib/tools.jar" show sun.tools.javac.Main? Buildfile: build.xml init: idl: prepare: clean-jar: [delete] Deleting: C:\xindice\java\lib\xindice.jar [delete] Unable to delete file C:\xindice\java\lib\xindice.jar src: [echo] Compiling Source [javac] Modern compiler is not available - using classic compiler [javac] Compiling

The issue does seem to be ant related. Thanks for the help. “„ burnette (33) Offline Feb 6, 2004 @ 8:41 PM #6 Re: Modern compiler not found Great, I'd recommend though that you reinstall the latest JDK since C:\poolman-2.0.3\build>echo %JAVA_HOME% C:\jdk1.3 Why is ant throwing up this message. Using ant version > apache-ant-1.5.3-1.


text:
# Construction of Pie Chart

Now we will discuss about the construction of pie chart or pie graph. In brief let us recall about, what is a pie chart?

The pie chart is a pictorial representation of data relative to a whole. Each portion in the circle represent an element of the collected data. The pie chart represents the composition of various elements in a whole. The total value of the pie chart is always 100%.  Each portion in the circle shows a fraction or percentage of the total.

Pie chart is a circular graph which is used to represent data. In this :

Various observations of the data are represented by the sectors of the circle.

The total angle formed at the centre is 360°.

The whole circle represents the sum of the values of all the components.

The angle at the centre corresponding to the particular observation component is given by

If the values of observation/components are expressed in percentage, then the centre angle corresponding to particular observation/component is given by

How to construct a pie chart?

Steps of construction of pie chart for a given data:

Find the central angle for each component using the formula given on the previous page.

Draw a circle of any radius.

Draw a horizontal radius

Starting with the horizontal radius, draw radii, making central angles corresponding to the values of respective components.

Repeat the process for all the components of the given data.

These radii divide the whole circle into various sectors.

Now, shade the sectors with different colors to denote various components.

Thus, we obtain the required pie chart.

Here the pie chart shows the type of books preferred by the students of a class.

Given below is a pie chart showing the type of books preferred by the students of a class. Observe the chart and answer the questions given below.

(i) What fraction of students like Comic books?

Answer: The sector in the pie chart shows = $$\frac{1}{4}$$

(ii) What fraction of students like Story books?

Answer: The sector in the pie chart shows = $$\frac{1}{2}$$

(iii) Which 2 books have equal fraction of preference?

Answer: Poem and Puzzle books.

(iv) What fraction of students does not like story books?

Answer: $$\frac{1}{2}$$

(iv) Which type of book do you like to read?

Solved Example on Construction of Pie Chart/Pie Graph:

1. The following table shows the numbers of hours spent by a child on different events on a working day.

Represent the adjoining information on a pie chart

 Activity No. of Hours School 6 Sleep 8 Playing 2 Study 4 T. V. 1 Others 3

The central angles for various observations can be calculated as:

 Activity No. of Hours Measure of central angle School 6 (6/24 × 360)° = 90° Sleep 8 (8/24 × 360)° = 120° Playing 2 (2/24 × 360)° = 30° Study 4 (4/24 × 360)° = 60° T. V. 1 (1/24 × 360)° = 15° Others 3 (3/24 × 360)° = 45°

Now, we shall represent these angles within the circle as different sectors. Then we now make the pie chart:

2. The favourite flavours of ice-cream for the children in a locality are given in percentage as follow. Draw the pie chart to represent the given information

 Flavours % of Students Prefer the Flavours Vanilla 25 % Strawberry 15 % Chocolate 10 % Kesar-Pista 30 % Mango Zap 20 %

The central angles for various observations can be calculated as:

 Flavours % of Students Prefer the Flavours Measure of Central Angles Vanilla 25 % (25/100 × 360)° = 90° Strawberry 15 % (15/100 × 360)° = 54° Chocolate 10 % (10/100 × 360)° = 36° Kesar-Pista 30 % (30/100 × 360)° = 108° Mango Zap 20 % (20/100 × 360)° = 72°

Now, we shall represent these angles within a circle to obtain the required pie graph.

Questions and Answers on Construction of Pie Chart:

1. 80 girls were asked about their favourite sport? The collected information is given in the table. Read the information and label the graph.

 Sports Number of Girls Badminton 41 Tennis 9 Swimming 23 Volleyball 7

2. 100 students of a school were surveyed for their favourite activity. The information is represented in a pie chart as given below. Observe the chart and answer the questions given below.

(i) Which is the most favourite pastime activity of students?

(ii) How many students like music?

(iii) What percentage of students like to dance?

(iv) What percentage of students like to read books?

(i) Playing Outdoor games

(ii) 25

(iii) 12.5%

(iv) 12.5%

## You might like these

• ### Examples of Pictographs |Pictorial Representation|Pictograph Questions

Some sample examples of pictographs or pictorial representation are shown, how the objects are used to give information regarding mathematical data. Read the pictograph and gather the information

• ### Tally Marks | Tally Mark Represents Frequency | Use of Tally Marks

We will discuss here how to use Tally marks. To count the number of times a value of the variable appears in a collection of data, we use tally mark ( / ). Thus tally mark represents frequency. Observe the tally marks and the corresponding frequencies:

• ### Pictographs | Pictorial Representation | Pictorial Symbols | Symbols

In pictographs we learnt to recognize different things in our surroundings and to express the given information through pictorial symbols of different objects.

• ### Worksheet on Data Handling | Questions on Handling Data |Grouping Data

In math practice worksheet on data handling we will solve numerous types of questions on handling data, frequency distribution and on grouping data. Questions on frequency distribution

• ### Worksheet on Pictographs | Picture Graph Worksheets | Pictograph Works

In worksheet on pictographs, all grade students can practice the questions on data handling. We can present the given information in many ways. In pictograph the information is presented by using a picture as symbol. A pictograph has a title and a key.

• ### Bar Graph | Bar Chart | Interpret Bar Graphs | Represent the Data

We learn how to represent the data on the bar graph. Data can be represented by bars (like rectangle) whose lengths represent numerical values. One can use horizontal or vertical bars. Instead of rectangles one way even use line segments in such graphs.

• ### Worksheet on Bar Graph | Bar Graph Home Work | Questions on Bar Graph

In worksheet on bar graph we will practice different questions on representing the bar graph from the following data given in the questions. 1. The number of bed-sheets manufactured by a factory during five consecutive weeks is given below.

• ### Construction of Bar Graphs | Examples on Construction of Column Graph

Now we will discuss about the construction of bar graphs or column graph. In brief let us recall about, what is bar graph? Bar graph is the simplest way to represent a data. In consists of rectangular bars of equal width. The space between the two consecutive bars must be

• ### Worksheet on Bar Graphs | Bar Graphs or Column Graphs | Graphing Bar

In math worksheet on bar graphs students can practice the questions on how to make and read bar graphs or column graphs. Test your knowledge by practicing this graphing worksheet where we will

• ### Represent Data on a Bar Graph | Constructing Bar Graphs | Horizontal

We will learn how to represent data on a bar graph. We have seen how pictograph represents a pattern of information through numerical data in general. But such representation takes

• ### Concept of Pattern | Similar Patterns in Mathematics | Similar Pattern

Concept of pattern will help us to learn the basic number patterns and table patterns. Animals such as all cows, all lions, all dogs and all other animals have dissimilar features. All mangoes have similar features and shapes. Leaves of the same tree have similar pattern of

• ### 5th Grade Data Handling Worksheet | Double Bar graph | Line Graph

In 5th grade data handling worksheet, students can practice the questions on bar graph, line graph and pie chart. We represent the data in many ways. A graph is a pictorial representation of information. In pictograph the information is presented by using a picture as symbol

• ### Line Graph | How to Construct a Line Graph? | Solve Examples

Bar graphs are used to compare changes between different groups. Line graphs are used to compare two variables. The data which changes over a period of time can be displayed through a line graph. In line graph: ● Points are plotted on the graph related to two variables

• ### Double Bar Graph | Bar Graph |Solved Examples | Construction

Double bar Graph helps us to compare two data groups. For example the graph given below compares the number of boys and girls in classes I – V. Solve examples on Double bar Graph Observe the graph and answer the questions given below. Answer the given questions

• ### Reading Pictographs | Collection and Recording of Data | Tabulating of

Pictograph: Any information represented through pictures is called pictograph. Collection and Recording of Data: There are different ways of collecting and recording of information (data). We shall take up two examples of collection of data.

Statistics

From Construction of Pie Chart to HOME PAGE


text:
## Physics Version 2.1.2

For the discussion of the sciences. Physics problems, chemistry equations, biology weirdness, it all goes here.

Moderators: gmalivuk, Moderators General, Prelates

icdfeddie
Posts: 24
Joined: Sat Apr 05, 2008 4:04 am UTC

### Re: Physics Version 2.1.2

imatrendytotebag wrote:Note; to differentiate this from the previous comic, you might want to make the layout a little different. Maybe show it on a mac computer, or have the actual program running in the background (this gives you more opportunities for humor- ie you could have a little 'remove entropy' button etc.) or something else to give it a little pizazz.

I like, I like

phlip
Restorer of Worlds
Posts: 7573
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

### Re: Physics Version 2.1.2

Fixed glitch in tension routines... perfectly rigid poles and inelastic wires should now be usable as intended.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};void ┻━┻︵╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

UmbralRaptor
Posts: 201
Joined: Mon May 21, 2007 5:47 pm UTC
Location: Officially: KC area, Kansas, USA, Sol III
Contact:

### Re: Physics Version 2.1.2

Revamped back-end of nuclear subroutines; they should be substantially simpler now. In addition, we've implemented several examples of materials in the "island of stability" for the player-base to test.

(not posted in the patch message: this also messes with the liquid drop approximation, resonance peaks, and changes magic numbers...)
Why do you assume that I exist?

Zeltrix
Posts: 26
Joined: Fri Apr 18, 2008 4:37 am UTC
Location: Just beyond your field of vision, and closing in.

### Re: Physics Version 2.1.2

-Added ability to have any two contradictory theories battle to the death for deciding which is right (in the case of Relativity vs Quantum Mechanics low blows have been enabled due to inconclusive results last time).
-Perpetual motion generators available for a small fee.
-Heisenberg's uncertainty principal extended to include macroscopic items (looking at things now causes them to accelerate randomly, and measuring speed now makes things disappear).
Behold, the unimaginable power of pi

[imath]\pi[/imath]i

I am the pessimistic optimist: the glass is half full...
Spoiler:
...but I'm still going to die of dehydration in this freaking desert.

kevinbrown
Posts: 2
Joined: Wed Jun 04, 2008 8:16 am UTC

### Re: Physics Version 2.1.2

solving equations by adding new dimensions is now extended beyond string theory to include mechanics. (college freshmen rejoice).


text:
Damped harmonic oscillator

1. Nov 15, 2013

Derivator

Hi,

in this article:
http://dx.doi.org/10.1016/S0021-9991(03)00308-5 [Broken]
damped molecular dynamics is used as a minimization scheme.
In formula No. 9 the author gives an estimator for the optimal damping frequency:

Can someone explain how to find this estimate?

best,
derivator

Last edited by a moderator: May 6, 2017
2. Nov 15, 2013

AlephZero

You can find solutions of (7) in the form $$x = Ae^{(-\sigma + i\omega)t}$$ (where $\sigma$ and $\omega$ are real-valued functions of $\gamma$).

The amplitude, and therefore the energy, decreases faster as $\sigma$ increases. The maximum value of $\sigma$ is when $\gamma = 1$.

Note that when $\gamma > 1$, there are two solutions with different values of $\sigma$, and the energy decays "slowest" for the smaller solution.

Google for the solution of a damped single-degree-of-freedom oscillator, if you don't want to do the math yourself.

(9) looks like a version of the "logarithmic decrement" method of estimating the damping parameter, but using energy rather than the amplitude, and assuming that energy is proportional to amplitude squared, hence the square root in (9). Google "log dec".

Last edited: Nov 15, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook


text:
# Does the metric uniquely specifies the topology?

As far as I know, given a metric, we can always find the induced topology. However, I was wondering if this topology is unique. To put it another way, metric completely encodes the local data about the manifold but does it also completely encode the global data about the manifold? My main motivation for this question is to understand whether the Einstein field equation uniquely determines the topology of spacetime. I apologize if my question is basic. Thank you so much in advance.

• Multiple metrics induce the same topology, but multiple topologies are never induced by the same metric. To put it another way, (metrizable) topologies can be considered as equivalence classes of metrics, under an equivalence relation called topological equivalence. – Keshav Srinivasan May 12 at 19:29
• my main source of confusion is that the plain and torus both admit a flat metric. So given a flat metric, how can I decide whether the topology is a $T^2$ or $\mathbb{R}^2$? – B. T. May 12 at 19:50


text:
anonymous 3 years ago I have a question regarding the sum stuff with the big sigma.

1. anonymous

According to my book this is true: $\sum_{k=1}^{n}1=n$ Why is this sum n and not 1 or 0 since there is nothing to sum?

2. anonymous

yep

3. anonymous

there is. The summation notation means that 1 is added n times. So, it's 1+1+1+1+1+1+1+1...+1 {n times }=n

4. anonymous

or you could factorise quadratically but that would take way longer

5. anonymous

Why do I add the 1s since there is no index k?

6. anonymous

obviously

7. anonymous

$\sum_{k=1}^{n}1 = 1+1+1+1+1+......+1 =n$ if there is no k, then there is none. k=1 simply means you start from first terms. in this case,it's 1

8. anonymous

the k can be omitted, actually.

9. anonymous

How?

10. anonymous

$\sum_{k=1}^{n}=\sum_{1}^{n}$

11. anonymous

writing k is mostly a formality but in this case without the index, then we simply ignore it and just add up 1s n times

12. anonymous

Ok, now I think I get it. Thank you Shadowys for your help.

13. anonymous

You're welcome :)


text:
Next: Electric Potential and Electric Up: Electric Potential Previous: Electric Potential Energy

## Electric Potential

Consider a charge placed in an electric field generated by fixed charges. Let us chose some arbitrary reference point in the field. At this point, the electric potential energy of the charge is defined to be zero. This uniquely specifies the electric potential energy of the charge at every other point in the field. For instance, the electric potential energy at some point is simply the work done in moving the charge from to along any path. Now, can be calculated using Eq. (78). It is clear, from this equation, that depends both on the particular charge which we place in the field, and the magnitude and direction of the electric field along the chosen route between points and . However, it is also clear that is directly proportional to the magnitude of the charge . Thus, if the electric potential energy of a charge at point is then the electric potential energy of a charge at the same point is . We can exploit this fact to define a quantity known as the electric potential. The difference in electric potential between two points and in an electric field is simply the work done in moving some charge between the two points divided by the magnitude of the charge. Thus,
 (80)

where denotes the electric potential at point , etc. This definition uniquely defines the difference in electric potential between points and , but the absolute value of the potential at point remains arbitrary. We can therefore, without loss of generality, set the potential at point equal to zero. It follows that the potential energy of a charge at some point is simply the product of the magnitude of the charge and the electric potential at that point:
 (81)

It is clear, from a comparison of Eqs. (78) and (79), that the electric potential at point (relative to point ) is solely a property of the electric field, and is, therefore, the same for any charge placed at that point. We shall see exactly how the electric potential is related to the electric field later on.

The dimensions of electric potential are work (or energy) per unit charge. The units of electric potential are, therefore, joules per coulomb ( ). A joule per coulomb is usually referred to as a volt (V): i.e.,

 (82)

Thus, the alternative (and more conventional) units of electric potential are volts. The difference in electric potential between two points in an electric field is usually referred to as the potential difference, or even the difference in voltage,'' between the two points.

A battery is a convenient tool for generating a difference in electric potential between two points in space. For instance, a twelve volt (12V) battery generates an electric field, usually via some chemical process, which is such that the potential difference between its positive and negative terminals is twelve volts. This means that in order to move a positive charge of 1 coulomb from the negative to the positive terminal of the battery we must do 12 joules of work against the electric field. (This is true irrespective of the route taken between the two terminals). This implies that the electric field must be directed predominately from the positive to the negative terminal.

More generally, in order to move a charge through a potential difference we must do work , and the electric potential energy of the charge increases by an amount in the process. Thus, if we move an electron, for which C, through a potential difference of minus 1 volt then we must do joules of work. This amount of work (or energy) is called an electronvolt (eV): i.e.,

 (83)

The electronvolt is a convenient measure of energy in atomic physics. For instance, the energy required to break up a hydrogen atom into a free electron and a free proton is eV.

Next: Electric Potential and Electric Up: Electric Potential Previous: Electric Potential Energy
Richard Fitzpatrick 2007-07-14


text:
# Genus two mutant knots with the same dimension in knot Floer and Khovanov homologies

Genus two mutant knots with the same dimension in knot Floer and Khovanov homologies - Descarga este documento en PDF. Documentación en PDF para descargar gratis. Disponible también para leer online.

Descargar gratis o leer online en formato PDF el libro: Genus two mutant knots with the same dimension in knot Floer and Khovanov homologies
We exhibit an infinite family of knots with isomorphic knot Heegaard Floer homology. Each knot in this infinite family admits a nontrivial genus two mutant which shares the same total dimension in both knot Floer homology and Khovanov homology. Each knot is distinguished from its genus two mutant by both knot Floer homology and Khovanov homology as bigraded groups. Additionally, for both knot Heegaard Floer homology and Khovanov homology, the genus two mutation interchanges the groups in $\delta$-gradings $k$ and $-k$.

Autor: Allison Moore; Laura Starkston

Fuente: https://archive.org/


text:
# Quantum simulation with individual control of 53 qubits

In one of the largest quantum simulations ever performed, up to 53 trapped ion qubits have been used to simulate properties of many body magnetic interactions.  The qubits are each prepared with individual control, and measured in a single shot with nearly 100% efficiency.  This allows the observation of arbitrary correlation functions that cannot be calculated.  This restricted quantum computer becomes fully programmable and reconfigurable with straightforward modifications in the control lasers.


text: When a Base Is Mixed Up With a Metal:- When a base, get mixed up with a metal, the same happens … Chapter : 2.Acids, Bases And Salts Remaining lessons : It can be considered an acid in some reactions and a base in others. Salt solutions do not always have a pH of 7, however. Pure water, which is neutral, has a pH of 7. Reactions between strong acids and strong bases decompose more completely into hydrogen ions (protons, positively charged ions) and anions (negatively charged ions) in water. 2CH3CH2CO2H(aq) + Ca(OH)2(aq)→(CH3CH2CO2)2Ca(aq) +2H2O(l). Bases are substances that taste bitter and change the colour of red litmus paper to blue. It also soon became clear that many of these displacements could take place in either direction according to experimental conditions. As a general concept, if a strong acid is mixed with a weak base, the resulting solution will be slightly acidic. Be on the lookout for your Britannica newsletter to get trusted stories delivered right to your inbox. Updates? Acids are chemicals with a pH less than 7 that can donate a proton or H + ion in a reaction. For instance, NaOH (aq) +HCl (aq) -> NaCl (aq) + H_2O(l) In more detail, the ions of each dissociate in a solution, and bond together to form new compounds: usually a water and a salt. It was used to provide a modern definition of acids and bases, and followed from Arrhenius’s work with Friedrich Wilhelm Ostwald in establishing the presence of ions in aqueous solution in 1884. The reaction between acids and bases to give salts is known as neutralization reactions. If one of the reactants is present in great excess, the reaction can produce a salt (or its solution), which can be acidic, basic, or neutral depending on the strength of the acids and bases reacting with one another. When dissolved in water, the strong base sodium hydroxide ionizes into hydroxide and sodium ions: . A solution with a pH less than 7 is considered acidic, and a solution with a pH greater than 7 is considered basic, or alkaline. Search. We can write an expanded version of this equation, with aqueous substances written in their longer form: $\ce{H^{+} (aq) + Cl^{-} (aq) + Na^{+} (aq) + OH^{-} (aq) → Na^{+} (aq) + Cl^{-} (aq) + H_2O (l)}\nonumber$. React with active metals to liberate hydrogen. Our editors will review what you’ve submitted and determine whether to revise the article. As a general concept, if a strong acid is mixed with a … ... what does each hydrogen ion bond to form hydronium ions. Acids react with most metals to form a salt and hydrogen gas. As discussed previously, metals that are more active than acids can undergo a single displacement reaction. Water (H 2 O) can be both an acid and a base, depending on how you look at it. Change blue litmus to red. This is called neutralization. 2.1.4. For a weak acid and a weak base, neutralization is more appropriately considered to involve direct proton transfer from the acid to the base. If a strong base is mixed with a weak acid, the solution will be slightly basic. Chemical reactions between the acid and lead plates in the battery help make electricity to start the car. This is called the autoionization of water. Understanding the Acid-Base Chemical Reaction . Legal. We also acknowledge previous National Science Foundation support under grant numbers 1246120, 1525057, and 1413739. Acids undergo similar reactions. Acids and bases will generally react in water due to the dissociation of the ions. The acid and base have neutralized each other, and the acidic and basic properties are no longer present. They are also used in many household cleaning products, baking soda, and to make fertilizer for crops. Author of. So now we have $5$ $\ce{H3O+}$ and $5$ $\ce{OH-}$. [ "article:topic", "showtoc:no", "transcluded:yes", "source-chem-47560" ], https://chem.libretexts.org/@app/auth/2/login?returnto=https%3A%2F%2Fchem.libretexts.org%2FCourses%2FUniversity_of_British_Columbia%2FCHEM_100%253A_Foundations_of_Chemistry%2F14%253A_Acids_and_Bases%2F14.05%253A_Reactions_of_Acids_and_Bases, , we need two moles of propionic acid, CH, 14.4: Molecular Definitions of Acids and Bases, information contact us at info@libretexts.org, status page at https://status.libretexts.org. Next: Metal oxides react with acids to form its salt, Activity 2.7. The English word acid, the French acide, the German Säure, and the Russian kislota are all derived from words meaning sour (Latin acidus, German sauer, Old Norse sūur, and Russian kisly). what flavor do acids have. Inference/conclusion: A change in colour of PH indicator can indicate the completion of a reaction. Acids are chemical compounds that show, in water solution, a sharp taste, a corrosive action on metals, and the ability to turn certain blue vegetable dyes red. Write acid-base neutralization reactions. For example, the current Lewis model has the broadest definition of what an acid and base are, with the Brønsted-Lowry theory being a subset of what acids and bases are, … An acid in a water solution tastes sour, changes the colour of blue litmus paper to red, reacts with some metals (e.g., iron) to liberate hydrogen, reacts with bases to form salts, and promotes certain chemical reactions (acid catalysis). Acids and bases can help neutralize each other. Learn vocabulary, terms, and more with flashcards, games, and other study tools. Water can even react with itself to form acids and bases. A base that can dissolve in water is also called an alkali. Through a process known as hydrolysis, the ions produced when an acid and base combine may react with the water molecules to produce a solution that is slightly acidic or basic. Sulfuric acid and sodium hydroxide are among the products manufactured in largest amounts by the chemical industry, and a large percentage of chemical processes involve acids or bases as reactants or as catalysts. Strong acids have a higher concentration of hydrogen ions, and they are assigned values closer to 0. By signing up for this email, you are agreeing to news, offers, and information from Encyclopaedia Britannica. Anatomy and Physiology (9th Edition) Edit edition. Professor of Chemistry, University of Stirling, Scotland, 1967–75. Bases also react with certain metals, like zinc or aluminum, to produce hydrogen gas. Acids and bases are popular chemicals which interact with each other resulting in the formation of salt and water. For more information contact us at info@libretexts.org or check out our status page at https://status.libretexts.org. It is important to think of the acid-base reaction models as theories that complement each other. Acids turn litmus paper red, bases turn it blue. Almost every biological chemical process is closely bound up with acid–base equilibria in the cell, or in the organism as a whole, and the acidity or alkalinity of the soil and water are of great importance for the plants or animals living in them. They just react with the water molecules and balance each other out, giving us a neutral solution. Watch the recordings here on Youtube! Browse. Missed the LibreFest? However any solute that will dissolve both will cause a reaction. Fun Facts. If the reaction is allowed to run to completion, the end pH should be seven. $\ce{Zn(s) + 2NaOH (aq) + 2H2O(l) → Na2Zn(OH)4(aq) + H2 (g)}.\nonumber$. The H (+) cation … Start studying science acids and bases. A strong acid and base effectively neutralize each other, hence neutralization reactions. Get solutions The water forms from the combination of the H + ions from the acid and the OH - ions from the base. Double displacement reactions of this type are called neutralization reactions. It also includes similar processes that occur in molecules and ions that are acidic but do not donate hydrogen … Example $$\PageIndex{1}$$: Propionic Acid + Calcium Hydroxide. React with bases to neutralize their properties. When acids react with bases it forms salt and water Acid + base – salt + water. When a strong acid and a strong base are combined in the proper amounts—when $$[\ce{H^{+}}]$$ equals $$[\ce{OH^{-}}$$]\)—a neutral solution results in which pH = 7. The LibreTexts libraries are Powered by MindTouch® and are supported by the Department of Education Open Textbook Pilot Project, the UC Davis Office of the Provost, the UC Davis Library, the California State University Affordable Learning Solutions Program, and Merlot. Different reactions produce different results. CH3CH2CO2H(aq) + Ca(OH)2(aq)→(CH3CH2CO2)2Ca(aq) + H2O(l). Acid–base reaction, a type of chemical process typified by the exchange of one or more hydrogen ions, H+, between species that may be neutral (molecules, such as water, H2O; or acetic acid, CH3CO2H) or electrically charged (ions, such as ammonium, NH4+; hydroxide, OH−; or carbonate, CO32−). NaOH → Na + + OH − and similarly, in water the acid hydrogen chloride forms hydronium and chloride ions: . Let us know if you have suggestions to improve this article (requires login). Funded by Saskatchewan Educational Technology Consortium. Because there are two OH− ions in the formula for Ca(OH)2, we need two moles of propionic acid, CH3CH2CO2H, to provide H+ ions. Have questions or comments? The Reaction between Acids and Bases Acids react with bases to produce salt and water. Neutralisation is the reaction of an acid with a base that results in the pH moving towards 7. The Arrhenius definition of acid-base reactions, which was devised by Svante Arrhenius, is a development of the hydrogen theory of acids. Conversely, strong bases have higher concentrations of hydroxide ions, and they are assigned values closer to 14. Acids turn blue litmus paper red, and bases turn red litmus paper blue. Common acids and bases will react with each other and when they react completely, the products are usually a salt solution that isn't sour or bitter. Give an example of a neutral solution. This page was constructed from content via the following contributor(s) and edited (topically or extensively) by the LibreTexts development team to meet platform style, presentation, and quality: Peggy Lawson (Oxbow Prairie Heights School). Bases are chemical compounds that, in solution, are soapy to the touch and turn red vegetable dyes blue. $\ce{Zn(s) + 2HCl(aq) → ZnCl2(aq) + H2(g)}\nonumber$. Problem 17QC from Chapter 3: How do acids and bases react with each other when in solution? There are some factor to consider when looking at a an acid-base reaction. They all react with some water molecules of their own as well and create $5$ $\ce{OH-}$. Weaker acids and bases are closer to the pH value of 7 than their stronger counterparts. Through a process known as hydrolysis, the ions produced when an acid and base combine may react with the water molecules to produce a solution that is slightly acidic or basic. Salt solutions do not always have a pH of 7, however. When an acid and a base are combined, water and a salt are the products. The idea that some substances are acids whereas others are bases is almost as old as chemistry, and the terms acid, base, and salt occur very early in the writings of the medieval alchemists. Get a Britannica Premium subscription and gain access to exclusive content. In spite of their imprecise nature, these ideas served to correlate a considerable range of qualitative observations, and many of the commonest chemical materials that early chemists encountered could be classified as acids (hydrochloric, sulfuric, nitric, and carbonic acids), bases (soda, potash, lime, ammonia), or salts (common salt, sal ammoniac, saltpetre, alum, borax). NaOH + Hcl – Nacl + H 2 O. Conduct electricity. When mixed, acids and bases neutralize one another and produce salts, substances with a salty taste and none of the characteristic properties of either acids or bases. For instance, hydrochloric acid would react with sodium hydroxide to produce salt (sodium chloride) and water! Litmus paper is made from dyes derived from lichens; it is water-soluble, meaning it can be fully dissolved in water. Unless otherwise noted, LibreTexts content is licensed by CC BY-NC-SA 3.0. Both the ideas and the terminology of acid–base chemistry have permeated daily life, and the term salt is especially common. Write a balanced chemical equation for the reaction of aqueous propionic acid (CH3CH2CO2H) with aqueous calcium hydroxide [Ca(OH)2]. Have a sour taste. Read also: Metal carbonate reacts with acids to form carbon dioxide, Activity 2.5. They neutralize each other, two products are formed: water and salt. The word acid comes from a Latin word ‘acere’ which means ‘sour’ . Acid-base neutralization reactions are what make most cakes fluffy, because sometimes these reactions generate a gas that … This is a double displacement reaction, so the cations and anions swap to create the water and the salt. Those two don't react with each other, correct? For example the reaction of sodium hydroxide with hydrochloric acid. It also includes analogous behaviour of molecules and ions that are acidic but do not donate hydrogen ions (aluminum chloride, AlCl3, and the silver ion AG+). When an acid and a base react with each other, a neutralization reaction occurs, forming a salt and water. Bases react with acids to neutralize each other at a fast rate both in water and in alcohol. Litmus Test and Other Reactions. An acid–base reaction is a type of chemical reaction that involves the exchange of one or more hydrogen ions, H+, between species that may be neutral (molecules, such as water, H2O) or electrically charged (ions, such as ammonium, NH4+; hydroxide, OH−; or carbonate, CO32−). 2.1.6 Reaction of a Non-metallic Oxide with Base You saw the reaction between carbon dioxide and calcium hydroxide (lime water) in Activity 2.5. Acids, bases and alkalis are found in the laboratory and at home. This phenomenon suggested that acid–base reactions are reversible—that is, that the products of the reaction can interact to regenerate the starting material. First, it helps to understand what acids and bases are. Acids and bases can neutralise each other. For example, zinc metal reacts with hydrochloric acid, producing zinc chloride and hydrogen gas. In any sample of water some of the molecules perform acid– base reactions with each other. Metal oxides , on the other hand, are bases. In addition, it was found quite early that one acid could be displaced from a salt with another acid, and this made it possible to arrange acids in an approximate order of strength. By extension, only strong acids and bases completely dissociate and reliably complete such a reaction. Calcium propionate is used to inhibit the growth of molds in foods, tobacco, and some medicines. An acid–base reaction is a type of chemical reaction that involves the exchange of one or more hydrogen ions, H +, between species that may be neutral ( molecules, such as water, H 2 O) or electrically charged (ions, such as ammonium, NH 4 +; hydroxide, OH −; or carbonate, CO 3 2− ). The absence of any apparent physical basis for the phenomena concerned made it difficult to make quantitative progress in understanding acid–base behaviour, but the ability of a fixed quantity of acid to neutralize a fixed quantity of base was one of the earliest examples of chemical equivalence: the idea that a certain measure of one substance is in some chemical sense equal to a different amount of a second substance. How do acids and bases react with each other? Theoretical definitions of acids and bases, Dissociation of acids and bases in nonaqueous solvents, Keto–enol tautomerism, acid- and base-catalyzed, Dissociation constants in aqueous solution, https://www.britannica.com/science/acid-base-reaction, Indiana University Northwest - Acid/Base (Neutralization) Reactions, The Chemistry LibreTexts Library - Acid/Base Reactions. acids an base react they neutralize each other. The acid and base have neutralized each other, and the acidic and basic properties are no longer present. In our everyday lives, we use many compounds which scientists call acids. Salts are ionic compounds containing a positive ion other than H+ and a negative ion other than the hydroxide ion, $$\ce{OH^{-}}$$. Write a chemical reaction showing the acid–base reaction of two water molecules. Since metallic oxides react with acids to give salts and water, similar to the reaction of a base with an acid, metallic oxides are said to be basic oxides. One of the most remarkable chemical properties of acids and bases is that they react with each other to produce salts. $\ce{Ba(OH)2(s) + 2CH3CO2H (aq)→Ba(CH3CO2)2 (aq) + 2H2O(l)} \nonumber\nonumber$. 2.Acids, Bases And Salts. Strong acids and strong bases completely dissociate, so the reaction yields a solution with a neutral pH (pH = 7). ... the reaction of an acid and … Marisa Alviar-Agnew (Sacramento City College). Learn vocabulary, terms, and more with flashcards, games, and other study tools. Favorite Answer When an acid and a base are placed together, they react to neutralize the acid and base properties, producing a salt. Acids and bases react with each other to neutralize each other. The following video shows how red and blue litmus paper reacts to ammonia, hydrochloric acid, water, and baking soda. For example, sodium hydroxide reacts with zinc and water to form sodium zincate and hydrogen gas. The reaction between an acid and a base to give salt and water is called neutralization reaction; In this reaction the effect of a base is nullified by and acid and vice-Vera; Reaction of metallic oxides with acids After removing the spectator ions, we get the net ionic equation: $\ce{H^{+} (aq) + OH^{-} (aq) → H_2O (l)}\nonumber$. It also introduced the concept of equilibrium to acid–base chemistry: this concept states that reversible chemical reactions reach a point of balance, or equilibrium, at which the starting materials and the products are each regenerated by one of the two reactions as rapidly as they are consumed by the other. Acids were probably the first of these to be recognized, apparently because of their sour taste. It also includes similar processes that occur in molecules and ions that are acidic but do not donate hydrogen ions. Metal oxides formally contain the O 2- ion, which reacts with water to give a pair of OH - ions. HCl + H 2 O → H 3 O + + Cl − When the two solutions are mixed, the H The reaction that happens when an acid, such as $$\ce{HCl}$$, is mixed with a base, such as $$\ce{NaOH}$$: $\ce{HCl (aq) + NaOH (aq) → NaCl (aq) + H_2O (l)}\nonumber$. Acids are substances that contain one or more hydrogen atoms that, in solution, are released as positively charged hydrogen ions. It forms salt and water to give a pair of OH - ions from the and. Paper is made from dyes derived from lichens ; it is water-soluble meaning..., two products are formed: water and salt chemical reaction showing the acid–base reaction of an acid-base.! Of this type are called neutralization reactions products of the hydrogen theory of and... By CC BY-NC-SA 3.0 be recognized, apparently because of their own as well and $... Activity 2.7 is that they react with each other, hence neutralization.! And some medicines is that they react with each other and bases are hydrogen. Out our status page at https: //status.libretexts.org are the products sodium sulfate, also called an.! For this email, you are agreeing to news, offers, and bases more! Anions swap to create the water forms from the combination of the of. Activity 2.7 daily life, and they are assigned values closer to how do acids and bases react with each other... Aluminum, to produce salt ( sodium chloride ) and water to form carbon dioxide, Activity.... Metals to form hydronium ions and base have neutralized each other, products! Chloride forms hydronium and chloride ions: are more active than acids can undergo a single displacement reaction so. Term salt is especially common sodium sulfate, also called an alkali noted, LibreTexts content is licensed CC... Read also: metal oxides formally contain the O 2- ion, which was devised by Svante Arrhenius, a. Acid + Calcium hydroxide hence neutralization reactions that is occurring out our status at! An acid and a base react make fertilizer for crops as a general concept if. And gain access to exclusive content considered an acid with a neutral pH ( pH 7! And can accept a proton or H + ion in a reaction the acid–base reaction of sodium with. Chloride ) and water dioxide, Activity 2.7 substances that taste bitter and change colour... Assigned values closer to the pH value of 7 is especially common a higher of... Paper reacts to ammonia, hydrochloric acid, water and the term salt is especially common ions that are but! Just react with each other when in solution, are bases concentrations of hydroxide ions, and more with,! A single displacement reaction, so the cations and anions swap to create the water and.... A large part in industrial chemistry and in everyday life how do acids and bases react with each other it can be fully dissolved in water and base. 2- ion, which is neutral, has a pH less than 7 that can a. Solid barium hydroxide with hydrochloric acid Latin word ‘ acere ’ which means ‘ ’! Large part in industrial chemistry and in everyday life to give a pair OH. What happens when an acid and a base in others recognized, apparently because their... In solution { OH- }$ molecules down there that can donate a proton or produce OH-ion! For the reaction yields a solution with a base that results in the new with... Allowed to run to completion, the end pH should be seven { H3O+ } $from their theoretical,!, that the products solution, are released as positively charged hydrogen ions, if a strong and. Hydroxide with dilute acetic acid acid is mixed with a weak base, the product of acid-base! Even react with certain metals, like other salts, the product of an acid a... Blue litmus paper red, bases turn red litmus paper blue, however acid. And base effectively neutralize each other products, baking soda, and the and. Litmus paper red, bases turn red litmus paper red, bases turn red paper. Which reacts with hydrochloric acid, the end pH should be seven support under grant numbers 1246120,,... Turn red litmus paper reacts to ammonia, hydrochloric acid, water, which devised... Salt, is, like zinc or aluminum, to produce hydrogen gas looking at a fast rate both water. Britannica Premium subscription and gain access to exclusive content signing up for this email you... Charged hydrogen ions, and the acidic and basic properties are no longer present industrial chemistry and in life... Each other, two products are formed: water and the terminology of acid–base have! To news, offers, and the acidic and basic properties are no longer.. Base, depending on how you look at it acids have a pH of 7 than stronger..., are released as positively charged hydrogen ions, and bases acids react most! When an acid in some reactions and a base that results in the formation salt. Resulting in the battery help how do acids and bases react with each other electricity to start the car have suggestions to improve this article ( login! Encyclopaedia Britannica metals that are acidic but how do acids and bases react with each other not always have a pH of 7 red!, you are agreeing to news, offers, and to make fertilizer for crops$ \ce OH-... ( H 2 O ) can be both an acid and a base that can donate proton... Submitted and determine whether to revise the article as positively charged hydrogen ions, and.! Probably the first of these displacements could take place in either direction according to relative. For more information contact us at info @ libretexts.org or check out our status at!, bases turn red litmus paper to blue and create $5$ ${! Chemistry and in alcohol pH ( pH = 7 ) so the how do acids and bases react with each other of two water molecules and that!, on the lookout for your Britannica newsletter to get trusted stories delivered right to your inbox, only acids! Water molecules its salt, Activity 2.5 new year with a weak,! Ph less than 7 and can accept a proton or H + ion in a reaction help make to!$ \ce { OH- } $is neutral, has a pH of 7,.. Run to completion, the pH value of 7, however water due to the dissociation of the molecules acid–! Hydronium ions reacts with water to form sodium zincate and hydrogen gas with some molecules! Acids have a pH of 7 accept a proton or produce an OH-ion in a reaction to give how do acids and bases react with each other known. Chemistry, University of Stirling, Scotland, 1967–75 Activity 2.5 accept proton! Will dissolve both will cause a reaction: //status.libretexts.org pH value of 7 than their counterparts. Acid hydrogen chloride forms hydronium and chloride ions: other resulting in the pH value, to. For your Britannica newsletter to get trusted stories delivered right to your inbox, the! Calcium hydroxide otherwise noted, LibreTexts content is licensed by CC BY-NC-SA 3.0 displacement reactions this... Some other pH Indicators at Activity1.1 acid and a salt are the products paper is made dyes! Ions from the base H3O+ }$ molecules down there hydronium ions is neutral, has pH! Proton or produce an OH-ion in a reaction can dissolve in water, which is neutral has... Similar processes that occur in molecules and balance each other as well and create . Formed: water and a base that results in the formation of and. On some other pH Indicators at Activity1.1 swap to create the water and salt each! 1246120, 1525057, and more with flashcards, games, and the acidic and basic properties are longer! And turn red vegetable dyes blue contact us at info @ libretexts.org or check out our status page at:. 'S salt, is, like other salts, the strong base is mixed with a neutral (! H 2 O ) can be fully dissolved in water, the strong base sodium to. To regenerate the starting material or more hydrogen atoms that, in solution, are soapy to the moving. Under grant numbers 1246120, 1525057, and to make fertilizer for.! The terminology of acid–base chemistry have permeated daily life, and more with flashcards,,... More active than acids can undergo a single displacement reaction, so the and! And information from Encyclopaedia Britannica, strong bases completely dissociate, so the cations and anions to! Undergo a single displacement reaction, so the cations and anions swap to create water. The article water ( H 2 O of salt and hydrogen gas salt solutions do not always have a of... Many of these to be recognized, apparently because of their own as and. Of these to be recognized, apparently because of their own as and. Assigned a value between 0 and 14, the product of an acid in some reactions and base. Acids can undergo a single displacement reaction learn vocabulary, terms, information., is a double displacement reaction salt ( sodium chloride ) and water to give salts known. Soapy to the dissociation of the acid hydrogen chloride forms hydronium and chloride ions.! Are assigned values closer to 0 O ) can be fully dissolved in water first these... Word acid comes from a Latin word ‘ acere ’ which means ‘ sour ’ also! Understand what acids and bases are closer to 14 be both an acid a. Can accept a proton or H + ion in a reaction bases completely dissociate, so the and..., so the cations and anions swap to create the water forms from the base Edition... Form a salt and water will be slightly basic ( sodium chloride ) water! A value between 0 and 14, the end pH should be seven pH = 7 ) the and.


text:
My Math Forum Cost, revenue, and profit functions.

 Calculus Calculus Math Forum

 September 23rd, 2009, 06:13 PM #1 Joined: Sep 2009 Posts: 3 Thanks: 0 Cost, revenue, and profit functions. Please help- I am stumped. "A Company has a fixed cost of $20,000 and a production cost of$8 for each unit it manufactures. A unit sells for $10." a) What is the cost function? b) What is the revenue function? c) What is the profit function? d) Compute the profit (loss) corresponding to production levels of 7,000, 9,000 and 12,000 units, respectively. Thanks so much September 24th, 2009, 05:48 AM #2 Joined: Mar 2009 Posts: 318 Thanks: 0 Quote:  Originally Posted by kittykat616 Please help- I am stumped. To learn how to translate word problems into math, try here. Quote:  Originally Posted by kittykat616 "A Company has a fixed cost of$20,000 and a production cost of $8 for each unit it manufactures. A unit sells for$10." a) What is the cost function?
If they make 1 unit, what is the variable cost?

If they make 2 units, what is the variable cost?

If they make 3 units, what is the variable cost?

If they make x units, what is the variable cost?

Since the total cost is the fixed cost plug the variable cost, what function represents the cost C(x) for x units?

Quote:
 Originally Posted by kittykat616 b) What is the revenue function?
If they sell 1 unit, what is the revenue?

If they sell 2 units, what is the revenue?

If they sell 3 units, what is the revenue?

If they sell x units, what is the revenue?

What then is the function for the revenue R(x) from x units?

Quote:
 Originally Posted by kittykat616 c) What is the profit function?
Since profit is the difference between revenue and cost, what function represents the profit P(x) for x units?

Quote:
 Originally Posted by kittykat616 d) Compute the profit (loss) corresponding to production levels of 7,000, 9,000 and 12,000 units, respectively.
Plug the given x-values into your formula for P(x). Simplify to find the required values.

 Tags cost, functions, profit, revenue

,

### difference between profit function and cost function

Click on a term to search for related topics.
 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post ashory Calculus 1 October 21st, 2012 11:43 AM mathkid Calculus 8 October 11th, 2012 09:01 AM parise123 Calculus 2 October 25th, 2011 06:29 PM dalearyous Economics 2 December 8th, 2010 04:15 PM ArmiAldi Calculus 1 April 24th, 2008 04:14 PM

 Contact - Home - Top


text:
A cipher which uses a different encryption key every time, as long as the message. The key is XOR'ed with the message to render the cipher text which can then be XOR'ed with the same key to get the plain text.

364 questions
Filter by
Sorted by
Tagged with
52 views

Purpose of modulus in one-time pad?

I have the following question and don't really understand it. I thought OTP offers perfect secrecy, why do we need modulus? Can somebody please help me answer the question? $Z_n$ denotes the ring of ...
74 views

One time pad, Proof for a problem

We know 2 plaintexts of length L and 2 ciphertexts of length L(we don't know which one belongs which), assuming each given ciphertext is generated by encrypting one of the given plaintexts by XOR'ing (...
52 views

cracking a one time pad using key reuse

There is a one time pad which works as follows: given message "hello" and key "asdfg", it produces "hwoqu". It only works with the 26 english letters. The output is (h(7) ...
73 views

One-time pad without zero: proof check

I started learning cryptography and tried to work through this problem: consider one-time pad where $\mathcal{M}=\mathcal{C}=\{0,1\}^n$ and $\mathcal{K}=\{0,1\}^n\setminus 0^n$ (call this scheme $\Pi$)...
82 views

Derivating random numbers from random numbers

If I have a "truly random number" $K$ of $L$ bits (whatever "truly random" means... is it a value from a normal distribution a truly random number, or only uniform distributions ...
20 views

Decrypting two time pad using the Vigenère scheme

If I define that $$m\oplus k :=(m+k) \mod 26$$ where A is 0 and Z is 25. How do I efficiently/properly decrypt if I was given two-time pad ciphered texts? I know that $m_1\oplus m_2 = c_1\oplus c_2$. ...
1k views

Is OTP still perfectly secure if we limit message and key space

If we have a message space M {0,1,2,3,4,5,6} and likewise keyspace is K = {0,1,2,3,4,5,6} (generator choosen uniform keys k) We define our encryption to be the XOR of their bitwise rep on K and M ...
2k views

Why is mod calculation necessary in a one time pad encryption?

Considering the English alphabets to be encrypted why is the computation of mod 26 necessary after adding the pad to plain text. Is it just that it adds to another level of encryption or is it used so ...
129 views

What is the correct order of operations for one-time pad cipher when using subtraction and mod 10 arithmetic?

What would be the proper order of operations for OTP encryption/decryption when using subtraction and mod 10? E.g. P - K = C or K - P = C Most of the sources I have seen do not cover this topic or I ...
65 views

What is a ciphertext only attack and how OTP is unbreakable using this attack

I was wondering that what actually is cipherText-only attack and how the One Time Pad Encryption cant be broken by this attack?
114 views

I have been messing around with cryptography (for recreational use), and I created my own one-time-pad encryption script in C. Now, with that being said, I freely admit that I am by no means a ...
41 views

Securing counter value for OTP [closed]

I'm working on a project that needs an OTP based on counter value and needs some advice. Suppose we encrypt the counter value C in this way and let's say our sending packet is P = AES(key,C). If ...
74 views

Combining ECC and AES for a Web Chat system

I am working on a portable secure chat via desktop or mobile, which adopts OTP plus asymmetric encryption. The idea goes like this: Suppose that Alice and Bob are clients, and the server is run by ...
71 views

Multiplication encryption with a small number

Given a big number $x$(1024 bits) and a large prime $N$($N>x$), I want to encrypt it with a smaller number $y$(128 bits). $$Enc(x) = xy \mod{N}.$$ Is it safe? If not, how do I evaluate its leakage?
92 views

Using $key^{th}$ multiple of $\pi$ as a one-time pad

With a key $k$ of sufficient length, say 128 bits, is it possible to use $k^{th}$ multiple of $\pi$ as a one-time pad? Please enlighten on the security as well as practical aspects (only if secure of ...
208 views

AES or One-time-pad for encrypting a single 128bit block?

I just started my network security course and came across the below question. Could some one help me here. User A wish to send a 128-bit secret message, S, to user B. As the preliminary step, both A ...
336 views

30 views

Are there any known problems performing a One-time pad with 2 keys stored separately - AKA 2 part Symmetric key exchange over TLS

If this is something that already has a name, please tell me to look at that, but I have not been able to find one yet. I am considering this process for storing some data securely. I want to ...
151 views

How many perfect secrecy systems are there?

How many non-trivial*, interesting perfect secrecy systems are there other than the one-time-pad? Does it seem that the one-time-pad and perfect secrecy are synonymous, but are there any other ...


text:
1. ## Partial Derivative Problem

I have two functions
r = g (x,y)
s = h (x, y)
so its given that

x = r^3 - s
y = s^3 -r

g(0,0) = h(0,0) = 1

partial derivitives (sorry wrong notation): dg/dx, dh/dy and d^2g/dx^2
All at 0,0

Thanks, any help would be appreciated

2. Originally Posted by viraj
I have two functions
r = g (x,y)
s = h (x, y)
so its given that

x = r^3 - s
y = s^3 -r

g(0,0) = h(0,0) = 1

partial derivitives (sorry wrong notation): dg/dx, dh/dy and d^2g/dx^2
All at 0,0

Thanks, any help would be appreciated
Use the chain rule here..

For $\frac{\partial g}{\partial x}$, we know by the chain rule that $\frac{\partial g}{\partial x}=\frac{\partial g}{\partial r}\cdot\frac{\partial r}{\partial x}+\frac{\partial g}{\partial s}\cdot\frac{\partial s}{\partial x}$

We can figure out that $\frac{\partial g}{\partial r}=1$.

To find $\frac{\partial r}{\partial x}$, use partial implicit differentiation: $x=r^3-s\implies 1=3r^2\frac{\partial r}{\partial x}\implies \frac{\partial r}{\partial x}=\frac{1}{3r^2}$

We also can figure out that $\frac{\partial g}{\partial s}=0$. We can disregard the $\frac{\partial s}{\partial x}$ term, since it will end up disappearing.

Thus, we now see that $\frac{\partial g}{\partial x}=\left(1\right)\cdot\left(\frac{1}{3r^2}\right)= \frac{1}{3r^2}$

Since, $r=g(x,y)$, we see that $\frac{\partial g}{\partial x}=\frac{1}{3(g(x,y))^2}$

Now evaluate it at (0,0). You should end up with $g_x(0,0)=\frac{1}{3(g(0,0))^2}=\frac{1}{3(1)^2}=\c olor{red}\boxed{\frac{1}{3}}$

---------------------------------------------------------------------------------------

Try to find $\frac{\partial h}{\partial y}$ using the same technique as I used above.

---------------------------------------------------------------------------------------

For finding $\frac{\partial^2g}{\partial x^2}$, recall that by the chain rule, we have $\frac{\partial^2g}{\partial x^2}=\frac{\partial g}{\partial r}\cdot\frac{\partial^2r}{\partial x^2}+\frac{\partial^2 g}{\partial r^2}\cdot\left(\frac{\partial r}{\partial x}\right)^2$ (I think I have this correct...if not, feel free to state what it should be)

Follow the same process for this one as well.

Does this make sense?

--Chris

3. ## Chain Rule

I don't think I understand the Chain Rules yet. Will go some reading and find out the exact theorem when it comes to partial derivatives


text:
# Tensor product of dg-modules in the framework of dg categories

Let $\mathcal{A}$ and $\mathcal{B}$ be two dg categories, and let $M \in \text{Mod}_{\mathcal{B}}^{\mathcal{A}}$ be a $\mathcal{A}$-$\mathcal{B}$ bimodule. In many references in the framework of dg-categories, the following 'tensor functor' is mentioned $$- \otimes_{\mathcal{A}}M: \text{Mod}_\mathcal{A} \rightarrow \text{Mod}_\mathcal{B}$$ but none of them give a concrete definition and proof of the Quillen adjunction to $\text{Hom}_{\mathcal{B}}(M,-)$, which makes me confused.

In this paper Relative Calabi-Yau structures, $- \otimes _{\mathcal{A}} M$ is defined as the left Kan extension of $M$ along enriched Yoneda embedding $Y: \mathcal{A} \rightarrow \text{Mod}_{\mathcal{A}}$ without reasons for the existence of this Kan extension.

I want to know more details about the right definition of this functor.

• Aren't these things cocomplete? In this case, the Kan extension will exist. – user40276 Sep 1 '17 at 23:15


text:
/ / / / /

# Idea to approximate Gibbs posterior means

Consider the statistical learning framework where we have data $X\sim Q$ for some unknown distribution $Q$, a model $\Theta$ and a loss function $\ell_\theta(X)$ measuring a cost associated with fitting the data $X$ using a particular $\theta\in\Theta$. Our goal is to use the data to learn about parameters which minimize the risk $R(\theta) = \mathbb{E}[\ell_\theta(X)]$. Here are two standard examples.

Density estimation. Suppose we observe independent random variables $X_1, X_2, \dots, X_n$. Here the model $\Theta$ parametrizes a set $\mathcal{M} = {p_\theta : \theta \in \Theta }$ of probability density functions (with respect to some dominating measure on the sample space), and our loss for $X = (X_1, \dots, X_n)$ is defined as $\ell_\theta(X) = - \sum_{i=1}^n \log p_\theta(X_i).$ If, for instance, the variables $X_i$ are independent with common distribution with density function $p_{\theta_0}$ for some $\theta_0 \in \mathbb{\Theta}$, then it follows from the positivity of the Kullback-Leibler divergence that $\theta_0 \in \arg\min _ \theta \mathbb{E}[\ell _ \theta(X)]$. That is, under identifiability conditions, our learning target is the true data-generating distribution.

If the model is misspecified, roughly meaning that there is no $\theta_0\in \Theta$ such that $p_{\theta_0}$ is a density of $X_i$, then our framework sets up the learning problem to be about the parameter $\theta_0$ which is such that $p_{\theta_0}$ mininizes the Kullback-Leibler divergence between $p_{\theta_0}$ and the true marginal distribution of the $X_i$’s.

Regression. Here our observations take the form $(Y_i, X_i)$, the model $\Theta$ parameterizes regression functions $f_\theta$ and we can consider a sum of squared errors loss $\ell_\theta(X) = \sum_{i=1}^n(Y_i - f_\theta(X_i))^2.$

### Gibbs posterior distributions

Gibbs Learning approaches this problem from a pseudo Bayesian point of view. While typically a Bayesian approach would require the specification of a full data-generating model, here we replace the likelihood function by the pseudo-likelihood function $\theta \mapsto e^{-\ell_\theta(X)}$. Given a prior $\pi$ on $\Theta$, the Gibbs posterior distribution is then given by $\pi(\theta \mid X) \propto e^{-\ell_\theta(X)} \pi(\theta)$ and satisfies $\pi(\cdot \mid X) \in \text{argmin}_{\hat \pi} \left\{ \mathbb{E}_{\theta \sim \hat \pi}[\ell_\theta(X)] + D_{\text{KL}}(\hat \pi \mid \pi) \right\}$ whenever these expressions are well defined.

In the context of integrable pseudo-likelihoods, the above can be re-interpreted as a regular posterior distributions built from density functions $f _ \theta(x) \propto e^{-\ell _ \theta(x)}$ and with a prior $\tilde \pi$ satisfying $\frac{d\tilde \pi}{d\pi}(\theta) \propto \int e^{-\ell_\theta(x)}\,dx =: c(\theta).$ However, the reason we cannot apply standard asymptotic theory to the analysis of Gibbs posterior is that the quantity $c(\theta)$ will typically be sample-size dependent. That is, if $X=X^n=(X_1, X_2, \dots, X_n)$ for i.i.d. random variables $X_i$ and if the loss $\ell_\theta$ separates as the sum $\ell_\theta(X) = \sum_{i=1}^nl_{\theta}(X_i),$ then $c(\theta) = \left(\int e^{-l_\theta(x_1)} \, dx_1\right)^n$. This data-dependent prior, tilting $\pi$ by the function $c(\theta)^n$, is what allows Gibbs learning to target general risk-minimizing parameters rather than likelihood Kullback-Leibler minimizers.

Some of my ongoing research, presented as a poster at the O’Bayes conference in Warwick last summer, focused on understand the theoretical behaviour of Gibbs posterior distributions. I studied the posterior convergence and finite sample concentration properties of Gibbs posterior distributions under the large sample regime with additive losses $\ell_\theta^{(n)}(X_1, \dots, X_n) = \sum_{i=1}^n\ell_\theta(X_i)$. I’ve attached the poster (joint work with Yu Luo) below and you can find the additional references here.

Note that this is very preliminary work. We’re still in the process of exploring interesting directions (and I have very limited time this semester with the beginning of my PhD at Duke).

### Interpolating between Empirical risk minimization and model averages

An important (both useful and somewhat annoying) feature of Gibbs posterior distributions is that they depend on the scale at which the losses are specified. That is, if considering the alternative losses $\tilde \ell_\theta(X) = \eta \ell_\theta(X)$ for some $\eta > 0$ yields a completely different Gibbs posterior distribution. As $\eta \rightarrow \infty$, we can expect the posterior distribution to converge to the empirical risk minimizer (if it exists), whereas for small $\eta$, the posterior distribution should be more vague. Choosing this scale is an open problem for which a few interesting solutions have been recently proposed.

Ok, enough background material. Let’s get to the meat of this post.

## Approximating Gibbs posterior mean computation (an early idea)

I think (even though I have no precise idea yet) that there is an interesting relationship between the the choice of the scale of the loss functions previously mentionned, the process of iterating Gibbs posterior computation and the gradient descent algorithm used to compute empirical risk minimizers.

What I mean by iterating Gibbs posterior computation is the following: we start with a prior $\pi = \pi_0$, compute the posterior $\pi_1 = \pi(\cdot \mid X)$, then compute the posterior $\pi_2$ obtained by using the same data and by using $\pi_1$ as a prior, and etc. I’ll refer to this as iterated Gibbs. I suspect (although I haven’t checked anything) that this sequence $\pi_n$ converges to a point mass at the empirical risk minimizer, under some assumptions.

This idea came from a talk by Joan Bruna I attended last Wednesday at Duke. They used something similar to this iterated Gibbs method as a “proximal update” step in a gradient descent algorithm, although I’ll have to look more deeply into their results to understand everything they’ve done (the talk was in a statistical physics framework which I’m less familiar with).

The cool thing would be if we were able to use only a few steps of iterated Gibbs, with scaled down loss functions, as an approximation to the Gibbs posterior distribution we care about. Each of these iterated Gibbs step could further be approximated by a few steps of gradient descent initialized following the relevant “prior” distributions. This could be interpreted as (very roughly) approximate Bayes while being very fast and providing some of the benefits of model averaging and incorporating prior information.

This is something I’ll try to look into. I’ll update this post as I either make progress or discover how this doesn’t work.