0% found this document useful (0 votes)
73 views

A ChatGPT-MATLAB Framework For Numerical Modeling in Geotechnical Engineering Applications

Uploaded by

周牮
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

A ChatGPT-MATLAB Framework For Numerical Modeling in Geotechnical Engineering Applications

Uploaded by

周牮
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Computers and Geotechnics 169 (2024) 106237

Contents lists available at ScienceDirect

Computers and Geotechnics


journal homepage: www.elsevier.com/locate/compgeo

A ChatGPT-MATLAB framework for numerical modeling in geotechnical


engineering applications
Daehyun Kim a, b, Taegu Kim a, Yejin Kim a, Yong-Hoon Byun c, Tae Sup Yun a, *
a
Department of Civil and Environmental Engineering, Yonsei University, Yonsei-ro 50, Seodaemun-gu, Seoul 03722, Republic of Korea
b
Department of Civil and Environmental Engineering, Hiroshima University, 1‑4‑1 Kagamiyama, Higashi‑Hiroshima, Hiroshima 739‑8527, Japan
c
School of Agricultural Civil & Bio-Industrial Engineering, Kyungpook National University, 80 Daehak-ro, Buk-gu, Daegu 41566, Republic of Korea

A R T I C L E I N F O A B S T R A C T

Keywords: ChatGPT has recently emerged as a representative of Large Language Models (LLMs) that have brought evolu­
ChatGPT tionary changes to our society, and the effectiveness of ChatGPT in various applications has been increasingly
Numerical modeling reported. This study aimed to explore the potential of employing programming performance driven by ChatGPT
Automated Programming
responses to conversational prompts in the field of geotechnical engineering. The tested examples included the
Artificial Intelligence (AI)
Large Language Model (LLM)
analysis of seepage flow and slope stability, and the image processing of X-ray computed tomographic image for
partially saturated sand. For each case, the prompt was initially fed by a narrative explanation of the problem
attributes such as geometry, initial conditions, and boundary conditions to generate the MATLAB code that was
in turn executed to evaluate the correctness and functionality. Any errors and unanticipated results were further
refined by additional prompts until the correct outcome was achieved. ChatGPT was able to generate the nu­
merical code at a considerable level, demonstrating creditable awareness of the refining process, when metic­
ulous prompts were provided based on a comprehensive understanding of given problems. While ChatGPT may
not be able to replace the entire process of programming, it can help minimize sloppy syntax errors and assist in
designing a basic framework for logical programming.

1. Introduction It is believed that the time has come to envisage, discuss, and share
how to adopt the powerfulness of ChatGPT in science and engineering
ChatGPT (OpenAI) is a state-of-the-art Large Language Model (LLM) fields where a limited number of references are published. Bahrini et al.
based on the transformer architecture to generate human-like text re­ (2023) evaluated the effectiveness in education by asking ChatGPT to
sponses to given specific prompts. ChatGPT takes in conversational yield a junior-level exam questionnaire in systems and information en­
prompts, processes them, and then produces relevant text responses. gineering. Tsai et al. (2023) proposed ChatGPT-assisted problem-solving
While there are other LLMs such as BERT and T5 (Devlin et al., 2018; procedures for developing a chemical engineering education course,
Raffel et al., 2020), ChatGPT distinguishes itself through its nuanced specifically in the cases of building models of a steam power plant, phase
understanding of context, adaptability to diverse queries, and exemplary reaction, and mass transfer. Kashefi and Mukerji (2023) explored the
ability to generate coherent responses. For this reason, ChatGPT pio­ capability of ChatGPT for generating and improving codes for numerical
neers a new AI territory and emerges as a representative of what modern algorithms in different programming languages for various mathemat­
Large Language Models (LLMs) can achieve and bring to our society. ical problems such as Poisson equation, diffusion equation, incom­
Since the release of the full model of GPT-2 in November 2019, there pressible Navier-Stokes equation, and compressible inviscid flow. In the
have been extensive reports and discussions on implementing ChatGPT field of construction, ChatGPT was able to not only generate a con­
across various fields, as briefly summarized in Table 1. The applicable struction schedule by fulfilling the project requirements (Prieto et al.,
fields with the aid of ChatGPT seem rapidly expanding with discussions 2023) but also facilitate hazard recognition and safety training (Uddin
on its pros and cons, potential risks, and ethical concerns, while the et al., 2023).
credibility and authenticity of generated responses have yet to be The review of previous studies leads to the conclusion that it is
formally reported and publicized. worthwhile to further explore the potential applications of ChatGPT in

