MaplePrimes - Questions and Posts tagged with evalf
http://www.mapleprimes.com/tags/evalf
en-us2017 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemSat, 23 Sep 2017 02:04:45 GMTSat, 23 Sep 2017 02:04:45 GMTThe most recent questions and posts on MaplePrimes tagged with evalfhttp://www.mapleprimes.com/images/mapleprimeswhite.jpgMaplePrimes - Questions and Posts tagged with evalf
http://www.mapleprimes.com/tags/evalf
Trouble with evalf() in generating a matrix
https://www.mapleprimes.com/questions/222769-Trouble-With-Evalf-In-Generating-A-Matrix?ref=Feed:MaplePrimes:Tagged With evalf
<p>The link below has my code for generating 2 matrices. The 1st one does not generate flfoating point numerical data; whereas, the 2nd one does. What is wrong with the 1st case? I am attempting to single out one harmonic which works in the 2nd case. Also, is there a way I can generate a spectrum of S2(k= 1 to 100, t= 0 to 1)?</p>
<p>?<a href="/view.aspx?sf=222769_question/untitled6.mw">untitled6.mw</a></p>
<p> </p>
<p>The link below has my code for generating 2 matrices. The 1st one does not generate flfoating point numerical data; whereas, the 2nd one does. What is wrong with the 1st case? I am attempting to single out one harmonic which works in the 2nd case. Also, is there a way I can generate a spectrum of S2(k= 1 to 100, t= 0 to 1)?</p>
<p>?<a href="/view.aspx?sf=222769_question/untitled6.mw">untitled6.mw</a></p>
<p> </p>
222769Tue, 19 Sep 2017 01:19:38 ZtsunamiBTPtsunamiBTPMeijerG simplifications and numerics
https://www.mapleprimes.com/questions/222639-MeijerG-Simplifications-And-Numerics?ref=Feed:MaplePrimes:Tagged With evalf
<p>It seems that simplify uses some transformations that aren't generically valid, and evalf relies on those transformations too:</p>
<p> </p>
<pre class="prettyprint">
nint := (fz, zrng) -> evalf(add(
int(fz, op(1, zrng) = op([2, i], zrng) .. op([2, i+1], zrng)),
i = 1 .. nops(op(2, zrng))-1));
</pre>
<pre class="prettyprint">
f1 := z -> MeijerG([[1/2], []], [[], []], z);
simplify(f1(z));
sqrt(1/z) exp(-1/z)
evalf(f1(-1));
-9
-1.672586379 10 + 2.718281828 I
f1(-1.);
-9
-1.672586379 10 - 2.718281828 I
nint(GAMMA(1/2+y)*(-1)^y, y = [-infinity-I, -I, I, -infinity+I])/(2*Pi*I);
-11
6.652676619 10 - 2.718281828 I
</pre>
<p>So it seems that evalf uses the simplified form, but that form doesn't agree with the definition of MeijerG for negative z. The form that does would be 1/sqrt(z)*exp(-1/z).</p>
<p> </p>
<pre class="prettyprint">
f2 := z -> MeijerG([[], [1]], [[0, 2], []], z);
simplify(f2(z));
exp(-z) z + exp(-z) - 1
evalf(f2(1));
-0.2642411177
f2(1.);
0.7357588823
nint(GAMMA(-y)*GAMMA(2-y)/GAMMA(1-y), y = [infinity-I, -1-I, -1+I, infinity+I])/(2*Pi*I);
0.7357588823 - 0. I
</pre>
<p>The result of simplify is off by -1. Just evaluating f2(1) doesn't use that transformation rule, but evalf apparently does.</p>
<p> </p>
<p>It seems that simplify uses some transformations that aren't generically valid, and evalf relies on those transformations too:</p>
<p> </p>
<pre class="prettyprint">
nint := (fz, zrng) -> evalf(add(
int(fz, op(1, zrng) = op([2, i], zrng) .. op([2, i+1], zrng)),
i = 1 .. nops(op(2, zrng))-1));
</pre>
<pre class="prettyprint">
f1 := z -> MeijerG([[1/2], []], [[], []], z);
simplify(f1(z));
sqrt(1/z) exp(-1/z)
evalf(f1(-1));
-9
-1.672586379 10 + 2.718281828 I
f1(-1.);
-9
-1.672586379 10 - 2.718281828 I
nint(GAMMA(1/2+y)*(-1)^y, y = [-infinity-I, -I, I, -infinity+I])/(2*Pi*I);
-11
6.652676619 10 - 2.718281828 I
</pre>
<p>So it seems that evalf uses the simplified form, but that form doesn't agree with the definition of MeijerG for negative z. The form that does would be 1/sqrt(z)*exp(-1/z).</p>
<p> </p>
<pre class="prettyprint">
f2 := z -> MeijerG([[], [1]], [[0, 2], []], z);
simplify(f2(z));
exp(-z) z + exp(-z) - 1
evalf(f2(1));
-0.2642411177
f2(1.);
0.7357588823
nint(GAMMA(-y)*GAMMA(2-y)/GAMMA(1-y), y = [infinity-I, -1-I, -1+I, infinity+I])/(2*Pi*I);
0.7357588823 - 0. I
</pre>
<p>The result of simplify is off by -1. Just evaluating f2(1) doesn't use that transformation rule, but evalf apparently does.</p>
<p> </p>
222639Sun, 03 Sep 2017 16:23:43 Z_Maxim__Maxim_solve z^(1+I)=1
https://www.mapleprimes.com/questions/222609-Solve-Z1I1?ref=Feed:MaplePrimes:Tagged With evalf
<pre class="prettyprint">
solve(z^(1+I) = 1, z, allsolutions = true);
exp((1 + I) Pi _Z1)
getassumptions(_Z1);
{_Z1::integer}
</pre>
<p>Since this is a single-valued power function, there is only a finite number of solutions. evalc correctly gives exp(-2*Pi) for _Z1=-1.</p>
<p>evalf doesn't help here regardless of the level of precision, I think because it always generates a non-zero imaginary part for exp(-(1+I)*Pi):</p>
<pre class="prettyprint">
seq(print(evalf(evalf[d]((exp((-1-I)*Pi))^(1+I)))), d = 10 .. 3010, 300);
-12
0.001867442732 - 1.361179007 10 I
-312
0.001867442732 - 1.674479874 10 I
-610
1.000000000 + 2.386571217 10 I
-910
1.000000000 + 8.502509375 10 I
-1212
0.001867442732 - 1.646483173 10 I
-1514
0.001867442732 - 4.556560265 10 I
-1812
0.001867442732 - 1.287611101 10 I
-2112
0.001867442732 - 1.072784224 10 I
-2410
1.000000000 + 8.162729354 10 I
-2713
0.001867442732 - 7.375390371 10 I
-3010
1.000000000 + 1.988371005 10 I
</pre>
<p>Unrelated, but it would be nice to have a simple way to display lists/matrices with specified width and alignment.</p>
<p> </p>
<pre class="prettyprint">
solve(z^(1+I) = 1, z, allsolutions = true);
exp((1 + I) Pi _Z1)
getassumptions(_Z1);
{_Z1::integer}
</pre>
<p>Since this is a single-valued power function, there is only a finite number of solutions. evalc correctly gives exp(-2*Pi) for _Z1=-1.</p>
<p>evalf doesn't help here regardless of the level of precision, I think because it always generates a non-zero imaginary part for exp(-(1+I)*Pi):</p>
<pre class="prettyprint">
seq(print(evalf(evalf[d]((exp((-1-I)*Pi))^(1+I)))), d = 10 .. 3010, 300);
-12
0.001867442732 - 1.361179007 10 I
-312
0.001867442732 - 1.674479874 10 I
-610
1.000000000 + 2.386571217 10 I
-910
1.000000000 + 8.502509375 10 I
-1212
0.001867442732 - 1.646483173 10 I
-1514
0.001867442732 - 4.556560265 10 I
-1812
0.001867442732 - 1.287611101 10 I
-2112
0.001867442732 - 1.072784224 10 I
-2410
1.000000000 + 8.162729354 10 I
-2713
0.001867442732 - 7.375390371 10 I
-3010
1.000000000 + 1.988371005 10 I
</pre>
<p>Unrelated, but it would be nice to have a simple way to display lists/matrices with specified width and alignment.</p>
<p> </p>
222609Tue, 29 Aug 2017 20:45:07 Z_Maxim__Maxim_How do I display the numeric value for a trig function such as cos(pi/4)
https://www.mapleprimes.com/questions/222393-How-Do-I-Display-The-Numeric-Value-For?ref=Feed:MaplePrimes:Tagged With evalf
<p>when I enter a trig function as cos(pi/2) I get as a return the same input. What I would like is the numeric answer displayed. also there are times when I don't want pi in the answer but a numeric value calculated based on pi * whatever.</p>
<p>Thanks</p>
<p>Bill</p>
<p>when I enter a trig function as cos(pi/2) I get as a return the same input. What I would like is the numeric answer displayed. also there are times when I don't want pi in the answer but a numeric value calculated based on pi * whatever.</p>
<p>Thanks</p>
<p>Bill</p>
222393Mon, 24 Jul 2017 20:16:34 ZWtolrudWtolrudDifference between eval and evalf
https://www.mapleprimes.com/questions/222022-Difference-Between-Eval-And-Evalf?ref=Feed:MaplePrimes:Tagged With evalf
<p>I am interested to know difference between eval and evalf. Will evaluating a function at a point using these commands gives the same answer or not. I mean will there will be any exception or not. How can I evaluate the value of a series using eval instead of evalf without the problem of memory running out (No comprimise in accuracy).</p>
<p>I am interested to know difference between eval and evalf. Will evaluating a function at a point using these commands gives the same answer or not. I mean will there will be any exception or not. How can I evaluate the value of a series using eval instead of evalf without the problem of memory running out (No comprimise in accuracy).</p>
222022Thu, 01 Jun 2017 19:55:43 Zkuwait1kuwait1Performance issue with evalf on integral
https://www.mapleprimes.com/questions/221706-Performance-Issue-With-Evalf-On-Integral?ref=Feed:MaplePrimes:Tagged With evalf
<p>I have many integrals which I would like to calculate the value. The one in attachment is the simpliest example.</p>
<p>It shows 'too many level of recursion',</p>
<p>I know that it has something to do with the piecewise, however, it shouldn't, right? Any insights?</p>
<p><a href="/view.aspx?sf=221706_question/evalfandintPerformance.mw">evalfandintPerformance.mw</a></p>
<p><a href="/view.aspx?sf=221706_question/evalfandintPerformance.pdf">evalfandintPerformance.pdf</a></p>
<p>I have many integrals which I would like to calculate the value. The one in attachment is the simpliest example.</p>
<p>It shows 'too many level of recursion',</p>
<p>I know that it has something to do with the piecewise, however, it shouldn't, right? Any insights?</p>
<p><a href="/view.aspx?sf=221706_question/evalfandintPerformance.mw">evalfandintPerformance.mw</a></p>
<p><a href="/view.aspx?sf=221706_question/evalfandintPerformance.pdf">evalfandintPerformance.pdf</a></p>
221706Sat, 15 Apr 2017 10:40:22 Zdellairdellair