- Видео 7
- Просмотров 107 680
Connor Ferster
Добавлен 5 июн 2007
How I use Python in Structural Engineering
Find me on GitHub: github.com/connorferster/
handcalcs: github.com/connorferster/handcalcs
forallpeople: github.com/connorferster/forallpeople
Dr. Becky Smethurst: 5 ways I use code as an astrophysicist
ruclips.net/video/bxWrXhLFN2s/видео.html
handcalcs: github.com/connorferster/handcalcs
forallpeople: github.com/connorferster/forallpeople
Dr. Becky Smethurst: 5 ways I use code as an astrophysicist
ruclips.net/video/bxWrXhLFN2s/видео.html
Просмотров: 50 156
Видео
Introduction to handcalcs: Absolute Beginners Guide
Просмотров 17 тыс.4 года назад
handcalcs is a powerful, free, Python library that automatically renders most Python calculations into Latex, as though you wrote them by hand. Running on Jupyter Lab/Notebooks, handcalcs allows anyone to create beautiful, modular, parametric calculations sheets in a way that mimics a handwritten calculation. For any calculation, handcalcs will render the symbolic formula, the numeric substitut...
Engineering Calculations: Handcalcs-on-Jupyter vs. Excel
Просмотров 13 тыс.4 года назад
Engineering calculations are commonly performed in Excel but creating a well formatted calculation sheet can be time consuming. Handcalcs is a Python library that runs on Jupyter Lab/Notebooks to render Python calculations as though you wrote them by hand. Using a combination of Python cells and Markdown cells, you can create a parametric calculation sheet in a Jupyter, that looks beautiful, in...
The Art of Everyday Innovation: R. Gary Black, Structural Engineer
Просмотров 1 тыс.5 лет назад
R. Gary Black is a structural engineer and professor of architecture at UC Berkeley. He is also the president of his own company, Integrated Structures. R. Gary Black began his career as the structural engineer for the Center for Environmental Structure, founded by architect Christopher Alexander. This presentation is a retrospective on some of R. Gary Black's projects focusing on one of his st...
Formaldehyde-free tannin foam
Просмотров 7607 лет назад
Formaldehyde-free tannin foam synthesized at SAIT Polytechnic, Canada in 2016. The formulation used was "F11-22" as detailed in DOI: 10.5185/amlett.2011.4254. Project completed by Connor Ferster, Mu Yang, Fernando Arenas, and Michael Shannon. Faculty advisor: Matthew Eidt. Additional assistance provided by Dr. Stephen Barry. Video shot by The Light Factory.
Tennessee Tanning - Glazing Jack
Просмотров 6 тыс.13 лет назад
A video showing the operation of a leather glazing jack at Tennessee Tanning
Having installed python 3.12, I have been able to test the if statements using handcalcs and there are numerous issues with using if statements within functions decorated with @handcalc(). 1) If your input value into the function is modified inside the function after the if statement, the rendering of that value will use the latest value instead of the value it was before the if statement. Here's an example: def func(x, y): if x < 20: y = x + 5 x = x + 6 return x, y In this example, if x = 10, 16 will be used in the rendering of all the lines, instead of using 10. The first rendered says y = x + 5 = 16 + 5 = 15 2) if the variable is just to be assigned a value then nothing will be rendered. Here's an example: def func(x): if x > 1: x = 1 return x In this example, the x = 1 will not be rendered. I hope these issues will be considered for fixing soon?
Having installed python 3.12, I have been able to test the if statements using handcalcs and there are numerous issues with using if statements within functions decorated with @handcalc(). 1) If your input value into the function is modified inside the function after the if statement, the rendering of that value will use the latest value instead of the value it was before the if statement. Here's an example: def func(x, y): if x < 20: y = x + 5 x = x + 6 return x, y In this example, if x = 10, 16 will be used in the rendering of all the lines, instead of using 10. The first rendered says y = x + 5 = 16 + 5 = 15 2) if the variable is just to be assigned a value then nothing will be rendered. Here's an example: def func(x): if x > 1: x = 1 return x In this example, the x = 1 will not be rendered. I hope these issues will be considered for fixing soon?
Hi, the conditional if statements do not work on python 3.13.1. They seem to work fine on 3.12. Is there any reason for this, and will it be possible to provide a fix soon?
Is it possible to place a symbol on the left hand side of an equation? For example when designing concrete d/h = 0.9
When I enter handcalcs.set_option() an error is returned saying set_options() missing 2 required positional arguments. How can I see the list of available options and what values they take if this does not work?
Not sure if you know but the conditional if statements do not work on handcalcs. I tried the same example in the documentation and it keeps saying that x is not defined even though it is defined in the previous cell.
@@Son96601 They do work. Read the docs again and check your code. They are not, currently, like regular Python code.
@@connorferster Hi, I copied the code from the docs exactly and keep getting the x is not defined error for some reason, i cannot understand why.
@connorferster Hi, this is the code I have wrote: Cell 1 : %%render x = 12 y = 2*x/5 Cell 2: %%render if x <= 24: b = 2*x When I run I get the error that name 'x' is not defined. Can you please see if you know why I am getting this error? Thanks
@connorferster I have tried to add a symbol line to the MPa in the structural environment. However, it does not work. Furthermore, when I call forallpeople.environment(), the MPa is shown to equal 1.000Pa instead of 1N/mm^2. It seems that the library is linked to the unit case, in other words when I add a symbol of N/m^2 to the Pa unit, everything will follow this, so if something is in MPa it will be given MN/m^2 units. Is there no way to force the use of N/mm^2 when the definition of MPa is found in the calculations?
Is there any way to force the units of a calculation to be N/mm^2 instead of MPa? N/mm^2 is more common and expected in UK concrete design.
@@Son96601 Yes, you can change the symbol for MPa to N/mm^2 in the structural.json environment file.
@connorferster Thanks! If I still wanted MPa to be in the environment for other cases, do I just change the default value for N/mm^2 to True and then copy it as another entry, call this one MPa and set its default value to false?
@@connorferster OK having read the documentation further, the default value only makes sense for defined units. So my question would be if I have MPa and N/mm^2 in the same environment with the same definitions, which one would the code pick? And would I be able to use the .to() method to choose between them?
@connorferster I have tried to add a symbol line to the MPa in the structural environment. However, it does not work. Furthermore, when I call forallpeople.environment(), the MPa is shown to equal 1.000Pa instead of 1N/mm^2. It seems that the library is linked to the unit case, in other words when I add a symbol of N/m^2 to the Pa unit, everything will follow this, so if something is in MPa it will be given MN/m^2 units. Is there no way to force the use of N/mm^2 when the definition of MPa is found in the calculations?
Very insightful. Where can we find more videos like this? I'm trying to think of a dissertation idea and some of this is helping me
Hi Connor I am using Quarto to render the equations in pdf. As some of the equations are quite long, the last part of the equations is missing in the pdf. Is there a way to wrap the equations within the page width. Thanks
Tried it in vscode + Juypter notebook. Cannot get exporting to html to work. Any ideas?
Nevermind, it was a thing with my jupyter installation, it works now. Doing 1) pip insteall nbconvert, and then 2) pip install --upgrade jupyter nbconvert, solved it for me.
Hi, are you able to get it to print to html without the cells?
@@Erikos45 Hello, did you manage to get it to print to html without showing the cells?
superb!!!!
Excellent, thank you.
Can SageMath be used?
Replaced mathcad, I can't afford its price. Thanks! I wanna mask some value when converting units, cz it will not give the final units I wanted. I am doing X=X.to("units") to convert the units, but it gives me an extra X=YY。Could you please tell me how to mask this extra line?
Awesome, thank you for the video
Hi Connor! Thank you for this resource. I noticed your latex outputs are aligned left, instead of aligned centered. What should I change in "set_option()" to align text left as you have it? handcalcs.set_option("math_environment_start", "aligned" ) handcalcs.set_option("math_environment_end", "aligned" )
Hi Isaiah, you can change both "aligned" options to "flalign". Similar to how you would do it normally in a LaTeX document itself, you simply change the math environment it uses to render the equations.
@@ThomBindels This did not work, is 'flalign' the correct keyword?
Do more videos
Why he is not makin videos 😭😭
I am a student doing my final year project for tunnel analysis visualization and generating defects reports by editing python codes. I have always been so tired of doing manual calculations for my school work. I seriously need to learn programming to work more efficiently. Thanks a lot for inspiration.
How to align the rendered equations to left??
This is awesome! I have much work to do
handcalcs is sexy. gonna be useful for my engineering degree.
Thanks a lot Connor, i admire your work, this library its extremely useful, i've been working with it and i've found an issue i would like to ask you about: I've modified the structural environment trying to include some new units as kgf, kgf/m and kgf/m2 because, unfortunately, this units are commonly used in my daily calculations, my aproach has been this: "kgf": { "Dimension": [1,1,-2,0,0,0,0], "Factor": "0.10197", "Symbol": "kgf"}, "kgf_m": { "Dimension": [1,0,-2,0,0,0,0], "Factor": "0.101971", "Symbol": "kgf/m"}, "kgf_m2": { "Dimension": [1,-1,-2,0,0,0,0], "Factor": "0.1019716", "Symbol": "kgf/m²"}, However, i've found that sometimes the .to("kgf") or .to("kgf_m") or .to("kgf_m2") method works correctly, but sometimes it's stops working and returns to the default SI units (N, N/m, N/m2), i know i'm doing something wrong in the deffinition of the environment but i've been unable to solve it. Thanks in advance for your answer!!!
Thank you, Connor for creating this library for Python Jupyter users.
The next goal is handcalcs v2.0...coming 2024!
This is unbelievably powerful! Thank you so much! Is there a way of overwriting the units that are rendered? For example, I want 100 Pa shown as 0.1 kPa
Glad you like it! Yep, for SI units (only), you can choose to set a prefix: p = 0.1 * kPa.prefix("k")
I was not put in context. Not knowing where the files are you working on and so forth. But I am sure this is interesting for someone who know CTI file for example. For me was no clue where did you start.
Hi, nice content, is there any libraries of python that can help with details in dwg or IFC format? For example, draw a beam with reinforcement and export it to dwg. thanks
I haven't tried it yet but is there something special about the %%render magic that causes printing to html not to display input cells? Or does Jupyter turn off input cells anytime you print html?
Ah nevermind I see it now- it went by so fast: there is a "no input" option when exporting to html. NICE.
Great! I do my technical report using dash. But I'm getting exited to use these libraries. Thanks!
hi, Unable to load: forallpeople.environment('structural') it says key error: 'Hz' for all people is installed.
hi connor, Great Video! Thanks. I am stuck in the last part where you export just the output [56]. My jupyterlab throws the error "No module named 'handcalcs.install_templates'" installed. can you please help with this, Thanks.
Hi Connor & Vishwanath. I've got the same issue. I get the "ModuleNotFoundError". Have you managed to resolve this?
Same issue here
Hi, did you manage to solve this?
you are a true genius.
Hi Connor When I run the cell symbolic equations are not displayed. I only get the results (e.g. c=0.6). Is there something missing in the installation?
You probably need to put spaces around your = sign. Try it and let me know.
@@connorferster Thank you. It is working now.
Hey guys🙂, I'm a first year civil engineering student. Could you please suggest me some key skills to lean in python. I can't like learn everything!
Up
Of course you can learn “everything”! Learning “everything” comes with time. However, you are right, learning literally everything is something no one can achieve. I heard that the creator of Python rates his own knowledge of Python as 8/10. That said, the first thing I always teach is writing functions. This gives your code structure. Try writing some simple calculation functions based on what you are learning in school. Then, naturally, you will be interested in learning how to make your functions do more things (like looping and making decisions with if/elif/else) and you will learn this easily. Focus on writing functions. The output of one function can be the input of another. One function can can have the sole purpose of calling all your other functions. Good luck!
Thank Connor for works. I run import handcalcs.render but jupyter shows KeyError. what I am doing import handcalcs
Great video but I am getting Name error while inserting dimensions like L=10m, P=10KN/m**2 like names m , K M/**2 showing like are not defined. Please, assist me.
Hi @vijaykumarm1119, it is hard to say exactly what is wrong without seeing your code. However, a NameError refers to the use of variable names that have not been defined. So, I would suspect one of two things: 1) you have not imported forallpeople; 2) if you have imported forallpeople, you did not set the units environment i.e. import forallpeople; forallpeople.environment('structural', top_level=True)
Wonderful library. It would be great if we could render one dimension vectors along with their units. I have been doing that in mathcad express using the range variable.
Hi Connor. I'm currently using handcalcs ver 1.6.5 I'm not well versed in LaTeX. What should I change in these global configurations to get rendered calculations to be left aligned? import handcalcs.render handcalcs.set_option("math_environment_start", "aligned") handcalcs.set_option("math_environment_end", "aligned")
It seems to be dependent on your renderer. When I use Mathjax rendering, it seems to be left-aligned by default. When I use the Katex plugin it seems to be centered automatically.
@@connorferster I changed these : handcalcs.set_option("math_environment_start", "aligned") handcalcs.set_option("math_environment_end", "aligned") into "flalign*" And it seems to work well enough. But now I struggled to find how to export to html with nbconvert with Mathjax 3. For some reason even if try to change the cdn into Mathjax 3, nbconvert will still use Mathjax 2.7.7 🥲
Hi Connor. I see You use Bluebeam Revu. I wander if there is a way to automate certain boring and repeatable tasks in said programme (eg. updating titleblocks etc.)? Thanks!
Looks great but I can only get a render of the answer i.e. c = 0.6. The rest of the equations are not being generated? LAtex works ok using $ signs. Can you help?
Are there spaces around your “=“ sign? c = your_equation, not c=your_equation. Does it work when you put the extra spaces in?
@@connorferster Thank you for the answer! I had the same issue until you mentioned the use of extra_spaces in the expression. Again, thank you for this powerful tool!
Your video has inspired me to learn python/jupyter for my civil and structural engineering calculations. I have followed your video as best I can, but am having 2 issues: 1. The renders are not printing out the formula, always just the answer, for example S_x=b*d*2/6 just outputs Sx=133333.333m3 instead of the formula with variables, then the answer. %%render symbolic prints the formula, but no answer. Can anyone assist? 2. The greek symbol substitution doesn't seem to be working for me. I get a NameError: name 'alpha' is not defined. Can anyone assist?
Hi @troypiggins, 1. Try writing your formula with spaces around the = sign. Like, S_x = b*d**2/6 instead of S_x=b*d**2/6 2. A name error is saying that the variable name “alpha” is not yet defined. Check two things: * You have “alpha = …” somewhere in your code before you have “something = alpha …” somewhere else. * If you do have the above, make sure that the “alpha = …” code cell is run before the “something = alpha …” cell. * If you do have the above, make sure that in the event the “alpha = …” code is under and if statement that the code under the if is actually being run. Hope that helps!
@@connorferster thanks so much for response. I ended up discovering the solution for 1 by accident after experimenting, and 2 makes sense.
Пошол устанавливать jupyterlab
Hello. Great module! Is it possible to render variables containing non-ASCII characters? Currently, if such a variable is used in an expression, only the name of the variable and the result are rendered, without an intermediate formula.
Thanks for bringing this up. I will be updating the parser in v3.0 to handle (most) of these scenarios. At that point, the limitation will be on what can be rendered by Katex or Mathjax.
Hello Connor, is there a way we can use your library with pycharm for a desktop application?
Yep, I am sure you can :)
Amazing . How can I show results in cm^2 instead of m^2 . I know the .prefix('c') . Nothing seems to show the results in cm^2 .... I finally got the answer
Hi can you explain the answer please?
Can we legally use individual version of anaconda distribution on office computer? Or do we need to purchase a commercial licence?
Hi Connor, Thank for the handcalcs library. However, I get the message that module install_html is not defined. Can you please comment what could be the issue?
I found my answer in the comments below.
This is an old video. No need to install anything😀