* Corresponding author.
E-mail address: [email protected] (T.S. Yun).

https://doi.org/10.1016/j.compgeo.2024.106237
Received 29 November 2023; Received in revised form 1 February 2024; Accepted 11 March 2024
Available online 19 March 2024
0266-352X/© 2024 Elsevier Ltd. All rights reserved.
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Table 1 approximating the Laplacian operator as follows:


Reported applications of ChatGPT.
1( )
References Article Fields Remarks hi,j = hi− 1,j + hi+1,j + hi,j− 1 + hi,j+1 (1)
4
Type
Based on the water level, initial condition, and boundary condition,
Aluga (2023) Review Civil Introduced potential
engineering applications of ChatGPT the hydraulic head for each node can be iteratively computed until
specified in civil engineering convergence. Then, the distribution of final hydraulic head values al­
Fraiwan and Review Multiple Discussed ChatGPT’s lows for depicting the equipotential lines and streamlines. The result
Khasawneh applications in education, based on the code generated by ChatGPT was compared with that by
(2023) marketing, software
engineering, healthcare
using the commercial software GeoStudio SEEP/W.
George and Review Business Explored the impacts of
George (2023) ChatGPT on several business 2.2. Slope stability analysis
sectors
Jaber et al. Review Software Discussed the potential of
Key parameters of slope stability analysis include slope geometry
(2023) development ChatGPT in various areas of
software development fields such as height (h) and inclination angle of the slope (β), and soil prop­
such as automated program erties including cohesion (c), unit weight (γ), and the friction angle (ϕ).
repair, optimization of Gcode The stability of a slope is quantified by the Factor of Safety (FS), defined
generation in 3D printing, etc. as the ratio of available shear strength to the shear stress exerted on the
King (2023) Essay Medicine Anticipated possible scenarios
of using ChatGPT in the
potential failure surface. Note that the potential failure arc and its
medicine field location where the FS is minimized indicate the most vulnerable zone,
Ray (2023) Essay Agriculture Looked into the potential role of termed as ’critical failure surface’.
ChatGPT to address agricultural The Fellenius slice method, known as the ordinary method of slices,
challenges of a growing
was employed for slope stability analysis for a given slope geometry
population and a changing
climate (Fellenius, 1936). The method assumes a circular slip surface for the
Sallam et al. Review Multiple Described ChatGPT applications potential failure surface and divides the potentially sliding mass into
(2023) in medical, dental, pharmacy, multiple vertical slices to evaluate the FS. It also assumes that the
and public health education inter-slice forces are parallel to the base of each slice and the forces
acting on the sides yield zero normal to the failure surface. Therefore,
numerical modeling. Accordingly, this study aimed to investigate the the FS can be derived solely based on moment equilibrium, allowing a
capability of ChatGPT to develop programming code, which is one of the deterministic analysis of slope stability. The pore water pressure was
most reliable functions offered by ChatGPT, for well-known and assumed to be zero for this analysis. The potential failure surface is
fundamental geotechnical problems such as seepage flow and slope assumed as a circular arc as outlined by a red-colored arc with the center
stability. Also, the image-processing of X-ray CT images of partially coordinates C (x, y) and radius r in Fig. 1b. The normal (Nn) and shear
saturated sand was attempted. For each example, the outline of a given forces (Tn) acting on the base of each slice (presented as a bluish shaded
problem was defined and logically prompted to ChatGPT to derive the trapezoid) are
programming code in MATLAB. The outcome was repeatedly examined Nn = Wn cosαn (2)
by the improved prompt until the correct results were obtained. The
designated examples in automating the writing of programming codes Tn = cLn + Nn tanϕ (3)
showcase the potential application of integrating ChatGPT into solving
traditional geotechnical engineering issues. where Wn is the weight of the n-th slice, αn is the inclination angle of the
n-th slice base. The FS based on moment equilibrium is defined as the
2. Problem description and solving procedure ratio of the sum of driving moments (Md) to the sum of resisting mo­
ments (Mr) for each slice, with respect to the center C. The driving and
Three fundamental problems in geotechnical engineering were resisting moments of the n-th slice and the FS can be determined as
selected to explore the performance of ChatGPT-4.0 in generating the follows:
MATLAB code via prompts. The problem definition and the subsequent Md,n = Wn rsinαn and Mr,n = Tn r (4)
refinement process are described below.
∑ ∑
Mr cLn + tanϕ Wn cosαn
FS = = ∑ (5)
Md Wn sinαn
2.1. Two-dimensional seepage flow analysis
The FS can be computed by varying the center and radius of potential
The configuration of seepage flow in Fig. 1a has the underlying soil failure arcs, and the minimum FS and its corresponding geometry are
layer with a height of 10 m and a width of 25 m and a sheet pile with a 1 finally determined. ChatGPT realized the process described above, and
m width inserted into the soil with a depth of 5 m. The initial water level the results were validated using the commercial software GeoStudio
is assigned on the left side of the sheet pile to impose the hydraulic SLOPE/W.
gradient on both sides. The soil is assumed to be homogeneous and
isotropic. The bottom of the soil layer is defined as an impervious 2.3. Image analysis for phase segmentation
boundary. The sheet pile acts as an impervious barrier, allowing seepage
to flow through the soil strata. The partially saturated soil includes three phases such as solid grains,
The Laplace equation is used to delineate the distribution of hy­ water, and void (air), and its sliced section is visualized in Fig. 1c-i by 2D
draulic heads within the soil domain. The Finite Difference Method X-ray computed tomographic imaging at 8-bit grayscale. The profile of
(FDM) can be applied to obtain the approximate solution. To implement CT-numbers along A-B in Fig. 1c-ii can approximately outline the
the FDM, the soil layer is equivalently discretized into square grids with boundary between adjacent phases which gradually changes. The his­
intervals of dx in the x-direction and dy in the y-direction, as depicted in togram of intensity level (i.e., CT-numbers) in Fig. 1c-iii clearly indicates
the right-side meshed box of Fig. 1a. The hydraulic head for the i-th and that the boundary values at the air–water interface and the water–solid
j-th nodes can be obtained by the central difference method in interface are located around 91 and 113, respectively. Using

