[prev in list] [next in list] [prev in thread] [next in thread]
List: gnuplot-info
Subject: Re: Function evaluation problem!!!
From: thopmanNOSPAM () uoguelph ! ca (Theo Hopman)
Date: 1999-07-09 13:00:18
[Download RAW message or body]
: I have a wierd function evaluation problem which works on some OS and not
: on others!!!
: I defined the following exponential series with 16 terms
: fit1(x,n)=8/(pi**2*(2*n+1)**2)*exp(-((2*n+1)**2*D*pi**2*x/4E-6))
: rsum1(x,n)= n>15 ? 0 : fit1(x,n)+rsum1(x,n+1)
: singlefit(x)=rsum1(x,0)
: This is to fit my data to a diffusion equation. My starting value is the
: following (not does it really matters for this problem)
: pi is already defined in gnuplot
: D=1e-9
[snip]
I see two possible problems: the first is that "exp(-x) returns undefined
for very large x" (`help expressions function exp`) on some
implementations. My experience has been that "large" isn't very large at
all, but on the order of 100. If I evaluate the argument to the
exponential, for n=10, x=314, it comes out to ~-341. This is the most
likely source of your problems. See the help on exp for a solution to
this problem.
The second is that you're mixing integer and floating point. I know
gnuplot is supposed to promote integers to floating point, but my
experience has been that this doesn't always work. Explicitely forcing
numbers to be floating point by entering 2.0 instead of 2 will avoid any
possible conversion problems.
THeo
.
- -
[[[[ to unsubscribe from info-gnuplot, send an email with body
unsubscribe info-gnuplot
to majordomo@dartmouth.edu
]]]]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic