slow loop in calculation of definite integral

slow loop in calculation of definite integral - slow loop - Сообщения

#1 Опубликовано: 25.08.2024 02:53:50
Laurent Fournier

Laurent Fournier

9 сообщений из 66 понравились пользователям.

Группа: User

Hello, I need to calculate 2 successive integrals in order to obtain the deflection of a beam with variable depth

To derive algebraically the integral is too tough for me.

The in-built integral in Smath doesn't work twice (We can integrate a function only once) and Andrey has explained in the forum that it is a limitation of this in-built feature.

I did the following:
1) define the beam depth D(x) as a function of x
2) calculate the beam inertia I(x)=D(x)^3/12 x width
3) define the bending moment M(x) as a function of x (textbook formula)
4) calculate the second derivative of the deflection by the formula: D2(x)=M(x)/I(x)/E (E is the elastic modulus)
5) calculate the slope function, D1(x) by integration of D2(x) using Smath Studio in-built feature
6) digitise the slope function over a number of points: I obtain 2 vectors, X and Y
7) define the slope function slope(x) using linterp(X,Y,x) built-in feature
8) find the deflection function D(x) by integration of the digitised slope function slope(x)

My worksheet is extremely slow. 50 points take 10 minutes or so.

Then I tried a second process, digitising every step right from the beginning. This is quicker but it still takes 1 minute for 50 points.

I find this problem puzzling because when I integrate twice another function, like sin(x), also using the same digitised process right from the beginning, it can calculate 500 points in 1 second!

This looks like I am not able to "decouple" the digitised function from the original one, as if Smath was still calculating everything from the beginning, passing through the "digitisation barrier"...

I am attaching 2 files, the one with the fully digitised integration process for the cantilever beam with variable depth, and the one with the same process applied on a simple sin(x) function.

I feel there must be a way to make this work. I need this deflection calculation for calculating rammed earth piers under seismic action.

Any advice would be welcome!
Thanks
Laurent

deflection of a cantilever with variable depth.sm (28 КиБ) скачан 28 раз(а).
digitizing and integrating a.sm (33 КиБ) скачан 27 раз(а).
#2 Опубликовано: 25.08.2024 14:31:05
Laurent Fournier

Laurent Fournier

9 сообщений из 66 понравились пользователям.

Группа: User

Finally I may use geogebra: I can double integrate 500 points and geogebra still remains interactive!

Most of my projects I use both softwares in parallel: One model to cross-check my errors in the other one!

But Smath Studio has superior conceptual communication capabilities. You can document and communicate your work to others in a much more clear and comprehensive manner in Smath Studio.

double integral a.zip (31 КиБ) скачан 20 раз(а).
#3 Опубликовано: 25.08.2024 17:52:31
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hi. "line" prevents the inmediate evaluation, thus, the expressions are evaluated every time that they are needed. You can see that in this (very old) post. One solution is using eval, and another is putting 1*line( ... ), like in the attached.

deflection of a cantilever with variable depth.sm (29 КиБ) скачан 34 раз(а).
digitizing and integrating a.sm (34 КиБ) скачан 36 раз(а).

Best regards.
Alvaro.
1 пользователям понравился этот пост
Laurent Fournier 25.08.2024 18:01:00
#4 Опубликовано: 25.08.2024 18:01:37
Laurent Fournier

Laurent Fournier

9 сообщений из 66 понравились пользователям.

Группа: User

Fantastic!
Thank you so much, Alvaro!
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений