0

In R markdown, I can easily calculate the values of a equation and output by inserting it in latex to be able to show the equation with the symbol, the substituted values and the final calculated answer.

We are given
sample mean = $\mu$= `r sample_mean`
sample standard deviation = $\sigma$ = `r pop_sd`
n = `r n`
Confidence interval = `r CI`
$\alpha/2$ = (1-`r CI`)/2= `r alpha_2`
Using the Normal distribution table, we find the zstat for $\alpha/2$ = `r alpha_2` 
zstat = `r zstat`
SE = $\frac{\sigma}{\sqrt{n}}=\frac{`r pop_sd`}{\sqrt{`r n`}}=`r se`$
Margin of error (ME) = $zstat \times \frac{\sigma}{\sqrt{n}}=  `r zstat`  \times \frac{`r pop_sd`}{\sqrt{`r n`}}=`r me`$
Confidence Interval = $\mu \pm ME$= ` `r sample_mean`$\pm$ `r me`
Therefore the `r CI*100`% confidence interval for the mean is (`r lower_limit`, `r upper_limit`)

The output of the above code in Rmarkdown is as follow.

enter image description here

I have been trying to get a similar output in Jupyter notebook, but the substituting of python variable is giving me an error incase of \frac{}{}.

Note : I do understand from some other question on stakoverflow we need to use {{}} but this not really working in every case.

Can some one guide me as to how I can substitute and get well format output in jupyter. I need to repelicate it this in jupter notebook.

Vicky
  • 33
  • 1
  • 3

1 Answers1

0

Have you tried installing nbextensions per nilansh bansal's answer here?

nkerrison
  • 11
  • 2
  • Yes tried it but it not fulfilling my requirement. The example given by Nilansh does not seem to be working for \frac{}{} or more complicated equation. – Vicky Jul 27 '20 at 07:02