Virginia has used algorithms in its sentencing process for more than a decade.

But legal tests have been few. A prison sentence involving Compas was previously appealed in Wisconsin and upheld. In Indiana, the State Supreme Court ruled in 2010 that judges could consider risk assessments as one of several factors in handing down sentences.

Are the algorithms used only for sentencing?

Many law enforcement agencies use software to predict potential crime hot spots, and the police in Kansas City, Mo., and other places have used data to identify potential criminals and to try to intervene.

“This is just the next innovation of crime analysis — trying to get ahead of the problem, trying to predict where problems occur before they actually occur,” said Eric L. Piza, an assistant professor at the John Jay College of Criminal Justice who studies predictive policing.

In Chicago, where there has been a sharp rise in violent crime this year, the police have used an algorithm to compile a list of people most likely to shoot or be shot. Over Memorial Day weekend, when 64 people were shot in Chicago, the police said 50 of the victims were on that list.

Algorithms like Compas are also used commonly in prison systems to identify the types of supervision inmates might need, the most appropriate type of incarceration and the risk of committing another crime if released on bail or parole.

In Wisconsin, Tristan Cook, a spokesman for the state’s Department of Corrections, said Compas scores were used to help with inmate classification and release planning and were also available to sentencing judges upon request.

Why use algorithms?

There is general support for identifying people who pose little threat to the community, so they could be taken out of America’s crowded prison systems. Such algorithms are also seen as a way to dispense justice in a more efficient way that relies more on numerical evidence than on personal judgments.