2
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 1. Schematic illustrations of problematic scenarios in geotechnical engineering. (a) Two-dimensional seepage flow analysis around a sheet pile, (b) two-
dimensional slope stability analysis using the Fellenius slice method, and (c) phase segmentation of a partially saturated sand XCT image via image processing.

3
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 2. Problem-solving flow chart by employing ChatGPT for automated code generation.

conventional segmentation methods, it is unavoidable that water will be configuration, and convergence criteria for iterative computation. Note
consistently segmented near the solid-air interface because the CT- that, while the prompt explicitly commands the use of FDM, it does not
number for the water is similar to the gradual changing CT-number at elaborate on the specific equations or operational principles of this
the interface. approach. The structurally coherent MATLAB code by ChatGPT is shown
Therefore, the segmentation of multiple phases from the grayscale in the lower section in Fig. 3. Each section of the generated codes based
image should be done by not only the conventional thresholding on the user-provided prompt is highlighted with different colors for
methods but also the advanced image processing techniques like an clarity.
iterative dilation-erosion method (Adams and Bischof, 1994; Serra, For the 1st trial, the user-defined variables for specific dimensions
1982). Within the scope of this study, it was aimed to progressively are correctly reflected in line 21. Lines 24 to 29, highlighted in green,
develop the numerical code driven by ChatGPT only based on the establish the analysis domain for the soil layer, initial conditions, and
perceivable prompt without feeding explicit image-processing convergence criteria for the application of FDM. The soil layer is divided
algorithms. into grids based on user-defined intervals dx and dy, and each grid point
within this soil layer is assigned to a matrix variable, H, representing the
total head value. This matrix, H, is initialized based on initial conditions,
2.4. Problem-solving procedure by employing ChatGPT for code
reflecting the average water level on both sides of the sheet pile. The
generation
subsequent code section (lines 32–34, highlighted in yellow) defined the
position of the sheet pile within the soil domain and established
Fig. 2 outlines the problem-solving workflow. For each case, the
boundary conditions by assigning constant head values, H1 and H2, to
problem is clearly defined by stating the geometry, initial conditions,
the respective water levels on either side. Utilizing the threshold spec­
boundary conditions, and computation methods. It is noted that the
ified by the user as the convergence criterion for FDM, ChatGPT
prompt consists of a narrative description without any mathematical
autonomously constructed the FDM iterative computation code in lines
formulation allowing ChatGPT to freely generate the numerical code
37–52 (highlighted in blue), which integrates while loops, for loops, and
based on its interpretation. Upon requesting ChatGPT to generate code
if statements. Notably, within this iterative section, lines 43–45 contain
in MATLAB, the output code is executed. Once the code runs without
a conditional statement excluding computations within the sheet pile.
error, both the code and subsequent results are cautiously reviewed for
The plotting section for visualizing the flow net is omitted for brevity.
validation by the users. Based on this review, the users provide addi­
The MATLAB code by the 1st trial ran without error and the flownet by
tional prompts to correct the code until it is error-free. These prompts
ChatGPT was shown in Fig. 4a. The flownet result by GeoStudio SEEP/W
are continuously refined and optimized for specificity until the results
is also shown in Fig. 4b. The comparison of both figures reveals critical
generated by ChatGPT align with the expected and correct answers.
discrepancies that originate from an incorrect boundary condition
statement related to the water level in line 32. In the first row of matrix
3. Prompts by user, answers by ChatGPT, and results H based on the sheet pile, the left side should be designated with a high
water level of H1 = 10 m while the right side should have a low water
3.1. 2D seepage flow analysis level of H2 = 0 m as constant head values.
The 2nd trial prompt in Fig. 5 was added to correct the boundary
Fig. 3 shows the first attempt at generating MATLAB code for 2D condition of the matrix H, and the code was revised by correctly
seepage flow analysis. The upper box in Fig. 3 includes the compre­ assigning the constant head value in lines 14–15. However, this
hensive problem definition such as geometry details, initial and correction did not produce the correct flow net as shown in Fig. 6a
boundary conditions, specifications for the spatial domain mesh

