There are few tasks more daunting for a filmmaker than straddling the line between comedy and tragedy. It is hard enough to establish a tone for a movie without the added challenge of making the funny stuff and the melancholy moments work together like the ingredients of a magic potion.

So hats off to writer-director Tamara Jenkins (her debut film in 1998 was the semiautobiographical Slums of Beverly Hills) for succeeding where so many other moviemakers have fallen short.

The Savages is a near-perfect mix of guffaws and boo-hoos that takes a long, hard look at ironies of the human condition. This potent mix includes a tight and smart script and a trio of supremely talented actors. The tragedy concerns a father who is falling victim to dementia. The humor stems from the mismatched pair of siblings who had all but forgotten their father and now must rally together after years apart to address the man’s dilemma. The tragicomedy makes its appearance once we discover that the old man had been a terrible father and that his offspring are being asked to do more for him than he ever did for them.

The chameleon-like actress Laura Linney portrays Wendy Savage, an aspiring playwright who bounces from temp job to temp job, stealing pens and notebooks along the way, while applying for various grants that she never obtains. Wendy is trying to make some sense out of her life, which started to spin out of control when her mother disappeared years earlier. Her only relationships of note are with her cat and with a married stage director (Peter Friedman) who lives in her building in NewYork City.

Her older brother, Jon, played by the always welcome and very busy Philip Seymour Hoffman, is a slow-moving wreck. He teaches drama at a university in Buffalo while trying to complete his long-gestating tome on German playwright Bertolt Brecht. He lives with a woman from Poland, but at 42 he’s not yet “ready” to marry. His lectures about the differences between emotion and intellect in the theatre seem to reflect the problems in his own disheveled life.

The third member of this triangle, Lenny Savage (Philip Bosco), is the crotchety man who is slowly dying in Arizona and also losing his sense of time and place. Jon wants to place him in a slightly run-down nursing home in Buffalo, while Wendy, true to her unrealistic ambitions, imagines her father in a sprawling green rehabilitation center in Vermont.

The story is driven by the numerous conflicts that confront these characters. While both Wendy and Jon have their problems with Lenny, who does not take kindly to being told what to do, the main drama plays out between the siblings, who rediscover their similarities and differences while carrying out a task that neither of them is prepared for. The task is especially painful for Wendy, who was having enough trouble dealing with her failed ambitions, her midday lover, her neurotic cat, the attractive Nigerian care worker at the nursing home, and her absent mother—and now must contend with a once powerful and capable man who can no longer control his bowels.

Unlike other attempts at tragicomedy (think of the mid-career films of Woody Allen), which tend to reach for pure tragedy or comedy by the end, The Savages does an admirable job of embracing both modes even as it rolls out a surprisingly upbeat conclusion.