From 13a13bbe48b3143a55a48bcfcc630a2ccb1a4303 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Wed, 3 Jan 2024 19:42:12 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- sympy/intro/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sympy/intro/README.md b/sympy/intro/README.md index a101fbf..26eb585 100644 --- a/sympy/intro/README.md +++ b/sympy/intro/README.md @@ -170,3 +170,18 @@ result = sympy.dsolve(diffeq, f(x)) print(result) # -> Eq(f(x), (C1 + C2*x)*exp(x) + cos(x)/2) ``` +## [Numerical Evaluation](https://docs.sympy.org/latest/modules/evalf.html) + +```python +import sympy + +x, y = sympy.symbols("x y") + +expr = sympy.cos(x) + 1 +print(expr) # -> cos(x) + 1 +expr = expr.subs(x, 0.333 * sympy.pi) +print(expr) # -> cos(0.333*pi) + 1 +print(sympy.N(expr)) # -> 1.50090662536071 +``` + +