4
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 3. The 1st trial prompt given to ChatGPT for seepage flow analysis (upper box) and the corresponding MATLAB code response received from ChatGPT
(lower box).

5
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 4. A comparison between the flow net analyzed by the MATLAB code generated from ChatGPT through the 1st trial (a) and the benchmark result analyzed by
the GeoStudio SEEP/W (b) under identical geometric and boundary conditions.

because the ‘out of bounds’ scenario was missing some of the four To address these errors, an additional prompt was provided to
adjacent values essential for FDM calculation for specific nodes in matrix ChatGPT to guide code improvements, and the revised MATLAB func­
H, such as along lines AF, FE, ED, CH, HG, and GB. Therefore, the 3rd tion code is shown in Fig. 9. Error 1 was corrected to ensure that all
trial prompt provides a detailed explanation of the commonly used sections are included within the slope length (line 9). To correct Error 2,
‘mirroring’ technique for FDM calculations at nodes with missing adja­ ChatGPT added a for-loop to compute the height of each slice differently
cent values, as highlighted in blue in Fig. 5. A ’NaN’ value was first based on its position within the slope length (lines 16–24) considering
assigned to the sheet pile region (lines 18–19), followed by a check for the shape of trapezoids. For Error 3, instead of the angle of inclination
’NaN’ values to implement the mirroring technique correctly (lines (beta) which was a variable provided when determining the geometric
30–33). shape of the slope, a newly defined angle (alpha) was introduced in line
This iterative improvement of prompts led to a final flownet (Fig. 6b) 29 to account for the inclination of the undefined n-th slice. This vari­
that, using the MATLAB code automatically generated by ChatGPT, able describes the angle formed between a line from the center of the
accurately matches the benchmark flow net. The comparison of the head failure circle to the base of the n-th slice and a vertical line from.
values of matrix H from both methods exhibited negligible differences the centroid of that slice. The code in lines 30–32 computes both
despite SEEP/W being based on Finite Element Method (FEM). driving and resisting forces using the angular variable alpha, to derive
the FS value. The main function, which uses for loops and MATLAB
3.2. Slope stability analysis function code to calculate FS values for every coordinate of the potential
failure circle, is omitted for conciseness.
The 1st trial of a prompt specifies the use of the Fellenius method to For a given range of the center of potential failure circles with
compute the FS and includes the declaration of variables such as slope varying radii, the minimum FS value of 1.630 was obtained by ChatGPT
geometry, soil properties, coordinates, and radius of the arc representing (Fig. 10a). The heatmap denotes the distribution of the computed FS
potential failure surface (Fig. 7). It is noted that the use of the Fellenius values for a given coordinate. This result was identical to that by Geo­
method was suggested, while its underlying principles were not Studio SLOPE/W (Fig. 10b). For both cases, the coordinates x, y, and r of
explained. The code generated by ChatGPT in the form of a user-defined the critical failure circle for the toe failure type were identified as − 0.30,
function named ‘Fellenius’ was shown in the lower section in Fig. 7. 14.78, and 14.77, respectively, with the corresponding minimum FS
From lines 6 to 16, the code for the coordinates of the sliding mass, the value calculated to be 1.630.
slice of sliding mass, and computation of weight of each slice was
generated. The basic equations for driving force and resisting force were 3.3. Image analysis for phase segmentation
defined to compute the FS in lines 19 to 21.
The initial code had no syntax errors; however, it contained logical Fig. 11 presents the first attempt at the segmentation of three phases
errors as illustrated in Fig. 8. Calculating the FS of a slope requires a (i.e., grain, water, and air) in an X-ray CT image of partially saturated
process of identifying the sliding mass, dividing it into N slices, and then sand. The approximate ranges of CT-number were provided for each
computing both the driving and resisting forces based on the weight of phase and the colors of segmented phases were specified in the prompt.
each slice. Error case 1 indicates the incorrect identification of the The 8-bit grayscale image was uploaded using a ChatGPT plugin called
sliding mass, specifically due to erroneous settings for the slope length Link Reader. ChatGPT structured the code almost the same as the input
range (incorrectly defined length in red arrow and correct length in of the prompt, and the first output image is shown at the bottom of
black arrow). For error case 2, the slices divided into N segments were Fig. 11. It should be noted that the code for loading the image was
treated as rectangles, with the height of each slice incorrectly set to the omitted for conciseness. The unwanted ring-shaped water phases
n-th y-coordinate value (indicated by the red arrow). This should be captured around the boundary between grain and air cannot be avoided
corrected by considering the difference between the y-coordinate of the using conventional thresholding methods, as coded by the 1st trial,
slope and that of the slice base, as shown by the black arrow. For error because of the partial volume effect (PVE). The PVE tends to cause
case 3, the variable for the inclination angle of the slice base, which is blurring and amalgamation of different objects along the phase bound­
used in calculating the driving and resisting forces for FS estimation, was aries due to spatial resolution constraints (Glover and Pelc, 1980; Her­
incorrectly set to the inclination angle associated with the slope. man, 1980).

