HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Labs
  2. /Freundlich constants from a table
ChemistryMediumHigh School (11–12)Surface Chemistry

Freundlich constants from a table

You will write a small least squares fit and use it to find the Freundlich constants of a gas on a solid. No library is needed: the slope and intercept come from sums.

The idea. For points (Xi,Yi)(X_i, Y_i)(Xi​,Yi​) the least squares slope is s=∑(Xi−Xˉ)(Yi−Yˉ)∑(Xi−Xˉ)2s = \dfrac{\sum (X_i - \bar X)(Y_i - \bar Y)}{\sum (X_i - \bar X)^2}s=∑(Xi​−Xˉ)2∑(Xi​−Xˉ)(Yi​−Yˉ)​, and the intercept is Yˉ−sXˉ\bar Y - s\bar XYˉ−sXˉ. Here X=log⁡PX = \log PX=logP and Y=log⁡(x/m)Y = \log(x/m)Y=log(x/m).

Your tasks.

  1. Complete line(xs, ys). It returns the slope and the intercept.
  2. Complete freundlich(pressures, amounts). It takes logarithms (base 10), calls line, and returns 1/n and k.
  3. Complete predict(k, inv_n, p). It returns x/mx/mx/m at the pressure p.

Run it first, just as it is. The checker at the end prints FAIL for each task. Then do the tasks one at a time, and run the program again after each one. A Hint appears under every check that still fails.

When every line says PASS, change one reading by 10 % and see how much 1/n1/n1/n moves.

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A worked solution

Run your code once to unlock the worked solution.

Have you tried it?

Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.

Log in to save
← All Labs
← An indexing machineLangmuir: monolayer and surface area →
More onSurface Chemistry

Discussion (0)

Log in to join the discussion.

Loading…

More labs on this topic

  1. Find the CMC from conductivityMedium
  2. Coagulation values and the Hardy-Schulze ruleEasy
  3. Vmax and Km from enzyme readingsMedium
  4. A catalyst and the Arrhenius equationEasy
  5. Langmuir: monolayer and surface areaMedium
All labs on this topic →