Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9726 > unrolled thread
| Started by | Eduardo Fontana <prof.eduardofontana@gmail.com> |
|---|---|
| First post | 2012-04-21 04:35 +0000 |
| Last post | 2012-04-24 09:30 +0000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
evaluating functions and displaying results numerically Eduardo Fontana <prof.eduardofontana@gmail.com> - 2012-04-21 04:35 +0000
Re: evaluating functions and displaying results numerically "Kevin J. McCann" <kjm@KevinMcCann.com> - 2012-04-22 10:10 +0000
Re: evaluating functions and displaying results numerically "Nasser M. Abbasi" <nma@12000.org> - 2012-04-22 10:07 +0000
Re: evaluating functions and displaying results numerically Eduardo Fontana <prof.eduardofontana@gmail.com> - 2012-04-24 09:30 +0000
| From | Eduardo Fontana <prof.eduardofontana@gmail.com> |
|---|---|
| Date | 2012-04-21 04:35 +0000 |
| Subject | evaluating functions and displaying results numerically |
| Message-ID | <jmtdec$sjd$1@smc.vnet.net> |
Once in a while a face a problem with Mathematica in which I cannot get a straightforward numerical output. I have a function defined in mathematica, I try to evaluate the function with numerical arguments and mathematica returns a replica of my function with the same arguments. It must be something I set without noticing. I cannot get numerical results at all. In another instance, I have a summation of about 1000 terms defined as a function of 3 arguments. When I use numerical arguments, instead of Mathematica calculating a numerical result it generates a symbolic output with all 1000 terms. Even if a try something very simple such as In[1]: Sin[1] the output is Out[1]: Sin[1] Could anyone give me a clue on this? regards
[toc] | [next] | [standalone]
| From | "Kevin J. McCann" <kjm@KevinMcCann.com> |
|---|---|
| Date | 2012-04-22 10:10 +0000 |
| Message-ID | <jn0lem$501$1@smc.vnet.net> |
| In reply to | #9726 |
The output Sin[1] is what is called an "exact", i.e. you gave Mathematica an exact input 1, not 1.0; so, Mathematica returned an exact. If you want a function to give a numerical, i.e. machine precision output, do something like this: Sin[1]//N or N[Sin[1]] That is, wrap the result in N[], the number function. Cheers, Kevin On 4/21/2012 12:35 AM, Eduardo Fontana wrote: > Once in a while a face a problem with Mathematica in which I cannot > get a straightforward numerical output. > I have a function defined in mathematica, I try to evaluate the > function with numerical arguments and mathematica returns a replica of > my function with the same arguments. It must be something I set > without noticing. I cannot get numerical results at all. > In another instance, I have a summation of about 1000 terms defined as > a function of 3 arguments. When I use numerical arguments, instead of > Mathematica calculating a numerical result it generates a symbolic > output with all 1000 terms. Even if a try something very simple such > as > In[1]: Sin[1] > the output is > Out[1]: Sin[1] > Could anyone give me a clue on this? > regards >
[toc] | [prev] | [next] | [standalone]
| From | "Nasser M. Abbasi" <nma@12000.org> |
|---|---|
| Date | 2012-04-22 10:07 +0000 |
| Message-ID | <jn0l9t$4uk$1@smc.vnet.net> |
| In reply to | #9726 |
On 4/20/2012 11:35 PM, Eduardo Fontana wrote: > Once in a while a face a problem with Mathematica in which I cannot > get a straightforward numerical output. > I have a function defined in mathematica, I try to evaluate the > function with numerical arguments and mathematica returns a replica of > my function with the same arguments. It must be something I set > without noticing. I cannot get numerical results at all. > In another instance, I have a summation of about 1000 terms defined as > a function of 3 arguments. When I use numerical arguments, instead of > Mathematica calculating a numerical result it generates a symbolic > output with all 1000 terms. Even if a try something very simple such > as > In[1]: Sin[1] > the output is > Out[1]: Sin[1] > Could anyone give me a clue on this? > regards > thats becuase it defaults to keeping things in symbolic form. If you want numeric result, then you need to tell it. Either use In[2]:= Sin[1.] Out[2]= 0.841471 or use N on the result In[3]:= N[Sin[1],$MachinePrecision] Out[3]= 0.8414709848078965 --Nasser
[toc] | [prev] | [next] | [standalone]
| From | Eduardo Fontana <prof.eduardofontana@gmail.com> |
|---|---|
| Date | 2012-04-24 09:30 +0000 |
| Message-ID | <jn5rrp$npt$1@smc.vnet.net> |
| In reply to | #9726 |
> My reply to Kevin is now being sent to others who kindly replied to this topic. I attached a image file but it was returned by the moderator. > Please read my comments below to Kevin and extensive to others who might help. The output file is in a pdf document on google docs on the link below. regards to all Eduardo Dear Kevin > thanks for your reply. I can go along with your explanation, even though I havent had this interpretation of results from Mathematica before. I never had to use the N option befor. What about my second enquire, reproduced below >>> In another instance, I have a summation of about 1000 terms defined as >>> a function of 3 arguments. When I use numerical arguments to calculate the summation, instead of >>> Mathematica calculating a numerical result it generates a symbolic >>> output with all 1000 terms. > It doesnt make sense that Mathematica chooses to do the whole thing symbolically. I have made similar calculations before, and Mathematica performed the calculation numerically. I presume that I have enabled some sort of symbolic calculation, but I cannot find where. I am attaching a a link to a pdf file showing a image of the generated result for my function called "Absorption". The other functions are defined prior to the definition of Absorption. I just want to show the type of result generated. Also, If I want to plot my function Absorption relative to one of the arguments, Mathematica just doesnt plot it. > Best regards The output image is in the google docs file below https://docs.google.com/open?id=0Bw08G8QtolpXUDBnQUswdXUyVE0 Eduardo Fontana, PhD Professor Titular Dep. de Eletr=F4nica e Sistemas UFPE - Centro de Tecnologia e Geoci=EAncias Bloco A, Sala 421 Recife - PE 50.740-550 Skype: edu.fontana Phones: +5581-21267792, +5511-30424021 http://www.ufpe.br/fontana > > 2012/4/21 Kevin J. McCann <kjm@kevinmccann.com>: >> The output Sin[1] is what is called an "exact", i.e. you gave Mathematica an exact >> input 1, not 1.0; so, Mathematica returned an exact. If you want a function = to give >> a numerical, i.e. machine precision output, do something like this: >> >> Sin[1]//N >> >> or >> >> N[Sin[1]] >> >> That is, wrap the result in N[], the number function. >> >> Cheers, >> >> Kevin >> >> On 4/21/2012 12:35 AM, Eduardo Fontana wrote: >>> >>> Once in a while a face a problem with Mathematica in which I cannot >>> get a straightforward numerical output. >>> I have a function defined in mathematica, I try to evaluate the >>> function with numerical arguments and mathematica returns a replica of >>> my function with the same arguments. It must be something I set >>> without noticing. I cannot get numerical results at all. >>> In another instance, I have a summation of about 1000 terms defined as >>> a function of 3 arguments. When I use numerical arguments, instead of >>> Mathematica calculating a numerical result it generates a symbolic >>> output with all 1000 terms. Even if a try something very simple such >>> as >>> In[1]: Sin[1] >>> the output is >>> Out[1]: Sin[1] >>> Could anyone give me a clue on this? >>> regards >>> >> > > > > -- > Eduardo Fontana, PhD > Professor Titular > Dep. de Eletr=F4nica e Sistemas > UFPE - Centro de Tecnologia e Geoc=EAncias, Bloco A, Sala 421 > Recife - Pernambuco - 50.740-550 > Fone (Phone): +5581-21267792 > Skype Phone: +5511-30424021 > Skype: edu.fontana > > On Apr 21, 2012, at 8:16 AM, Kevin J. McCann wrote: > >> The output Sin[1] is what is called an "exact", i.e. you gave Mathematica an exact input 1, not 1.0; so, Mathematica returned an exact. If you want a function to give a numerical, i.e. machine precision output, do something like this: >> >> Sin[1]//N >> >> or >> >> N[Sin[1]] >> >> That is, wrap the result in N[], the number function. >> >> Cheers, >> >> Kevin >> >> On 4/21/2012 12:35 AM, Eduardo Fontana wrote: >>> Once in a while a face a problem with Mathematica in which I cannot >>> get a straightforward numerical output. >>> I have a function defined in mathematica, I try to evaluate the >>> function with numerical arguments and mathematica returns a replica of >>> my function with the same arguments. It must be something I set >>> without noticing. I cannot get numerical results at all. >>> In another instance, I have a summation of about 1000 terms defined as >>> a function of 3 arguments. When I use numerical arguments, instead of >>> Mathematica calculating a numerical result it generates a symbolic >>> output with all 1000 terms. Even if a try something very simple such >>> as >>> In[1]: Sin[1] >>> the output is >>> Out[1]: Sin[1] >>> Could anyone give me a clue on this? >>> regards >>> > > Eduardo Fontana, PhD > Professor Titular > Dep. de Eletr=F4nica e Sistemas > UFPE - Centro de Tecnologia e Geoci=EAncias > Bloco A, Sala 421, Recife - PE 50740-550 > > >
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web