6
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 5. The 2nd and 3rd trial prompts given to ChatGPT to address the errors (two upper boxes) and their corresponding revised MATLAB code responses received
from ChatGPT (lower box).

7
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 6. Flow nets analyzed by the MATLAB codes generated from ChatGPT: (a) the 2nd trial and (b) the 3rd trial.

Therefore, a second prompt was provided to inform ChatGPT of the automating programming tasks leads to the following observations:
origin of PVE and the desired output image without specifying the
relevant algorithms. Fig. 12 represents the second prompt, the MATLAB • ChatGPT was able to logically establish a series of processes entailed
code generated by ChatGPT, and the output image. ChatGPT voluntarily in common programming sequences, including the definition of
proposed the erosion and dilation approach, which indeed has been variables and domains, the formulation of governing equations,
widely applied to overcome the PVE (Haralick et al., 1987; Serra, 1982) iterative operation and convergence (if necessary), and visualization
to remove the artifact, as exactly explained in what ChatGPT answered of results.
prior to the code. The ‘strel’ function and the spanning value of ‘3′, • As ChatGPT is not consistently accurate especially with complex
initially set by ChatGPT, can be adjusted by the user to produce the mathematical problems or advanced logic tasks (Plevris et al., 2023),
desired outcome. Nonetheless, this approach tended to excessively it was necessary to identify and improve the poorly generated sec­
remove the ring-shaped water phase causing the reduction of the degree tions of the initial code with clearly described additional prompts
of saturation from 59.03 % to 51.66 % as shown in the output images at until the anticipated results were produced.
the bottom in Fig. 12. The outlines of the removed water phase captured • The final outputs derived from ChatGPT were consistent with those
by the 1st trial are presented in red in the highlighted image of the obtained from commercial software, validating the performance of
contact zone at the bottom of Fig. 12. the programming function of ChatGPT. It was highly advantageous
For the 3rd trial, an alternative strategy to counteract the PVE, such that ChatGPT minimized the syntax errors frequently encountered in
as ‘edge-preserving smoothing’ or ‘smoothness constraint’, which have manual coding.
been used to reduce noise while preserving important structural details • Nonetheless, this study underscores the necessity of human expertise
where the PVE introduces artifacts (Rudin et al., 1992; Smith and Brady, in guiding and refining the use of ChatGPT for the given geotechnical
1997; Tomasi and Manduchi, 1998), were recommended via the prompt. problems. While ChatGPT offers a promising avenue for semi-
The third prompt, the answered code by ChatGPT, and the outcome are automating computational tasks, its efficacy is contingent on the
displayed in Fig. 13. This led to ChatGPT using the ‘imbilatfilt’ MATLAB user’s ability to provide detailed and accurate prompts.
function (line 15), which executes non-linear and edge-preserving
smoothing based on pixel proximity and intensity resemblance. The The findings reinforce that ChatGPT is not a substitute for human
degree of saturation slightly bounced back to 52.83 % as this approach judgment and expertise, but rather a tool that can expedite and
specifically compensated for the water phase near the particle contact streamline the programming process. Users must possess a foundational
regions. understanding of both the subject matter and programming principles to
effectively utilize ChatGPT. In essence, ChatGPT accelerates but does
4. Conclusions and discussion not completely replace the intricate process of code generation,
requiring human oversight and ethics to ensure the accuracy and rele­
The feasibility of ChatGPT-assisted programming was explored to vance of the outcomes.
solve the basic, yet fundamental problems regarding seepage flow, slope The numerical coding with the aid of ChatGPT demonstrated in our
stability, and X-ray image processing in geotechnical engineering. For study is one example of the vast potential applications of generative-AI
each case, the conversational prompts for problem definition, initial in the fields of engineering, research, and education. It is expected that
condition, and boundary condition were given to ChatGPT without the capabilities of this technology extend to address more complex en­
direct input of numerical or mathematical definitions and equations. gineering issues, such as multi-process coupled modeling, designing
The generated MATLAB code in response to the initial prompt was tasks, and big-data analysis. The potential applications of generative-AI
proofread and executed to validate the outcomes. By providing addi­ and its role in scientific and engineering fields are issues that should be
tional prompts for the codes that required further modification, the code collectively discussed by our society. The broader community should
was sequentially updated until it was able to produce accurate and engage in discussions about these possibilities, as collective experience
acceptable results. The proposed ChatGPT-MATLAB framework for and knowledge will enhance the application of generative AI in both

