getting started with symbolics
Title
Question
<pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">Dear All</span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">I am getting following error whilw finding value of sin pi/4 </span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">
</span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">i typed n(sin(pi/4))in jupyter notebook shell</span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">
</span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">TypeError</span> Traceback (most recent call last) <span class="ansi-green-fg" style="color: rgb(0, 162, 80);"><ipython-input-26-16cf6d20b88c></span> in <span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);"><module></span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">()</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">----> 1</span><span class="ansi-red-fg" style="color: rgb(231, 92, 88);"> </span>n<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>sin<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>pi<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">/</span>Integer<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span><span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);">4</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/misc/functional.py</span> in <span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);">numerical_approx</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(x, prec, digits, algorithm)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1417</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">return</span> numerical_approx_generic<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>x<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">,</span> prec<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1418</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">else</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">:</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">-> 1419</span><span class="ansi-red-fg" style="color: rgb(231, 92, 88);"> </span><span class="ansi-green-fg" style="color: rgb(0, 162, 80);">return</span> n<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>prec<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">,</span> algorithm<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">=</span>algorithm<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1420</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1421</span> n <span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">=</span> numerical_approx <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx</span> in <span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);">sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:34714)</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">()</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 5998</span> res <span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">=</span> x<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">.</span>pyobject<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 5999</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">else</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">:</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">-> 6000</span><span class="ansi-red-fg" style="color: rgb(231, 92, 88);"> </span><span class="ansi-green-fg" style="color: rgb(0, 162, 80);">raise</span> TypeError<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">"cannot evaluate symbolic expression numerically"</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 6001</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 6002</span> <span class="ansi-red-fg" style="color: rgb(231, 92, 88);"># Important -- the we get might not be a valid output for numerical_approx in</span> <span class="ansi-red-fg" style="color: rgb(231, 92, 88);">TypeError</span>: cannot evaluate symbolic expression numerically</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">
</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">
</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">kindly suggest</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">
</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">regards</pre>
</span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">i typed n(sin(pi/4))in jupyter notebook shell</span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">
</span></pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;"><span class="ansi-red-fg" style="color: rgb(231, 92, 88);">TypeError</span> Traceback (most recent call last) <span class="ansi-green-fg" style="color: rgb(0, 162, 80);"><ipython-input-26-16cf6d20b88c></span> in <span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);"><module></span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">()</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">----> 1</span><span class="ansi-red-fg" style="color: rgb(231, 92, 88);"> </span>n<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>sin<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>pi<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">/</span>Integer<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span><span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);">4</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/misc/functional.py</span> in <span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);">numerical_approx</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(x, prec, digits, algorithm)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1417</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">return</span> numerical_approx_generic<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>x<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">,</span> prec<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1418</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">else</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">:</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">-> 1419</span><span class="ansi-red-fg" style="color: rgb(231, 92, 88);"> </span><span class="ansi-green-fg" style="color: rgb(0, 162, 80);">return</span> n<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span>prec<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">,</span> algorithm<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">=</span>algorithm<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1420</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 1421</span> n <span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">=</span> numerical_approx <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx</span> in <span class="ansi-cyan-fg" style="color: rgb(96, 198, 200);">sage.symbolic.expression.Expression.numerical_approx (build/cythonized/sage/symbolic/expression.cpp:34714)</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">()</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 5998</span> res <span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">=</span> x<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">.</span>pyobject<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 5999</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">else</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">:</span> <span class="ansi-green-fg" style="color: rgb(0, 162, 80);">-> 6000</span><span class="ansi-red-fg" style="color: rgb(231, 92, 88);"> </span><span class="ansi-green-fg" style="color: rgb(0, 162, 80);">raise</span> TypeError<span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">(</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">"cannot evaluate symbolic expression numerically"</span><span class="ansi-blue-fg" style="color: rgb(32, 143, 251);">)</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 6001</span> <span class="ansi-green-intense-fg ansi-bold" style="color: rgb(0, 116, 39); font-weight: bold;"> 6002</span> <span class="ansi-red-fg" style="color: rgb(231, 92, 88);"># Important -- the we get might not be a valid output for numerical_approx in</span> <span class="ansi-red-fg" style="color: rgb(231, 92, 88);">TypeError</span>: cannot evaluate symbolic expression numerically</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">
</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">
</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">kindly suggest</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">
</pre><pre style="font-family: monospace; padding: 1px 0px; margin-bottom: 0px; line-height: inherit; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border-width: 0px; border-style: initial; border-color: initial; overflow: auto; vertical-align: baseline;">regards</pre>
Python Getting-started-with-symbolics 00-01 min 10-20 sec
Answers:
Just type n * sin(pi/4) inside the ipython terminal.
Login to add comment