Everything posted by Dhamnekar Win,odd
-
C program could not be executed at Windows command prompt
I have downloaded and installed ' C c-programs application from Windows store. I copied one program named 'Days Convertion' from it to my Notepad++ and saved it as c source file in the Documents folder. When I tried to compile it using gcc, gcc said unable to find the file. How can I fix this error? The c program is as follows: /* Write a c program to convert given number of days to a measure of time * given in years, weeks and days. For example 375 days is equal to 1 year * 1 week and 3 days (ignore leap year) */ #include stdio.h #define DAYSINWEEK 7 void main() { int ndays, year, week, days; printf("Enter the number of days\n"); scanf("%d",&ndays); year = ndays/365; week = (ndays % 365)/DAYSINWEEK; days = (ndays%365) % DAYSINWEEK; printf ("%d is equivalent to %d years, %d weeks and %d days\n", ndays, year, week, days); } /*----------------------------------------------- When I tried to compile it using gcc at windows command prompt, I got the following error several times. After giving this command at command prompt, 'DaysConvertion.c' file disappeared from the Documents folder. How can I fix this error?
-
How to debug the Java program that uses the Monte Carlo method to approximate the double integral?
Yes. I think you are correct because as per your suggestion, I modified my Java program and I got the correct answer as given by author i-e 0.705. The modified java program and its new output is given below: //Program to approximate the double integral of f(x,y)=e^xy over the //region bounded by x=-1, x=1, y=0, and y=x^2 public class montecarlo6 { public static void main(String[] args) { //Get the number N of random points as a command-line parameter int N = Integer.parseInt(args[0]); double x = 0; //x-coordinate of a random point double y = 0; //y-coordinate of a random point double f = 0.0; //Value of f at a random point double mf = 0.0; //Mean of the values of f double mf2 = 0.0; //Mean of the values of f^2 for (int i=0;i<N;i++) { //Get the random coordinates x = 1 * Math.random() ; //x is between 1 and 0 y = 1 * Math.random() ; //y is between 0 and 1 if (y < Math.pow(x,2)) { //the point is in the region f = Math.exp(x*y); // Value of the function mf = mf + f; //Add to the sum of the f values mf2 = mf2 + f*f; //Add to the sum of the f^2 values } x = -1 * Math.random() ; //x is between -1 and 0 y = Math.random() ; //y is between 0 and 1 if (y < Math.pow(x,2)) { //the point is in the region f = Math.exp(x*y); // Value of the function mf = mf + f; //Add to the sum of the f values mf2 = mf2 + f*f; //Add to the sum of the f^2 values } } mf = mf/N; //Compute the mean of the f values mf2 = mf2/N; //Compute the mean of the f^2 values System.out.println("N = " + N + ": integral = " + vol()*mf + " +/- " + vol()*Math.sqrt((mf2 - Math.pow(mf,2))/N)); } //The volume of the rectangle [-1,1]x[0,1] public static double vol() { return 1*1; } } The new program's output:
-
How to debug the Java program that uses the Monte Carlo method to approximate the double integral?
Write a program that uses the Monte Carlo method to approximate the double integral [math] \displaystyle\iint\limits_R e^{xy}dA [/math] where [math] R= [-1,1] \times [0, x^2][/math]. Show the program output for N = 10, 100, 1000, 10000, 100000 and 1000000 random points. My attempt: //Program to approximate the double integral of f(x,y)=e^xy over the //region bounded by x=-1, x=1, y=0, and y=x^2 public class montecarlo5 { public static void main(String[] args) { //Get the number N of random points as a command-line parameter int N = Integer.parseInt(args[0]); double x = 0; //x-coordinate of a random point double y = 0; //y-coordinate of a random point double f = 0.0; //Value of f at a random point double mf = 0.0; //Mean of the values of f double mf2 = 0.0; //Mean of the values of f^2 for (int i=0;i<N;i++) { //Get the random coordinates x = Math.random() ; //x is between 0 and 1 x = -1 * Math.random() ; //x is between -1 and 0 y = Math.random(); //y is between 0 and 1 f = Math.exp(x*y); // Value of the function mf = mf + f; //Add to the sum of the f values mf2 = mf2 + f*f; //Add to the sum of the f^2 values } mf = mf/N; //Compute the mean of the f values mf2 = mf2/N; //Compute the mean of the f^2 values System.out.println("N = " + N + ": integral = " + vol()*mf + " +/- " + vol()*Math.sqrt((mf2 - Math.pow(mf,2))/N)); } //The volume of the rectangle [-1,1]x[0,1] public static double vol() { return 2*1; } } Program Output is as follows: Correct integral =0.705; My Java program showed a integral 1.596 which is wrong, so my program is also wrong. How do I debug this program?
-
Maximization using Lagrange Multipliers
- Maximization using Lagrange Multipliers
- Normality computations
Are these above normality computations correct? If yes how? I don't understand these computations. Any chemistry help will be accepted.- Computations of a cell or solution potentials
Answer to question(d): Co3+ + V2+ β Co2+ + V3+ Defined redox couple is Co3+/Co2+ system [math] [Co^{2+}] = \frac{0.0050 mol}{0.200L} =0.025 M, [Co^{3+}]= \frac{0.010 mol}{0.200 L}=0.050 M, E_{sol}= E^{\circ}_{Co} -\frac{0.059}{n} \log{\frac{[Co^{2+}]}{[Co^{3+}]}} = 1.82 V - \frac{0.059}{1}\log{\frac{[0.025]}{[0.050]}} =1.84 V [/math]- Computations of a cell or solution potentials
If I write the balanced equation as 2VO2+ + Zn0 + 2H+ β 2VO2+ + Zn2+O-2 + H2O Is this correct?- Computations of a cell or solution potentials
Hi, Thanks for finding out the fault in my answer. Now, I rewrite the corrected balanced reaction 2VO2+ + Zn0 + 4H+ β 2VO2+ + Zn2+ + 2H2O- Computations of a cell or solution potentials
I am doubtful about my answer to (d). My attempt to answer (d): Reduction: E = EΒ°AgCl - [math]\frac{0.059}{n} \log {[Cl^-]} = 0.22 V - \frac{0.059}{1} \log{[0.20]} = 0.26 V[/math] Oxidation: E= EΒ°TiO2+ - [math]\frac{0.059}{n} \log {\frac{[Ti^{3+}]}{[Ti^{2+}] [H^+]^2}} [/math] =[math] 0.10 V - \frac{0.059}{1}\log {\frac{[0.010]} {[0.20][0.0020]^2}}= -0.14 V [/math] Ecell = Ered - Eox = 0.26 V - (-0.14 V) = 0.40 V Is this answer correct?- Computations of a cell or solution potentials
I want to correct my answer to (a) The balanced reaction is 2VO2+ + Zn0 + 2H+ β 2VO2+ + Zn2+ + H2O Answer to (c) Reduction: [math]E = E^{\circ}_{Ag} - \frac{0.059}{n}\log{ \frac{1}{[Ag^+]}}= 0.80 V - \frac{0.059}{1} \log{\frac{1}{[0.035]}} = 0.71 V[/math] Oxidation: [math]E= E^{\circ}_{Fe} - \frac{0.059}{n} \log {\frac{[Fe^{2+}]}{[Fe^{3+}]}}= 0.77 V - \frac{0.059}{1} \log{\frac{[0.0010]}{[0.010]}} = 0.83 V[/math] Ecell = Ered - Eox = 0.71 - 0.83 = -0.12 V- Computations of a cell or solution potentials
My answers (a) The balanced reaction equation is 2VO2+ + 3Zn + H2O β 3ZnO + 2VO + 2H+ [math]E^{\circ}_{rxn} = E^{\circ}_{VO_2^+} - E^{\circ}_{Zn} = 1.00 V - (-0.76) V = 1.76 V [/math] (b) [math] E = E^{\circ}_{Cu} - \frac{0.059}{n} \log \frac{1}{[Cu^{2+}]}[/math] [math] E= 0.34 V - \frac{0.059}{2}\log \frac{1}{[0.10]}= 0.31 V [/math] I am working on other questions. Any chemistry help will be accepted.- Indicators for Acids Titration
1)In the titration of 0.010 M HNO3 (Nitric acid), the reaction equation is NaOH + HNO3 β NaNO3 + H2O. At the equivalence point, [NaNO3] = 0.005 M. At the equivalence point, equal volume of hydroxide solution have been added to the acid solution and all of the hydronium ions resulting from HNO3 have been converted to water. The solution at this point is simply an aqueous solution of sodium nitrate. Na+ + OH- + H3O+ + (NO3)- β 2H2O + Na+ + (NO3)-. Since neither sodium ions nor nitrate ions reacts with water, the solution is neither acidic nor basic; that is [H3O+] = [OH-] = 10-7 M. pH at the equivalence point is therefore 7.0 Indicator such as Phenol red (C19H14O5S) must be used which can respond to a pH of 7, the exact pH at the equivalence point. 2) In the titration of 0.010 M of ClCH2COOH (Chloroacetic acid), the reaction equation is ClCH2CO2- + H2O β ClCH2CO2H + OH- x = [OH-] = [ClCH2CO2H] ; 0.0050 - x = [ ClCH2COO-]; Kb = [math] \frac {x^2}{0.0050 - x}= \frac {K_w}{K_a}= \frac {10^{-14}}{1.4 \times 10^{-3}}= 7.1 \times 10 ^{-12} [/math] x= 1.9 Γ 10-7 M = [OH-]; pOH = -log(1.9 Γ 10-7 ) =6.72 ; pH =7.28. Indicator such as Phenol red (C19H14O5S) must be used which can respond to a pH of 7.28, the exact pH at the equivalence point. 3) In the titration of 0.010 M of O2NC6H4OH (o-nitrophenol), the reaction equation is O2NC6H4O- + H2O β O2NC6H4OH + OH-. x= [OH-] = [ O2NC6H4OH] and 0.0050 - x = [O2NC6H4O-]; Kb = [math] \frac{x^2}{0.0050 - x}= \frac{K_w}{K_a}= \frac{10^{-14}}{6.8 \times 10^{-8}} = 1.4 \times 10^{-7} [/math] x = 2.6 Γ 10-5 M ; pOH = -log (2.6 Γ 10-5 ) = 4.58; pH = 9.42 Indiactor such as Phenolphthalein must be used- Indicators for Acids Titration
The following question is related to original question to some extent. Hence I am asking here.βΊοΈ What is the explanation for the following acid-base behavior of Methyl Orange, an Indicator? I am working on the original question. Any Chemistry help will be accepted.- Fermi-Dirac statistics and Maxwell-Boltzmann statistics
Please read 'Answer to question (b) assumes Maxwell-Boltzmann statistics. But how to show that the probability of each distinguishable distribution is [math] \frac {1} {n*N^r} [/math] ?' What is meaning of Note given?- Indicators for Acids Titration
How to choose indiacator here for these above mentioned Acids titation? Is the below-given chemical compound structure of 4- nitrophenol same as given in the above question?- Fermi-Dirac statistics and Maxwell-Boltzmann statistics
Answer to question (b) assumes Maxwell-Boltzmann statistics. But how to show that the probability of each distinguishable distribution is [math]n*(N)^r ?[/math] Why is Bose-Einstein statistics impossible here? Each distinguishable distribution have equal probability of [math]\frac{r!(n-1)!}{(n+r-1)!}[/math] under Bose-Einstein statistics.- Java/ any language programming to solve system of two equations
This question is "SOLVED"- Java/ any language programming to solve system of two equations
My attempt: I have following java program to solve similar equations using Newton's algorithm. What changes can be made to it to answer the above question? If below computer program is not useful, how to write the java program? I have netbeans (editor) for java programming.- "AmmoniaConcentration" package in 'R'
I tag this question as 'SOLVED' as I got correct answers to all my questions. βΊοΈ- "AmmoniaConcentration" package in 'R'
pKa = -Log(ka), pH = pKa + log (NH3/(NH3 + NH4+)). So, Ka= 4.33504889257e-10 Now, [math]\frac{1}{10^{pK_a- pH}}=\frac{NH_3}{NH_3 + NH_4^+}=3.44345173426e-3[/math] Why 1 is added to denominator NH3 + NH4+? I think Emerson et al. developed the equation pKa = 0.09018 + 2729.92/T on experimental basis.- "AmmoniaConcentration" package in 'R'
Rectified equation of f(fraction of NH3)= [math] \frac{1}{10^{(pKa-pH)} +1}[/math]- "AmmoniaConcentration" package in 'R'
Please read here and the answer the following questions if you know: How did the author derive the following equations? pKa = 0.09018 + 2727.92/T f = 1/(10(pKa β pH) + 1) How would you interpret the answers given by 'R' using this package? How is NH3_mgL computed in 'R' using this package? What is the denomination of total ammonia in the argument given by the author in the examples ? Is it mol/L or in grams?- Maxima and Minima (vector calculus)
> fdejong <- function(x,y){return(x^2 +y^2)* exp(-(x^2+y^2))} > x<- seq(-1,1 , length=2) > y <- x > z <- outer (x,y, fdejong) > require(lattice) Loading required package: lattice > wireframe(z, drape=T, col.regions=rainbow(100)) What is this? I don't get it.ππ€π§- Sufficient conditions for a critical point at (a, b, c)(i-e) [math]\nabla {f}(a,b,c)=0[/math]
More details about the question: The following theorem gives sufficient conditions for a critical point to be a local maximum or minimum of a smooth function (i.e. a function whose partial derivatives of all orders exist and are continuous). What are the changes, we must make in this theorem, in case f(x,y, z) and f(w, x , y, z)? How can we use the aforesaid rectified theorem to answer the following question? Find three positive numbers x, y, z whose sum is 10 such that [math] x^2 \cdot y^2 \cdot z[/math] is a maximum. My attempt : The critical point is x=4, y=4, z =2 How to compute D in this case? - Maximization using Lagrange Multipliers
Important Information
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.