8
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 7. The 1st trial prompt given to ChatGPT for creating a MATLAB function to calculate FS (upper box), and the corresponding MATLAB code response received
from ChatGPT (lower box).

Fig. 8. (a) Schematic representation of the analysis domain for three different failure types, and accuracy assessments of the calculated FS using the MATLAB code
received from ChatGPT in the 1st trial, compared to results from GeoStudio SLOPE/W. (b) Three errors within the MATLAB function created by ChatGPT in the 1st
trial resulted in incorrect FS calculation outcomes.

9
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 9. The 2nd trial prompt given to ChatGPT to address the three different errors (upper box) and the corresponding revised MATLAB code responses received from
ChatGPT (lower box).

10
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 10. Visualization of the FS calculation results for the potential failure surface using a heatmap, along with the depiction of the critical failure surface. Results
obtained using (a) the MATLAB function created by ChatGPT and (b) the GeoStudio SLOPE/W. (Slope dimensions: h = 10 m, β = 40◦ , Soil properties: Ф = 35◦ , c = 12
kN/m2, γ = 17 kN/m3).

Fig. 11. The 1st trial prompt given to ChatGPT for generating a MATLAB code to perform phase segmentation (upper box), and the corresponding MATLAB code
response received from ChatGPT (lower box).

11
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

