added a cache to avoid recompiting pdf whose variable did not change: simulate derivative computation