r 在计划中加速工作。注意,“加速因子”仍然需要工作,加速因子是加速度.r - 与经典f相反

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r 在计划中加速工作。注意,“加速因子”仍然需要工作,加速因子是加速度.r - 与经典f相反相关的知识,希望对你有一定的参考价值。

forces <- function(df_coordinates, X, Y, indice){
df_coordinates$F =1/log(sqrt((df_coordinates$x-X)^2 + (df_coordinates$y-Y)^2)^2)
df_coordinates$ang = atan2(df_coordinates$y-Y, df_coordinates$x-X)
df_coordinates$Di = df_coordinates$F * cos(df_coordinates$ang)
df_coordinates$Dj = df_coordinates$F * sin(df_coordinates$ang)
colnames(df_coordinates)[c(length(colnames(df_coordinates))-3,length(colnames(df_coordinates))-2,length(colnames(df_coordinates))-1,length(colnames(df_coordinates)))]=c(paste("F", indice, sep=""),  paste("ang", indice, sep=""), paste("Di", indice, sep=""), paste("Dj", indice, sep=""))
return(df_coordinates)
}
# Then
x = sort(runif(10000, 0, 99))
y = runif(10000, 0, 99)
plan = data.frame(x, y)
plan=forces(plan,10,20,1)
plan=forces(plan,90,80,2)
plot(1, type="n", axes=F, xlab="", ylab="", xlim=c(0,100), ylim=c(0,100))
points(plan$x, plan$y, pch=20, cex=0.3, col="red")
segments(plan$x,plan$y,plan$x+((plan$Di1+plan$Di2)*100),plan$y+((plan$Dj1+plan$Dj2)*100), col=colors()[abs(atan2(plan$ang2,plan$ang1)*cos(plan$ang1))*150], lwd=4)

# colour variations
# col=colors()[abs(sin(plan$ang2)*cos(plan$ang1))*20]
# col=colors()[2^(sin(plan$ang2)*cos(plan$ang1))*20]
forces <- function(df_coordinates, X, Y, indice){
df_coordinates$F =cos( sqrt((df_coordinates$x-X)^2 + (df_coordinates$y-Y)^2) )
df_coordinates$ang = atan2(df_coordinates$y-Y, df_coordinates$x-X)
df_coordinates$Di = df_coordinates$F * cos(df_coordinates$ang)
df_coordinates$Dj = df_coordinates$F * sin(df_coordinates$ang)
colnames(df_coordinates)[c(length(colnames(df_coordinates))-3,length(colnames(df_coordinates))-2,length(colnames(df_coordinates))-1,length(colnames(df_coordinates)))]=c(paste("F", indice, sep=""),  paste("ang", indice, sep=""), paste("Di", indice, sep=""), paste("Dj", indice, sep=""))
return(df_coordinates)
}
# then
x = sort(runif(10000, 0, 99))
y = runif(10000, 0, 99)
plan = data.frame(x, y)
plan=forces(plan,20,80,1)
plan=forces(plan,80,20,2)
par(mar=c(1,1,0,0), bg="gray15")
plot(1, type="n", axes=F, xlab="", ylab="", xlim=c(0,100), ylim=c(0,100))

segments(plan$x,plan$y,plan$x-(exp(plan$Di1)/exp(plan$Di2)),plan$y-(exp(plan$Dj1)/exp(plan$Dj2)), col=rgb(runif(1000),0,0,1), lwd=3)
forces <- function(df_coordinates, X, Y, indice){
df_coordinates$F =cos( sqrt((df_coordinates$x-X)^2 + (df_coordinates$y-Y)^2) )
df_coordinates$ang = atan2(df_coordinates$y-Y, df_coordinates$x-X)
df_coordinates$Di = df_coordinates$F * cos(df_coordinates$ang)
df_coordinates$Dj = df_coordinates$F * sin(df_coordinates$ang)
colnames(df_coordinates)[c(length(colnames(df_coordinates))-3,length(colnames(df_coordinates))-2,length(colnames(df_coordinates))-1,length(colnames(df_coordinates)))]=c(paste("F", indice, sep=""),  paste("ang", indice, sep=""), paste("Di", indice, sep=""), paste("Dj", indice, sep=""))
return(df_coordinates)
}
# then
x = sort(runif(10000, 0, 99))
y = runif(10000, 0, 99)
plan = data.frame(x, y)
plan=forces(plan,10,10,1)
plan=forces(plan,90,90,2)
par(mar=c(1,1,0,0), bg="gray15")
plot(1, type="n", axes=F, xlab="", ylab="", xlim=c(0,100), ylim=c(0,100))
points(plan$x, plan$y, pch=20, cex=0.3, col="red")
segments(plan$x,plan$y,plan$x-(exp(plan$Di1)/exp(plan$Di2)),plan$y-(exp(plan$Dj1)/exp(plan$Dj2)), col="gray98", lwd=3)
acceleration <- function (X, Y, masse, indice){
    x = sort(runif(10000, 0, 99))
    y = runif(10000, 0, 99)
    plan = data.frame(x, y)
    distance = sqrt((plan$x-X)^2 + (plan$y-Y)^2)
    G = 10
    plan$F = distance^(3/2) /(G * masse)
    plan$ang = atan2(plan$y-Y, plan$x-X)
    plan$Di = (1+plan$F) * cos(plan$ang) # 1 to view null force
    plan$Dj = (1+plan$F) * sin(plan$ang) # to view null force
    # following manipulation not required but kept for future developments
    colnames(plan)[c(length(colnames(plan))-3,length(colnames(plan))-2,length(colnames(plan))-1,length(colnames(plan)))]=c(paste("F", indice, sep=""),  paste("ang", indice, sep=""), paste("Di", indice, sep=""), paste("Dj", indice, sep=""))
    plot(1, type="n", axes=F, xlab="", ylab="", xlim=c(0,100), ylim=c(0,100))
    segments(plan$x,plan$y,plan$x+((plan$Di1)),plan$y+((plan$Dj1)), col="darkgreen", lwd=1)
}

以上是关于r 在计划中加速工作。注意,“加速因子”仍然需要工作,加速因子是加速度.r - 与经典f相反的主要内容,如果未能解决你的问题,请参考以下文章

通知 | 广东省工信厅已启动大数据/人工智能骨干(培育)企业遴选及复审工作!注意这些信息

软工网络15团队作业4——Alpha阶段敏捷冲刺-5

计划三年投入十亿资金,统信UOS生态腾飞加速

软工网络15团队作业2——团队计划

软工网络15团队作业4——Alpha阶段敏捷冲刺-7

r 用于抽取水合物的重新编码。动态cex和颜色仍然需要一些工作