Fig. 12. The 2nd trial prompt given to ChatGPT for generating a MATLAB code to perform phase segmentation (upper box), and the corresponding MATLAB code
response received from ChatGPT (lower box).

Fig. 13. The 3rd trial prompts given to ChatGPT for generating a MATLAB code to perform phase segmentation (upper box), and the corresponding MATLAB code
response received from ChatGPT (lower box).

12
D. Kim et al. Computers and Geotechnics 169 (2024) 106237

research and education. Devlin, J., Chang, M. W., Lee, K., & Toutanova, K. (2018). Bert: Pre-training of deep
bidirectional transformers for language understanding. arXiv preprint arXiv:
1810.04805.
CRediT authorship contribution statement Fellenius, W., 1936. Calculation of the stability of earth dams. Proc. of the second
congress on large dams. 4, 445–463.
Fraiwan, M., and N. Khasawneh. 2023. “A Review of ChatGPT Applications in Education,
Daehyun Kim: Writing – review & editing, Writing – original draft, Marketing, Software Engineering, and Healthcare: Benefits, Drawbacks, and
Visualization, Validation, Project administration, Investigation, Funding Research Directions.” arXiv preprint arXiv:2305.00237.
acquisition, Formal analysis, Conceptualization. Taegu Kim: Visuali­ George, A.S., George, A.S.H., 2023. A review of ChatGPT AI’s impact on several business
sectors. Partners Universal Int. Innov. J. 1 (1), 9–23.
zation, Investigation, Formal analysis. Yejin Kim: Writing – review &
Glover, G.H., Pelc, N.J., 1980. Nonlinear partial volume artifacts in x-ray computed
editing. Yong-Hoon Byun: Writing – review & editing. Tae Sup Yun: tomography. Med. Phys. 7 (3), 238–248.
Writing – review & editing, Writing – original draft, Validation, Super­ Haralick, R.M., Sternberg, S.R., Zhuang, X., 1987. Image analysis using mathematical
vision, Methodology, Funding acquisition, Conceptualization. morphology. IEEE Trans. Pattern Anal. Mach. Intell. 4, 532–550.
Herman, G. T. (1980). Image reconstruction from projections. The fundamentals of
computerized tomography, 316.
Kashefi, A., and T. Mukerji. 2023. “Chatgpt for programming numerical methods.”
Declaration of competing interest Journal of Machine Learning for Modeling and Computing, 4(2). Begel House Inc.
King, M.R., 2023. The future of AI in medicine: a perspective from a chatbot. Ann.
The authors declare that they have no known competing financial Biomed. Eng. 51 (2), 291–295.
Plevris, V., Papazafeiropoulos, G., Jiménez Rios, A., 2023. Chatbots put to the test in
interests or personal relationships that could have appeared to influence math and logic problems: a comparison and assessment of ChatGPT-3.5, ChatGPT-4,
the work reported in this paper. and Google bard. AI 4 (4), 949–969.
Prieto, S.A., Mengiste, E.T., García de Soto, B., 2023. Investigating the use of ChatGPT for
the scheduling of construction projects. Buildings 13 (4), 857.
Data availability
Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Liu, P.J., 2020.
Exploring the limits of transfer learning with a unified text-to-text transformer.
No data was used for the research described in the article. J. Machine Learn. Res. 21 (1), 5485–5551.
Ray, P. P. (2023). AI-Assisted Sustainable Farming: Harnessing the Power of ChatGPT in
Modern Agricultural Sciences and Technology. ACS Agric. Sci. Technol.
Acknowledgements Rudin, L.I., Osher, S., Fatemi, E., 1992. Nonlinear total variation based noise removal
algorithms. Physica D 60 (1–4), 259–268.
Sallam, M., Salim, N., Barakat, M., Al-Tammemi, A., 2023. ChatGPT applications in
This research was supported by the Ministry of Education of Korea medical, dental, pharmacy, and public health education: a descriptive study
(No. NRF-2018R1A6A1A08025348) and the Ministry of Science and ICT highlighting the advantages and limitations. Narra J 3 (1), e103–e.
of Korea (MSIT) (No. NRF-2021R1A5A1032433). Serra, J. (1982). Image analysis and mathematical morphol-ogy.
Smith, S.M., Brady, J.M., 1997. SUSAN—a new approach to low level image processing.
Int. J. Comput. Vis. 23 (1), 45–78.
References Tomasi, C., Manduchi, R. (1998, January). Bilateral filtering for gray and color images.
In: Sixth international conference on computer vision (IEEE Cat. No. 98CH36271), 839-
Adams, R., Bischof, L., 1994. Seeded region growing. IEEE Trans. Pattern Anal. Mach. 846. IEEE.
Intell. 16 (6), 641–647. Tsai, M.-L., C. W. Ong, and C.-L. Chen. 2023. “Exploring the use of large language models
Aluga, M., 2023. Application of CHATGPT in civil engineering. East Afr. J. Eng. 6 (1), (LLMs) in chemical engineering education: Building core course problem models
104–112. with Chat-GPT.” Education for Chemical Engineers, 44: 71–95. Elsevier.
Bahrini, A., Khamoshifar, M., Abbasimehr, H., Riggs, R.J., Esmaeili, M., Uddin, S. M. J., A. Albert, A. Ovid, and A. Alsharef. 2023. “Leveraging ChatGPT to Aid
Majdabadkohne, R.M., Pasehvar, M., 2023. In: ChatGPT: Applications, opportunities, Construction Hazard Recognition and Support Safety Education and Training.”
and threats. IEEE, pp. 274–279. Sustainability, 15 (9): 7121. MDPI.

13

You might also like