compute max binding energy function
This commit is contained in:
parent
e1389f16f6
commit
ec4e21488c
@ -40,5 +40,18 @@ print(carbon_df, row.names=FALSE)
|
|||||||
print(carbon_df[which.max(carbon_df$"B/A"),], row.names=FALSE)
|
print(carbon_df[which.max(carbon_df$"B/A"),], row.names=FALSE)
|
||||||
|
|
||||||
## Part D: find the value of A that gives the maximum binding energy
|
## Part D: find the value of A that gives the maximum binding energy
|
||||||
|
computeMaxBind <- function(Z, precision=NA){
|
||||||
|
if (is.na(precision)){precision <- 4}
|
||||||
|
maxBind <- -Inf
|
||||||
|
A.maxBind <- -Inf
|
||||||
|
for (i in seq(Z, 3*Z)){
|
||||||
|
bindE <- computeBindingEnergy(i, Z)/i
|
||||||
|
if (bindE > maxBind){
|
||||||
|
maxBind <- bindE
|
||||||
|
A.maxBind <- i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(c(paste("Energy: ", round(maxBind, precision), "MeV"), paste("Nucleons: ", A.maxBind)))
|
||||||
|
}
|
||||||
|
|
||||||
## Part E: for each Z use the A that maximizes E/A
|
## Part E: for each Z use the A that maximizes E/A
|
||||||
Loading…
x
Reference in New Issue
Block a user