[R] Solve equality function with GA

Barry King b@rry@k|ng @end|ng |rom q|x@com
Sun Sep 25 02:29:10 CEST 2022


I am having difficulty solving for 5 in this coded snippet. Please help.
-------------------
library(GA)

# Solve for x where x^2 = 25, not x^2 <= 25

f <- function(x)
{
  x^2-25
}

fitness <- function(x) -f(x)

GA <- GA <- ga(type = "real-valued", fitness = fitness, lower = 0, upper =
10)
summary(GA)
-------------------------
Thank you,
Barry King

-- 






This message is for the intended recipient only and may contain
confidential and privileged information. If you are not the intended
recipient, please return this message to the sender and delete this message
and any attachments from your computer.

	[[alternative HTML version deleted]]



More information about the R-help mailing list