You can subscribe to this list here.
| 2001 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(83) |
Nov
(57) |
Dec
(111) |
| 2004 |
Jan
(38) |
Feb
(121) |
Mar
(107) |
Apr
(241) |
May
(102) |
Jun
(190) |
Jul
(239) |
Aug
(158) |
Sep
(184) |
Oct
(193) |
Nov
(47) |
Dec
(68) |
| 2005 |
Jan
(190) |
Feb
(105) |
Mar
(99) |
Apr
(65) |
May
(92) |
Jun
(250) |
Jul
(197) |
Aug
(128) |
Sep
(101) |
Oct
(183) |
Nov
(186) |
Dec
(42) |
| 2006 |
Jan
(102) |
Feb
(122) |
Mar
(154) |
Apr
(196) |
May
(181) |
Jun
(281) |
Jul
(310) |
Aug
(198) |
Sep
(145) |
Oct
(188) |
Nov
(134) |
Dec
(90) |
| 2007 |
Jan
(134) |
Feb
(181) |
Mar
(157) |
Apr
(57) |
May
(81) |
Jun
(204) |
Jul
(60) |
Aug
(37) |
Sep
(17) |
Oct
(90) |
Nov
(122) |
Dec
(72) |
| 2008 |
Jan
(130) |
Feb
(108) |
Mar
(160) |
Apr
(38) |
May
(83) |
Jun
(42) |
Jul
(75) |
Aug
(16) |
Sep
(71) |
Oct
(57) |
Nov
(59) |
Dec
(152) |
| 2009 |
Jan
(73) |
Feb
(213) |
Mar
(67) |
Apr
(40) |
May
(46) |
Jun
(82) |
Jul
(73) |
Aug
(57) |
Sep
(108) |
Oct
(36) |
Nov
(153) |
Dec
(77) |
| 2010 |
Jan
(42) |
Feb
(171) |
Mar
(150) |
Apr
(6) |
May
(22) |
Jun
(34) |
Jul
(31) |
Aug
(38) |
Sep
(32) |
Oct
(59) |
Nov
(13) |
Dec
(62) |
| 2011 |
Jan
(114) |
Feb
(139) |
Mar
(126) |
Apr
(51) |
May
(53) |
Jun
(29) |
Jul
(41) |
Aug
(29) |
Sep
(35) |
Oct
(87) |
Nov
(42) |
Dec
(20) |
| 2012 |
Jan
(111) |
Feb
(66) |
Mar
(35) |
Apr
(59) |
May
(71) |
Jun
(32) |
Jul
(11) |
Aug
(48) |
Sep
(60) |
Oct
(87) |
Nov
(16) |
Dec
(38) |
| 2013 |
Jan
(5) |
Feb
(19) |
Mar
(41) |
Apr
(47) |
May
(14) |
Jun
(32) |
Jul
(18) |
Aug
(68) |
Sep
(9) |
Oct
(42) |
Nov
(12) |
Dec
(10) |
| 2014 |
Jan
(14) |
Feb
(139) |
Mar
(137) |
Apr
(66) |
May
(72) |
Jun
(142) |
Jul
(70) |
Aug
(31) |
Sep
(39) |
Oct
(98) |
Nov
(133) |
Dec
(44) |
| 2015 |
Jan
(70) |
Feb
(27) |
Mar
(36) |
Apr
(11) |
May
(15) |
Jun
(70) |
Jul
(30) |
Aug
(63) |
Sep
(18) |
Oct
(15) |
Nov
(42) |
Dec
(29) |
| 2016 |
Jan
(37) |
Feb
(48) |
Mar
(59) |
Apr
(28) |
May
(30) |
Jun
(43) |
Jul
(47) |
Aug
(14) |
Sep
(21) |
Oct
(26) |
Nov
(10) |
Dec
(2) |
| 2017 |
Jan
(26) |
Feb
(27) |
Mar
(44) |
Apr
(11) |
May
(32) |
Jun
(28) |
Jul
(75) |
Aug
(45) |
Sep
(35) |
Oct
(285) |
Nov
(99) |
Dec
(16) |
| 2018 |
Jan
(8) |
Feb
(8) |
Mar
(42) |
Apr
(35) |
May
(23) |
Jun
(12) |
Jul
(16) |
Aug
(11) |
Sep
(8) |
Oct
(16) |
Nov
(5) |
Dec
(8) |
| 2019 |
Jan
(9) |
Feb
(28) |
Mar
(4) |
Apr
(10) |
May
(7) |
Jun
(4) |
Jul
(4) |
Aug
|
Sep
(4) |
Oct
|
Nov
(23) |
Dec
(3) |
| 2020 |
Jan
(19) |
Feb
(3) |
Mar
(22) |
Apr
(17) |
May
(10) |
Jun
(69) |
Jul
(18) |
Aug
(23) |
Sep
(25) |
Oct
(11) |
Nov
(20) |
Dec
(9) |
| 2021 |
Jan
(1) |
Feb
(7) |
Mar
(9) |
Apr
|
May
(1) |
Jun
(8) |
Jul
(6) |
Aug
(8) |
Sep
(7) |
Oct
|
Nov
(2) |
Dec
(23) |
| 2022 |
Jan
(23) |
Feb
(9) |
Mar
(9) |
Apr
|
May
(8) |
Jun
(1) |
Jul
(6) |
Aug
(8) |
Sep
(30) |
Oct
(5) |
Nov
(4) |
Dec
(6) |
| 2023 |
Jan
(2) |
Feb
(5) |
Mar
(7) |
Apr
(3) |
May
(8) |
Jun
(45) |
Jul
(8) |
Aug
|
Sep
(2) |
Oct
(14) |
Nov
(7) |
Dec
(2) |
| 2024 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
(7) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
(4) |
Dec
(14) |
| 2025 |
Jan
(22) |
Feb
(6) |
Mar
(5) |
Apr
(14) |
May
(6) |
Jun
(11) |
Jul
(19) |
Aug
|
Sep
(17) |
Oct
(1) |
Nov
(2) |
Dec
(18) |
| 2026 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Ethan M. <merritt@u.washington.edu> - 2011-01-12 19:44:36
|
On Wednesday, January 12, 2011 07:49:57 am mw...@gm... wrote:
[snip]
> I have implemented sum(a, b, "f") and sum(a, b, x, "g") in order to calculate finite sums:
>
> # calculate a finite sum
> f(n) = n
> print sum(1, 10, "f") # -> 55
>
> # calculate a finite sum with parameter x
>
> # fourier coefficients of some square wave
> fourier(k, x) = sin(3./2*k)/k * 2./3*cos(k*x)
> s(x) = 1./2 + sumx(1, 100, x, "fourier")
> plot s(x)
>
> I hope this is sufficient to understand why I want a parameter x (so one can plot some square waves and other things.)
I find that syntax rather confusing, but maybe it's just me.
My first thought would be to aim for
fourier(x) = for [k=1:100] sin(3./2*k)/k * 2./3*cos(k*x)
since that matches the iteration syntax already used elsewhere
in the set of gnuplot commands. I suspect the internal implementation
could still work more or less the way you have it, but the user
interface would be (for me anyhow) more obvious.
> As Mr. Bröker pointed out, there is a trick involving the tertinary operator '?' and recursion to sorta workaround. Originally I tried to plot the sum with '?' but I could only do so for 1..10, in case of 1..100 it said something about stack overflow.
I am inclined to agree with Hans-Bernhard that such a summation
meta-function is not required.
But feel free to provide a contrary argument.
The summation can easily be expressed as a simple recursive function.
The problem you saw with stack overflow probably resulted from failing to
order the terms so that the calculation involved tail-recursion.
E.g.
gnuplot> tailsum(N) = (N>0) ? tailsum(N-1) + N : 0
gnuplot> headsum(N) = (N>0) ? N + headsum(N-1) : 0
gnuplot> print tailsum(250)
31375
gnuplot> print headsum(250)
stack overflow
Now it is true that the current version of gnuplot imposes a further
limit on the recursion depth:
gnuplot> print tailsum(251)
recursion depth limit exceeded
It is currently a hard limit determined by
eval.h:#define STACK_DEPTH 250 /* maximum size of the execution stack */
But it's largely an arbitrary number to prevent run-away function evaluation.
It could be made a user-accessible parameter if there's a need for it.
> I have added below a working patch but would like you to have a look at it.
I don't really have much time right now.
Could you please upload it to the patch tracker on Sourceforge?
That way it won't get lost, you can update it whenever you want,
and testers can post comments and provide feedback.
> I have some things that are not clear to me, in particular:
>
> * Do I have to free the values that I have gotten using pop?
No.
> * In what order do I have to push i and x befor the call to f(i, x). I thought that I have to push them from right to left but that seems to contradicts my testing, now I am very unsure about it (even though it seems to work correctly).
If you are calling your own function then you need only be
consistent at both ends of the call. But in general the stack
is LIFO. pop() returns the value most recently push()ed
> * Do I have to alloc memeory for the values I push on the stack befor the call to f(.)?
The push() operation makes a copy.
It's up to you to manage allocate/free of the original.
> * This is only curiosity is arg in foo(union argument *arg) every used and if, what for?
I have wondered that myself :-)
> I would also like you to take a look at my addition to gnuplot.doc and proofread it.
Please put it on the patch tracker along with the patch itself.
> Finally it would be nice but not necessary if the function could be passed as 'f' instead of '"f", that is sum(1, 10, f), and even better as sum(n=[1:10], n) but I consider this as optional and very hard to do (at least with my knowledge).
That would not be a good idea, as it would prevent the use of string variables.
Consider:
ident(N) = N
f = "ident"
print sum(1, 10, f)
> Thank you again for your generous help without I would never have gone so far.
If you have this working now, I'd be interested to see some benchmarks.
Is there a performance benefit over using the existing mechanism of
defining a recursive function using tail-recursion?
Is there a real-world use that requires summing over more than 250 terms?
Ethan
> Thank you,
> Micha Wiedenmann
>
> --- eval.c.orig 2011-01-11 17:38:00.000000000 +0100
> +++ eval.c 2011-01-12 16:19:05.000000000 +0100
> @@ -176,6 +176,9 @@
> {"atanh", f_atanh},
> {"lambertw", f_lambertw}, /* HBB, from G.Kuhnle 20001107 */
>
> + {"sum", f_sum}, /* summation sum(a, b, "f") = \sum_{i=a}^b f(i) */
> + {"sumx", f_sumx}, /* summation sum(a, b, x, "f") = \sum_{i=a}^b f(i, x) (with parameter x) */
> +
> {"column", f_column}, /* for using */
> {"valid", f_valid}, /* for using */
> {"timecolumn", f_timecolumn}, /* for using */
> @@ -689,6 +692,20 @@
> return (*udv_ptr);
> }
>
> +struct udft_entry *
> +get_udf_by_name(char *key)
> +{
> + struct udft_entry *udf_ptr = first_udf;
> +
> + while (udf_ptr) {
> + if (!strcmp(key, udf_ptr->udf_name))
> + return udf_ptr;
> +
> + udf_ptr = udf_ptr->next_udf;
> + }
> +
> + return NULL;
> +}
>
> static void update_plot_bounds __PROTO((void));
> static void fill_gpval_axis __PROTO((AXIS_INDEX axis));
> --- eval.h.orig 2011-01-11 17:38:21.000000000 +0100
> +++ eval.h 2011-01-12 15:54:30.000000000 +0100
> @@ -164,6 +164,7 @@
> void apollo_pfm_catch __PROTO((void));
> #endif
> struct udvt_entry * add_udv_by_name __PROTO((char *key));
> +struct udft_entry * get_udf_by_name __PROTO((char *key));
>
> /* update GPVAL_ variables available to user */
> void update_gpval_variables __PROTO((int from_plot_command));
> --- specfun.c.orig 2011-01-11 17:37:27.000000000 +0100
> +++ specfun.c 2011-01-12 16:14:28.000000000 +0100
> @@ -49,6 +49,7 @@
> #include "specfun.h"
> #include "stdfn.h"
> #include "util.h"
> +#include "internal.h"
>
> #define ITMAX 200
>
> @@ -1933,3 +1934,130 @@
> push(Gcomplex(&a, x, 0.0));
> }
>
> +/* Finite summation
> + *
> + * Calculate the finite sum(a, b, "f") = \sum_{i=a}^b f(i), where "f" is the
> + * name (a string) of f(i), a function taking one (integer) parameter i.
> + */
> +void
> +f_sum(union argument *arg)
> +{
> + struct value tmp;
> + int a, b; // bounds [a, b]
> + struct cmplx ret;
> + int i;
> + struct udft_entry *udf;
> + union argument call_arg;
> +
> + (void) arg; /* avoid -Wunused warning */
> +
> + // pop function name
> + if (pop(&tmp)->type != STRING)
> + int_error(NO_CARET, "expecting a name of a function with 1 parameters as 3rd argument to sum");
> + if (!(udf = get_udf_by_name(tmp.v.string_val)))
> + int_error(NO_CARET, "No user-defined function %s", tmp.v.string_val);
> +
> + // pop upper bound (b)
> + if (pop(&tmp)->type != INTGR)
> + int_warn(NO_CARET, "expecting an integer as 2nd argument to sum");
> + b = tmp.v.int_val;
> +
> + // pop lower bound (a)
> + if (pop(&tmp)->type != INTGR)
> + int_warn(NO_CARET, "expecting an integer as 1st argument to sum");
> + a = tmp.v.int_val;
> +
> + ret.real = 0;
> + ret.imag = 0;
> + for (i=a; i<=b; ++i) {
> +
> + /* calculate f_i = f(i); */
> +
> + push(Ginteger(&tmp, i));
> +
> + call_arg.udf_arg = udf;
> + f_call(&call_arg);
> +
> + pop(&tmp);
> + ret.real += real(&tmp);
> + ret.imag += imag(&tmp);
> + }
> +
> + push(Gcomplex(&tmp, ret.real, ret.imag));
> +
> +}
> +
> +/* Finite summation (with free parameter x)
> + *
> + * Calculate the finite sum(a, b, x, "f") = \sum_{i=a}^b f(i, x), where "f" is the
> + * name (a string) of f(i, x), a function taking two parameters i (integer) and x
> + * (complex). Example usage:
> + *
> + * # fourier coefficients of some square wave
> + * fourier(k, x) = sin(3./2*k)/k * 2./3*cos(k*x)
> + * s(x) = 1./2 + sum(1, 10, x, "fourier")
> + * plot s(x)
> + */
> +void
> +f_sumx(union argument *arg)
> +{
> + struct value tmp;
> + int a, b; // bounds [a, b]
> + struct cmplx x, ret;
> + int i;
> + udft_entry *udf;
> + union argument calln_arg;
> +
> + // XXX is arg every used in any other function if so, what is it used for?
> + (void) arg; /* avoid -Wunused warning */
> +
> + // XXX do I have to free the poped values?
> + // pop function name
> + if (pop(&tmp)->type != STRING)
> + int_error(NO_CARET, "expecting a name of a function with 2 parameters as 4th argument to sum");
> + if (!(udf = get_udf_by_name(tmp.v.string_val)))
> + int_error(NO_CARET, "No user-defined function %s", tmp.v.string_val);
> +
> + // pop x
> + pop(&tmp);
> + x.real = real(&tmp);
> + x.imag = imag(&tmp);
> +
> + // pop upper bound (b)
> + if (pop(&tmp)->type != INTGR)
> + int_warn(NO_CARET, "expecting an integer as 2nd argument to sum");
> + b = tmp.v.int_val;
> +
> + // pop lower bound (a)
> + if (pop(&tmp)->type != INTGR)
> + int_warn(NO_CARET, "expecting an integer as 1st argument to sum");
> + a = tmp.v.int_val;
> +
> + ret.real = 0;
> + ret.imag = 0;
> + for (i=a; i<=b; ++i) {
> +
> + /* calculate f_i(x) = f(i, x); */
> +
> + /* XXX in what order do I have to push?
> + * I thought that I would have to push from right to left but my
> + * testing contradicts that finding. I am very unsure about the order
> + * and need to understand this
> + */
> + // XXX do I have to malloc instead of pushing a temporary?
> + push(Ginteger(&tmp, i));
> + push(Gcomplex(&tmp, x.real, x.imag));
> + push(Ginteger(&tmp, 2)); // push argument count
> +
> + calln_arg.udf_arg = udf;
> + f_calln(&calln_arg);
> +
> + pop(&tmp);
> + ret.real += real(&tmp);
> + ret.imag += imag(&tmp);
> + }
> +
> + push(Gcomplex(&tmp, ret.real, ret.imag));
> +
> +}
> +
> --- specfun.h.orig 2011-01-11 17:37:21.000000000 +0100
> +++ specfun.h 2011-01-12 15:36:01.000000000 +0100
> @@ -61,4 +61,7 @@
> void f_inverse_erf __PROTO((union argument *x));
> void f_lambertw __PROTO((union argument *x));
>
> +void f_sum __PROTO((union argument *x));
> +void f_sumx __PROTO((union argument *x));
> +
> #endif /* GNUPLOT_SPECFUN_H */
> --- ../docs/gnuplot.doc.orig 2011-01-12 15:09:42.000000000 +0100
> +++ ../docs/gnuplot.doc 2011-01-12 16:22:47.000000000 +0100
> @@ -1091,6 +1091,30 @@
> %sinh(x)@any@$sinh~x$, hyperbolic sine of $x$ in radians
> The `sinh(x)` function returns the hyperbolic sine of its argument. `sinh`
> expects its argument to be in radians.
> +4 sum
> +?expressions functions sum
> +?functions sum
> +?sum
> +#sum(a, b, "f") & any & $\sum_{i=a}^b f(i)$, finite sum \\
> +%sum(a, b, "f")@any@$sum(i=a..b, f(i)$, finite sum
> + The `sum(a, b, "f")` function calculates the finite sum \sum_{i=a}^b f(i),
> + where "f" is the name (a string) of f(i), a function taking one (integer)
> + parameter i. For example, `f(n)=n; print sum(1, 10, "f")` prints 55.
> +4 sumx
> +?expressions functions sumx
> +?functions sumx
> +?sumx
> +#sumx(a, b, x, "f") & any & $\sum_{i=a}^b f(i, x)$, finite sum (with parameter $x$)\\
> +%sumx(a, b, x, "f")@any@$sumx(i=a..b, f(i, x)$, finite sum (with parameter $x$)
> + The `sumx(a, b, x, "f")` function calculates the finite sum
> + \sum_{i=a}^b f(i, x), where "f" is the name (a string) of f(i, x), a function
> + taking two parameters i (integer) and x (complex).
> +
> + Example:
> + # fourier coefficients of some square wave
> + fourier(k, x) = sin(3./2*k)/k * 2./3*cos(k*x)
> + s(x) = 1./2 + sumx(1, 10, x, "fourier")
> + plot s(x)
> 4 sqrt
> ?expressions functions sqrt
> ?functions sqrt
>
>
--
Ethan A Merritt
Biomolecular Structure Center, K-428 Health Sciences Bldg
University of Washington, Seattle 98195-7742
|
|
From: <mw...@gm...> - 2011-01-12 15:50:08
|
Hi,
> Ethan Merritt <merritt@u.washington.edu> wrote:
> On Tuesday, January 11, 2011 12:37:42 pm mw...@gm... wrote:
>>> Ethan Merritt <merritt@u.washington.edu> wrote:
>>> On Tuesday, January 11, 2011 09:00:19 am mw...@gm... wrote:
>>>> Hi,
>>>>
>>>> I want to add finite summation to gnuplot, that is a function sum(a, b,
>>>> x, f), where a, b (int) are the summation boundary, x (double) is a
>>>> varialbe, f (string) is the name of the function to eveluate a term.
>>>> Example usage:
>>>>
>>>> f(n, x) = sin(n*x)
>>>> plot sum(1, 10, x, "f")
>>>
>>> That pair of commands does not seem to be compatible with your
>>> description. How is the code to know there is a second parameter to
>>> f()? And where would it get this second parameter from?
>>
>> sum requires its 4-th parameter to be the name of a 2 parametric
>> function. Before the call to f in sum, two values are pushed. I think I
>> missed the point of what you were trying to tell me.
>
> I guess I don't understand what you are trying to do.
>
> (1) I thought f was a string parameter passed to f_sum, containing the
> name of a user-defined function. But your code never pops it as a parameter
> and instead refers to it as a string constant "f". That may be just for
> debugging but it contradicts your definition of the sum() function so I'm
> not sure.
>
> (2) I still don't understand what is "n", or why you want to pass a second
> parameter to f.
> Are you thinking that you want an infinite class of functions f_n(x)?
> That would take a lot of work to support.
>
>> With your generous help I was able to get stuck a little bit later. I
> assume its related to your initial comment about the parameters of f. I
> thought, that I have to push two values (int n, cmplx x) onto the stack and
> then execute_at(..). I could verify (by calling pop()/more_on_stack()
> repediatly) that execute_at(..) doesn't pop values from the stack. In fact I
> believe that initially the stack containes two values (n, x) and then
> execute_at(..) adds another. Did I do it wrong? How can I pass n, x to the
> function if > not by pushing them?
>
> You either have to duplicate the relevant parts of f_calln(),
> or else you have to set up all the bookkeeping variables needed by
> f_calln() and call f_calln() itself to do the work.
Thank you again for pointing me into the right direction. I didn't realize
fast enought that I haven't explained enough, what I try to do, so let me
explain. I have implemented sum(a, b, "f") and sum(a, b, x, "g") in order to calculate finite sums:
# calculate a finite sum
f(n) = n
print sum(1, 10, "f") # -> 55
# calculate a finite sum with parameter x
# fourier coefficients of some square wave
fourier(k, x) = sin(3./2*k)/k * 2./3*cos(k*x)
s(x) = 1./2 + sumx(1, 100, x, "fourier")
plot s(x)
I hope this is sufficient to understand why I want a parameter x (so one can plot some square waves and other things.) As Mr. Bröker pointed out, there is a trick involving the tertinary operator '?' and recursion to sorta workaround. Originally I tried to plot the sum with '?' but I could only do so for 1..10, in case of 1..100 it said something about stack overflow.
I have added below a working patch but would like you to have a look at it. I have some things that are not clear to me, in particular:
* Do I have to free the values that I have gotten using pop?
* In what order do I have to push i and x befor the call to f(i, x). I thought that I have to push them from right to left but that seems to contradicts my testing, now I am very unsure about it (even though it seems to work correctly).
* Do I have to alloc memeory for the values I push on the stack befor the call to f(.)?
* This is only curiosity is arg in foo(union argument *arg) every used and if, what for?
I would also like you to take a look at my addition to gnuplot.doc and proofread it.
Finally it would be nice but not necessary if the function could be passed as 'f' instead of '"f", that is sum(1, 10, f), and even better as sum(n=[1:10], n) but I consider this as optional and very hard to do (at least with my knowledge).
Thank you again for your generous help without I would never have gone so far.
Thank you,
Micha Wiedenmann
--- eval.c.orig 2011-01-11 17:38:00.000000000 +0100
+++ eval.c 2011-01-12 16:19:05.000000000 +0100
@@ -176,6 +176,9 @@
{"atanh", f_atanh},
{"lambertw", f_lambertw}, /* HBB, from G.Kuhnle 20001107 */
+ {"sum", f_sum}, /* summation sum(a, b, "f") = \sum_{i=a}^b f(i) */
+ {"sumx", f_sumx}, /* summation sum(a, b, x, "f") = \sum_{i=a}^b f(i, x) (with parameter x) */
+
{"column", f_column}, /* for using */
{"valid", f_valid}, /* for using */
{"timecolumn", f_timecolumn}, /* for using */
@@ -689,6 +692,20 @@
return (*udv_ptr);
}
+struct udft_entry *
+get_udf_by_name(char *key)
+{
+ struct udft_entry *udf_ptr = first_udf;
+
+ while (udf_ptr) {
+ if (!strcmp(key, udf_ptr->udf_name))
+ return udf_ptr;
+
+ udf_ptr = udf_ptr->next_udf;
+ }
+
+ return NULL;
+}
static void update_plot_bounds __PROTO((void));
static void fill_gpval_axis __PROTO((AXIS_INDEX axis));
--- eval.h.orig 2011-01-11 17:38:21.000000000 +0100
+++ eval.h 2011-01-12 15:54:30.000000000 +0100
@@ -164,6 +164,7 @@
void apollo_pfm_catch __PROTO((void));
#endif
struct udvt_entry * add_udv_by_name __PROTO((char *key));
+struct udft_entry * get_udf_by_name __PROTO((char *key));
/* update GPVAL_ variables available to user */
void update_gpval_variables __PROTO((int from_plot_command));
--- specfun.c.orig 2011-01-11 17:37:27.000000000 +0100
+++ specfun.c 2011-01-12 16:14:28.000000000 +0100
@@ -49,6 +49,7 @@
#include "specfun.h"
#include "stdfn.h"
#include "util.h"
+#include "internal.h"
#define ITMAX 200
@@ -1933,3 +1934,130 @@
push(Gcomplex(&a, x, 0.0));
}
+/* Finite summation
+ *
+ * Calculate the finite sum(a, b, "f") = \sum_{i=a}^b f(i), where "f" is the
+ * name (a string) of f(i), a function taking one (integer) parameter i.
+ */
+void
+f_sum(union argument *arg)
+{
+ struct value tmp;
+ int a, b; // bounds [a, b]
+ struct cmplx ret;
+ int i;
+ struct udft_entry *udf;
+ union argument call_arg;
+
+ (void) arg; /* avoid -Wunused warning */
+
+ // pop function name
+ if (pop(&tmp)->type != STRING)
+ int_error(NO_CARET, "expecting a name of a function with 1 parameters as 3rd argument to sum");
+ if (!(udf = get_udf_by_name(tmp.v.string_val)))
+ int_error(NO_CARET, "No user-defined function %s", tmp.v.string_val);
+
+ // pop upper bound (b)
+ if (pop(&tmp)->type != INTGR)
+ int_warn(NO_CARET, "expecting an integer as 2nd argument to sum");
+ b = tmp.v.int_val;
+
+ // pop lower bound (a)
+ if (pop(&tmp)->type != INTGR)
+ int_warn(NO_CARET, "expecting an integer as 1st argument to sum");
+ a = tmp.v.int_val;
+
+ ret.real = 0;
+ ret.imag = 0;
+ for (i=a; i<=b; ++i) {
+
+ /* calculate f_i = f(i); */
+
+ push(Ginteger(&tmp, i));
+
+ call_arg.udf_arg = udf;
+ f_call(&call_arg);
+
+ pop(&tmp);
+ ret.real += real(&tmp);
+ ret.imag += imag(&tmp);
+ }
+
+ push(Gcomplex(&tmp, ret.real, ret.imag));
+
+}
+
+/* Finite summation (with free parameter x)
+ *
+ * Calculate the finite sum(a, b, x, "f") = \sum_{i=a}^b f(i, x), where "f" is the
+ * name (a string) of f(i, x), a function taking two parameters i (integer) and x
+ * (complex). Example usage:
+ *
+ * # fourier coefficients of some square wave
+ * fourier(k, x) = sin(3./2*k)/k * 2./3*cos(k*x)
+ * s(x) = 1./2 + sum(1, 10, x, "fourier")
+ * plot s(x)
+ */
+void
+f_sumx(union argument *arg)
+{
+ struct value tmp;
+ int a, b; // bounds [a, b]
+ struct cmplx x, ret;
+ int i;
+ udft_entry *udf;
+ union argument calln_arg;
+
+ // XXX is arg every used in any other function if so, what is it used for?
+ (void) arg; /* avoid -Wunused warning */
+
+ // XXX do I have to free the poped values?
+ // pop function name
+ if (pop(&tmp)->type != STRING)
+ int_error(NO_CARET, "expecting a name of a function with 2 parameters as 4th argument to sum");
+ if (!(udf = get_udf_by_name(tmp.v.string_val)))
+ int_error(NO_CARET, "No user-defined function %s", tmp.v.string_val);
+
+ // pop x
+ pop(&tmp);
+ x.real = real(&tmp);
+ x.imag = imag(&tmp);
+
+ // pop upper bound (b)
+ if (pop(&tmp)->type != INTGR)
+ int_warn(NO_CARET, "expecting an integer as 2nd argument to sum");
+ b = tmp.v.int_val;
+
+ // pop lower bound (a)
+ if (pop(&tmp)->type != INTGR)
+ int_warn(NO_CARET, "expecting an integer as 1st argument to sum");
+ a = tmp.v.int_val;
+
+ ret.real = 0;
+ ret.imag = 0;
+ for (i=a; i<=b; ++i) {
+
+ /* calculate f_i(x) = f(i, x); */
+
+ /* XXX in what order do I have to push?
+ * I thought that I would have to push from right to left but my
+ * testing contradicts that finding. I am very unsure about the order
+ * and need to understand this
+ */
+ // XXX do I have to malloc instead of pushing a temporary?
+ push(Ginteger(&tmp, i));
+ push(Gcomplex(&tmp, x.real, x.imag));
+ push(Ginteger(&tmp, 2)); // push argument count
+
+ calln_arg.udf_arg = udf;
+ f_calln(&calln_arg);
+
+ pop(&tmp);
+ ret.real += real(&tmp);
+ ret.imag += imag(&tmp);
+ }
+
+ push(Gcomplex(&tmp, ret.real, ret.imag));
+
+}
+
--- specfun.h.orig 2011-01-11 17:37:21.000000000 +0100
+++ specfun.h 2011-01-12 15:36:01.000000000 +0100
@@ -61,4 +61,7 @@
void f_inverse_erf __PROTO((union argument *x));
void f_lambertw __PROTO((union argument *x));
+void f_sum __PROTO((union argument *x));
+void f_sumx __PROTO((union argument *x));
+
#endif /* GNUPLOT_SPECFUN_H */
--- ../docs/gnuplot.doc.orig 2011-01-12 15:09:42.000000000 +0100
+++ ../docs/gnuplot.doc 2011-01-12 16:22:47.000000000 +0100
@@ -1091,6 +1091,30 @@
%sinh(x)@any@$sinh~x$, hyperbolic sine of $x$ in radians
The `sinh(x)` function returns the hyperbolic sine of its argument. `sinh`
expects its argument to be in radians.
+4 sum
+?expressions functions sum
+?functions sum
+?sum
+#sum(a, b, "f") & any & $\sum_{i=a}^b f(i)$, finite sum \\
+%sum(a, b, "f")@any@$sum(i=a..b, f(i)$, finite sum
+ The `sum(a, b, "f")` function calculates the finite sum \sum_{i=a}^b f(i),
+ where "f" is the name (a string) of f(i), a function taking one (integer)
+ parameter i. For example, `f(n)=n; print sum(1, 10, "f")` prints 55.
+4 sumx
+?expressions functions sumx
+?functions sumx
+?sumx
+#sumx(a, b, x, "f") & any & $\sum_{i=a}^b f(i, x)$, finite sum (with parameter $x$)\\
+%sumx(a, b, x, "f")@any@$sumx(i=a..b, f(i, x)$, finite sum (with parameter $x$)
+ The `sumx(a, b, x, "f")` function calculates the finite sum
+ \sum_{i=a}^b f(i, x), where "f" is the name (a string) of f(i, x), a function
+ taking two parameters i (integer) and x (complex).
+
+ Example:
+ # fourier coefficients of some square wave
+ fourier(k, x) = sin(3./2*k)/k * 2./3*cos(k*x)
+ s(x) = 1./2 + sumx(1, 10, x, "fourier")
+ plot s(x)
4 sqrt
?expressions functions sqrt
?functions sqrt
--
NEU: FreePhone - kostenlos mobil telefonieren und surfen!
Jetzt informieren: http://www.gmx.net/de/go/freephone
|
|
From: Flapane <int...@gm...> - 2011-01-12 13:59:44
|
Il 12/01/2011 14:27, Mojca Miklavec ha scritto: > Before I installed AquaTerm framework I got > aqua terminal (MacOS X): yes > but then no aqua terminal was built in. After installing the framework > the terminal is present. > The framework is still present here. I'll try to recompile it in the next hours, maybe something changed in the cvs version. |
|
From: Mojca M. <moj...@gm...> - 2011-01-12 13:27:45
|
On Wed, Jan 12, 2011 at 12:32, Mojca Miklavec wrote:
>
>> Anyway the 32bit version worked last time I compiled gnuplot and I
>> haven't touching anything, so I suppose that something changed into
>> gnuplot cvs code.
>
> That is possible, but I can hardly help. All I can say is that it
> doesn't work for me.
I have now tried to use
CFLAGS="-arch i386" LDFLAGS="-arch i386" CXXFLAGS="-arch i386"
./configure --disable-wxwidgets
Before I installed AquaTerm framework I got
aqua terminal (MacOS X): yes
but then no aqua terminal was built in. After installing the framework
the terminal is present.
Mojca
PS: there are some warning reported, but well ... it still works.
In file included from term.h:168,
from term.c:1396:
../term/aquaterm.trm: In function ‘AQUA_convert_using_encoding’:
../term/aquaterm.trm:331: warning: ‘stringWithCString:’ is deprecated
(declared at /System/Library/Frameworks/Foundation.framework/Headers/NSString.h:386)
../term/aquaterm.trm: In function ‘AQUA_boxfill’:
../term/aquaterm.trm:586: warning: ‘AQTAdapter’ may not respond to
‘-setColorRed:green:blue:alpha:’
../term/aquaterm.trm:586: warning: (Messages without a matching method signature
../term/aquaterm.trm:586: warning: will be assumed to return ‘id’ and accept
../term/aquaterm.trm:586: warning: ‘...’ as arguments.)
../term/aquaterm.trm: In function ‘AQUA_filled_polygon’:
../term/aquaterm.trm:683: warning: ‘AQTAdapter’ may not respond to
‘-setColorRed:green:blue:alpha:’
In file included from term.h:349,
from term.c:1396:
|
|
From: Flapane <int...@gm...> - 2011-01-12 12:43:48
|
Il 12/01/2011 12:32, Mojca Miklavec ha scritto: > >> Anyway the 32bit version worked last time I compiled gnuplot and I >> haven't touching anything, so I suppose that something changed into >> gnuplot cvs code. > > That is possible, but I can hardly help. All I can say is that it > doesn't work for me. > > Mojca > Thanks anyway, Flavio -- Flavio www.flapane.com |
|
From: Mojca M. <moj...@gm...> - 2011-01-12 11:33:03
|
On Wed, Jan 12, 2011 at 12:14, Flapane wrote: > Il 12/01/2011 12:06, Mojca Miklavec ha scritto: >> I'm not able to use it either, but I'm working on a 64-bit system >> (Snow Leopard) where AquaTerm is broken almost by definition >> (http://sourceforge.net/projects/aquaterm/ doesn't provide 64-bit >> version of AquaTerm). >> >> I have a 64-bit version in MacPorts, but that means that I would have >> to modify my system in order to make it work anyway ... > > Have you ever tried to contact the author? Hello, The author was not interested in any further development of AquaTerm any more (that is the last thing that I remember). The last update has been done in 2006. However maybe he would be willing to upload a 64-bit version of current application if we kindly ask him. He already said that if somebody would be willing to develop the routines for mouse interactions (or any other updates), he would gladly accept the code, but had no time or interest to do it himself. I'm CC-ing him, but I'm not sure if the e-mail is still valid. The link to Mac binaries on http://gnuplot.info/download.html is broken for example. > Anyway the 32bit version worked last time I compiled gnuplot and I > haven't touching anything, so I suppose that something changed into > gnuplot cvs code. That is possible, but I can hardly help. All I can say is that it doesn't work for me. Mojca |
|
From: Flapane <int...@gm...> - 2011-01-12 11:13:36
|
Il 12/01/2011 12:06, Mojca Miklavec ha scritto: > I'm not able to use it either, but I'm working on a 64-bit system > (Snow Leopard) where AquaTerm is broken almost by definition > (http://sourceforge.net/projects/aquaterm/ doesn't provide 64-bit > version of AquaTerm). > > I have a 64-bit version in MacPorts, but that means that I would have > to modify my system in order to make it work anyway ... > Have you ever tried to contact the author? Anyway the 32bit version worked last time I compiled gnuplot and I haven't touching anything, so I suppose that something changed into gnuplot cvs code. |
|
From: Mojca M. <moj...@gm...> - 2011-01-12 11:06:23
|
On Wed, Jan 12, 2011 at 11:00, Flapane <int...@gm...> wrote: > Il 03/01/2011 20:14, Flapane ha scritto: >> Hi, >> OSX 10.4 PPC, gnuplot grabbed from cvs, latest automake 1.11 from fink: >> ./configure -with-x=no --without-tutorial CFLAGS=-DDEFAULTTERM=\"aqua\" >> --with-readline=gnu >> > > So nobody found Aquaterm support to be broken? I'm not able to use it either, but I'm working on a 64-bit system (Snow Leopard) where AquaTerm is broken almost by definition (http://sourceforge.net/projects/aquaterm/ doesn't provide 64-bit version of AquaTerm). I have a 64-bit version in MacPorts, but that means that I would have to modify my system in order to make it work anyway ... Mojca |
|
From: Flapane <int...@gm...> - 2011-01-12 09:59:44
|
Il 03/01/2011 20:14, Flapane ha scritto: > Hi, > OSX 10.4 PPC, gnuplot grabbed from cvs, latest automake 1.11 from fink: > ./configure -with-x=no --without-tutorial CFLAGS=-DDEFAULTTERM=\"aqua\" > --with-readline=gnu > So nobody found Aquaterm support to be broken? |
|
From: Ethan M. <merritt@u.washington.edu> - 2011-01-11 21:32:11
|
On Tuesday, January 11, 2011 12:37:42 pm mw...@gm... wrote:
> > Ethan Merritt <merritt@u.washington.edu> wrote:
> > On Tuesday, January 11, 2011 09:00:19 am mw...@gm... wrote:
> >> Hi,
> >>
> >> I want to add finite summation to gnuplot, that is a function sum(a, b,
> >> x, f), where a, b (int) are the summation boundary, x (double) is a
> >> varialbe, f (string) is the name of the function to eveluate a term.
> >> Example usage:
> >>
> >> f(n, x) = sin(n*x)
> >> plot sum(1, 10, x, "f")
> >
> > That pair of commands does not seem to be compatible with your
> > description. How is the code to know there is a second parameter to
> > f()? And where would it get this second parameter from?
>
> sum requires its 4-th parameter to be the name of a 2 parametric function. Before the call to f in sum, two values are pushed. I think I missed the point of what you were trying to tell me.
I guess I don't understand what you are trying to do.
(1) I thought f was a string parameter passed to f_sum, containing the name
of a user-defined function. But your code never pops it as a parameter
and instead refers to it as a string constant "f". That may be just for
debugging but it contradicts your definition of the sum() function so I'm
not sure.
(2) I still don't understand what is "n", or why you want to pass a second
parameter to f.
Are you thinking that you want an infinite class of functions f_n(x)?
That would take a lot of work to support.
> With your generous help I was able to get stuck a little bit later. I assume its related to your initial comment about the parameters of f. I thought, that I have to push two values (int n, cmplx x) onto the stack and then execute_at(..). I could verify (by calling pop()/more_on_stack() repediatly) that execute_at(..) doesn't pop values from the stack. In fact I believe that initially the stack containes two values (n, x) and then execute_at(..) adds another. Did I do it wrong? How can I pass n, x to the function if not by pushing them?
You either have to duplicate the relevant parts of f_calln(),
or else you have to set up all the bookkeeping variables needed by
f_calln() and call f_calln() itself to do the work.
Ethan
|
|
From: <mw...@gm...> - 2011-01-11 20:37:52
|
> Ethan Merritt <merritt@u.washington.edu> wrote:
> On Tuesday, January 11, 2011 09:00:19 am mw...@gm... wrote:
>> Hi,
>>
>> I want to add finite summation to gnuplot, that is a function sum(a, b,
>> x, f), where a, b (int) are the summation boundary, x (double) is a
>> varialbe, f (string) is the name of the function to eveluate a term.
>> Example usage:
>>
>> f(n, x) = sin(n*x)
>> plot sum(1, 10, x, "f")
>
> That pair of commands does not seem to be compatible with your
> description. How is the code to know there is a second parameter to
> f()? And where would it get this second parameter from?
sum requires its 4-th parameter to be the name of a 2 parametric function. Before the call to f in sum, two values are pushed. I think I missed the point of what you were trying to tell me.
>> I am stuck at how to call f from sum (see call(f) below) and would
>> appreciate your help very much. (I assume f is the string representing
>> the name of the function to call.)
>>
>> - for (i=a; i<=b; ++i) {
>> - // calculate f_i(x);
>> - push(Gcomplex(&tmp, x.real, x.imag)); // todo check the order
>> - push(Ginteger(&tmp, i));
>> -
>> - //call(f); // assume f is the name (string) of the function to call
>
> There is no existing routine that does either call-by-name or
> retrieve-user-function-by-name; you would have to write one. Something
> like (untested):
>
> struct udft_entry *
> get_udf_by_name(char *key)
> {
> struct udft_entry **udf_ptr = &first_udf;
>
> while (*udf_ptr) {
> if (!strcmp(key, (*udf_ptr)->udf_name))
> return (*udf_ptr);
> udf_ptr = &((*udf_ptr)->next_udf);
> }
>
> return NULL;
> }
>
> It would belong in eval.c next to add_udv_by_name().
>
> Then you would do something like:
>
> udft_entry *udf = get_udf_by_name( f );
> if (udf)
> execute_at(udf->at);
> else
> int_error(NOCARET, "No user-defined function %s",f);
>
>
>> -
>> - pop(&tmp);
>> - ret.real += real(&tmp);
>> - ret.imag += imag(&tmp);
>> - }
>>
>> Thank you very much for your time and effort.
>>
With your generous help I was able to get stuck a little bit later. I assume its related to your initial comment about the parameters of f. I thought, that I have to push two values (int n, cmplx x) onto the stack and then execute_at(..). I could verify (by calling pop()/more_on_stack() repediatly) that execute_at(..) doesn't pop values from the stack. In fact I believe that initially the stack containes two values (n, x) and then execute_at(..) adds another. Did I do it wrong? How can I pass n, x to the function if not by pushing them?
+ for (i=a; i<=b; ++i) {
+
+ // calculate f_i(x);
+ push(Gcomplex(&tmp, x.real, x.imag)); // todo check the order
+ push(Ginteger(&tmp, i));
+
+ if (udf = get_udf_by_name(f))
+ execute_at(udf->at);
+ else
+ int_error(NO_CARET, "No user-defined function %s", f);
+
+ /*
+ int_warn(NO_CARET, "stack_size == 3 (%d)", more_on_stack()); pop(&tmp);
+ int_warn(NO_CARET, "stack_size == 2 (%d)", more_on_stack()); pop(&tmp);
+ int_warn(NO_CARET, "stack_size == 1 (%d)", more_on_stack()); pop(&tmp);
+ int_warn(NO_CARET, "stack_size == 0 (%d)", more_on_stack());
+ */
+
+ pop(&tmp);
+ ret.real += real(&tmp);
+ ret.imag += imag(&tmp);
+ }
Thank you Sir.
--- specfun.c.orig 2011-01-11 17:37:27.000000000 +0100
+++ specfun.c 2011-01-11 21:06:01.000000000 +0100
@@ -1933,3 +1933,57 @@
push(Gcomplex(&a, x, 0.0));
}
+void
+f_sum(union argument *arg)
+{
+ struct value tmp;
+ int a, b;
+ struct cmplx x, ret, result;
+ int i;
+ udft_entry *udf;
+ char *f = "f";
+
+ (void) arg; /* avoid -Wunused warning */
+
+ // pop x
+ pop(&tmp);
+ x.real = real(&tmp);
+ x.imag = imag(&tmp);
+
+ // pop b
+ if (pop(&tmp)->type != INTGR)
+ int_warn(NO_CARET, "expecting an integer as second argument to sum");
+ b = tmp.v.int_val;
+
+ // pop a
+ if (pop(&tmp)->type != INTGR)
+ int_warn(NO_CARET, "expecting an integer as first argument to sum");
+ a = tmp.v.int_val;
+
+ ret.real = 0;
+ ret.imag = 0;
+ for (i=a; i<=b; ++i) {
+
+ // calculate f_i(x);
+ push(Gcomplex(&tmp, x.real, x.imag)); // todo check the order
+ push(Ginteger(&tmp, i));
+
+ if (udf = get_udf_by_name(f))
+ execute_at(udf->at);
+ else
+ int_error(NO_CARET, "No user-defined function %s", f);
+
+ /*
+ int_warn(NO_CARET, "stack_size == 3 (%d)", more_on_stack()); pop(&tmp);
+ int_warn(NO_CARET, "stack_size == 2 (%d)", more_on_stack()); pop(&tmp);
+ int_warn(NO_CARET, "stack_size == 1 (%d)", more_on_stack()); pop(&tmp);
+ int_warn(NO_CARET, "stack_size == 0 (%d)", more_on_stack());
+ */
+
+ pop(&tmp);
+ ret.real += real(&tmp);
+ ret.imag += imag(&tmp);
+ }
+
+ push(Gcomplex(&tmp, ret.real, ret.imag));
+}
--- eval.c.orig 2011-01-11 17:38:00.000000000 +0100
+++ eval.c 2011-01-11 20:41:11.000000000 +0100
@@ -176,6 +176,8 @@
{"atanh", f_atanh},
{"lambertw", f_lambertw}, /* HBB, from G.Kuhnle 20001107 */
+ {"sum", f_sum}, /* summation */
+
{"column", f_column}, /* for using */
{"valid", f_valid}, /* for using */
{"timecolumn", f_timecolumn}, /* for using */
@@ -689,6 +691,20 @@
return (*udv_ptr);
}
+struct udft_entry *
+get_udf_by_name(char *key)
+{
+ struct udft_entry *udf_ptr = first_udf;
+
+ while (udf_ptr) {
+ if (!strcmp(key, udf_ptr->udf_name))
+ return udf_ptr;
+
+ udf_ptr = udf_ptr->next_udf;
+ }
+
+ return NULL;
+}
static void update_plot_bounds __PROTO((void));
static void fill_gpval_axis __PROTO((AXIS_INDEX axis));
zsh: exit 1 diff -u eval.c.orig eval.c
--- specfun.h.orig 2011-01-11 17:37:21.000000000 +0100
+++ specfun.h 2011-01-11 16:22:05.000000000 +0100
@@ -61,4 +61,6 @@
void f_inverse_erf __PROTO((union argument *x));
void f_lambertw __PROTO((union argument *x));
+void f_sum __PROTO((union argument *x));
+
#endif /* GNUPLOT_SPECFUN_H */
--
NEU: FreePhone - kostenlos mobil telefonieren und surfen!
Jetzt informieren: http://www.gmx.net/de/go/freephone
|
|
From: Hans-Bernhard B. <HBB...@t-...> - 2011-01-11 20:07:09
|
On 11.01.2011 18:00, mw...@gm... wrote:
> I want to add finite summation to gnuplot, that is a function sum(a,
> b, x, f), where a, b (int) are the summation boundary, x (double) is
> a varialbe, f (string) is the name of the function to eveluate a
> term. Example usage:
Without changing gnuplot, one can already do this recursive function:
sum_f(a,b,delta) = (a < b) ? 0 : (f(a) + sum_f(a+delta,b,delta))
For more tricky examples, see bivariat.dem
The only aspect of your job this doesn't cover is passing in a function
as another function's argument. gnuplot is a plotting program after
all, not a full-fledged functional programming language.
I don't think adding 'sum' as a new builtin is worth the effort. If a
new builtin is to be added, then that should be an eval() function, i.e.
a function that takes a string and treats it as an expression to
evaluate, so the above could be expanded to
sum(f,a,b,delta) = (a<b)?0 : (eval("f(a)")+sum_f(a+delta,b,delta))
|
|
From: Ethan M. <merritt@u.washington.edu> - 2011-01-11 17:22:59
|
On Tuesday, January 11, 2011 09:00:19 am mw...@gm... wrote:
> Hi,
>
> I want to add finite summation to gnuplot, that is a function sum(a, b, x, f), where a, b (int) are the summation boundary, x (double) is a varialbe, f (string) is the name of the function to eveluate a term. Example usage:
>
> f(n, x) = sin(n*x)
> plot sum(1, 10, x, "f")
That pair of commands does not seem to be compatible with your description.
How is the code to know there is a second parameter to f()? And where would
it get this second parameter from?
> I am stuck at how to call f from sum (see call(f) below) and would appreciate your help very much. (I assume f is the string representing the name of the function to call.)
>
> - for (i=a; i<=b; ++i) {
> - // calculate f_i(x);
> - push(Gcomplex(&tmp, x.real, x.imag)); // todo check the order
> - push(Ginteger(&tmp, i));
> -
> - //call(f); // assume f is the name (string) of the function to call
There is no existing routine that does either call-by-name or
retrieve-user-function-by-name; you would have to write one.
Something like (untested):
struct udft_entry *
get_udf_by_name(char *key)
{
struct udft_entry **udf_ptr = &first_udf;
while (*udf_ptr) {
if (!strcmp(key, (*udf_ptr)->udf_name))
return (*udf_ptr);
udf_ptr = &((*udf_ptr)->next_udf);
}
return NULL;
}
It would belong in eval.c next to add_udv_by_name().
Then you would do something like:
udft_entry *udf = get_udf_by_name( f );
if (udf)
execute_at(udf->at);
else
int_error(NOCARET, "No user-defined function %s",f);
> -
> - pop(&tmp);
> - ret.real += real(&tmp);
> - ret.imag += imag(&tmp);
> - }
>
> Thank you very much for your time and effort.
>
> --- specfun.c 2011-01-11 17:40:19.000000000 +0100
> +++ specfun.c.orig 2011-01-11 17:37:27.000000000 +0100
> @@ -1933,44 +1933,3 @@
> push(Gcomplex(&a, x, 0.0));
> }
>
> -void
> -f_sum(union argument *arg)
> -{
> - struct value tmp;
> - int a, b;
> - struct cmplx x, ret, result;
> - int i;
> -
> - (void) arg; /* avoid -Wunused warning */
> -
> - // pop x
> - pop(&tmp);
> - x.real = real(&tmp);
> - x.imag = imag(&tmp);
> -
> - // pop b
> - if (pop(&tmp)->type != INTGR)
> - int_warn(NO_CARET, "expecting an integer as second argument to sum");
> - b = tmp.v.int_val;
> -
> - // pop a
> - if (pop(&tmp)->type != INTGR)
> - int_warn(NO_CARET, "expecting an integer as first argument to sum");
> - a = tmp.v.int_val;
> -
> - ret.real = 0;
> - ret.imag = 0;
> - for (i=a; i<=b; ++i) {
> - // calculate f_i(x);
> - push(Gcomplex(&tmp, x.real, x.imag)); // todo check the order
> - push(Ginteger(&tmp, i));
> -
> - //call(f);
> -
> - pop(&tmp);
> - ret.real += real(&tmp);
> - ret.imag += imag(&tmp);
> - }
> -
> - push(Gcomplex(&tmp, ret.real, ret.imag));
> -}
>
> --- eval.c 2011-01-11 16:25:01.000000000 +0100
> +++ eval.c.orig 2011-01-11 17:38:00.000000000 +0100
> @@ -176,8 +176,6 @@
> {"atanh", f_atanh},
> {"lambertw", f_lambertw}, /* HBB, from G.Kuhnle 20001107 */
>
> - {"sum", f_sum}, /* summation */
> -
> {"column", f_column}, /* for using */
> {"valid", f_valid}, /* for using */
> {"timecolumn", f_timecolumn}, /* for using */
> --- specfun.h 2011-01-11 16:22:05.000000000 +0100
> +++ specfun.h.orig 2011-01-11 17:37:21.000000000 +0100
> @@ -61,6 +61,4 @@
> void f_inverse_erf __PROTO((union argument *x));
> void f_lambertw __PROTO((union argument *x));
>
> -void f_sum __PROTO((union argument *x));
> -
> #endif /* GNUPLOT_SPECFUN_H */
>
>
|
|
From: <mw...@gm...> - 2011-01-11 17:00:29
|
Hi,
I want to add finite summation to gnuplot, that is a function sum(a, b, x, f), where a, b (int) are the summation boundary, x (double) is a varialbe, f (string) is the name of the function to eveluate a term. Example usage:
f(n, x) = sin(n*x)
plot sum(1, 10, x, "f")
I am stuck at how to call f from sum (see call(f) below) and would appreciate your help very much. (I assume f is the string representing the name of the function to call.)
- for (i=a; i<=b; ++i) {
- // calculate f_i(x);
- push(Gcomplex(&tmp, x.real, x.imag)); // todo check the order
- push(Ginteger(&tmp, i));
-
- //call(f); // assume f is the name (string) of the function to call
-
- pop(&tmp);
- ret.real += real(&tmp);
- ret.imag += imag(&tmp);
- }
Thank you very much for your time and effort.
--- specfun.c 2011-01-11 17:40:19.000000000 +0100
+++ specfun.c.orig 2011-01-11 17:37:27.000000000 +0100
@@ -1933,44 +1933,3 @@
push(Gcomplex(&a, x, 0.0));
}
-void
-f_sum(union argument *arg)
-{
- struct value tmp;
- int a, b;
- struct cmplx x, ret, result;
- int i;
-
- (void) arg; /* avoid -Wunused warning */
-
- // pop x
- pop(&tmp);
- x.real = real(&tmp);
- x.imag = imag(&tmp);
-
- // pop b
- if (pop(&tmp)->type != INTGR)
- int_warn(NO_CARET, "expecting an integer as second argument to sum");
- b = tmp.v.int_val;
-
- // pop a
- if (pop(&tmp)->type != INTGR)
- int_warn(NO_CARET, "expecting an integer as first argument to sum");
- a = tmp.v.int_val;
-
- ret.real = 0;
- ret.imag = 0;
- for (i=a; i<=b; ++i) {
- // calculate f_i(x);
- push(Gcomplex(&tmp, x.real, x.imag)); // todo check the order
- push(Ginteger(&tmp, i));
-
- //call(f);
-
- pop(&tmp);
- ret.real += real(&tmp);
- ret.imag += imag(&tmp);
- }
-
- push(Gcomplex(&tmp, ret.real, ret.imag));
-}
--- eval.c 2011-01-11 16:25:01.000000000 +0100
+++ eval.c.orig 2011-01-11 17:38:00.000000000 +0100
@@ -176,8 +176,6 @@
{"atanh", f_atanh},
{"lambertw", f_lambertw}, /* HBB, from G.Kuhnle 20001107 */
- {"sum", f_sum}, /* summation */
-
{"column", f_column}, /* for using */
{"valid", f_valid}, /* for using */
{"timecolumn", f_timecolumn}, /* for using */
--- specfun.h 2011-01-11 16:22:05.000000000 +0100
+++ specfun.h.orig 2011-01-11 17:37:21.000000000 +0100
@@ -61,6 +61,4 @@
void f_inverse_erf __PROTO((union argument *x));
void f_lambertw __PROTO((union argument *x));
-void f_sum __PROTO((union argument *x));
-
#endif /* GNUPLOT_SPECFUN_H */
--
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
|
|
From: Ethan M. <merritt@u.washington.edu> - 2011-01-11 00:48:12
|
On Sunday, January 09, 2011 03:25:53 am David Kuehling wrote: > Hi, > > I've been working on an graphics-capable GNUplot port for OpenWrt [1], > for use with the open-hardware NanoNote "PDA" [2]. > > The NanoNote only has 32MB RAM so the OpenWrt image we use does not come > with an X-Server, insead everything is directly drawn onto the > framebuffer > > For GNUplot I had to fall back on using a port of SVGAlib that uses the > Framebuffer for text/graphics mode switching to reliably work without > messing up console input. I am happy to accept the patches to term.c and linux.trm, but ... >(Gtk and Qt can work this way). Wouldn't it be more interesting to see if the Qt terminal driver in gnuplot CVS can be used on this device? It was my understanding that it was developed partly to support the sort of device you describe. I haven't seen much discussion or feedback about qt.trm, so maybe people haven't noticed it yet. On a normal desktop machine it doesn't seem to have any particular advantage over the wxgtk-based wxt.trm, but on a small device it might be an entirely different story. Ethan > The first attached single-line patch makes Gnuplot's 'linux.trm' driver > work with all SVGAlib video modes, not only 16 and 256-color modes (the > NanoNote only supports G320x240x16M32). > > The second patch fixes selection of the terminal type when svgalib > support is compiled in. Currently it wrongly selects 'vgagl' over > 'linux' even when 'vgagl' driver is not compiled in due to missing > lib3dkit. > > cheers, > > David > > [1] http://projects.qi-hardware.com/index.php/p/openwrt-packages/source/tree/master/gnuplot-gfx > [2] http://en.qi-hardware.com/wiki/Ben_NanoNote |
|
From: Mojca M. <moj...@gm...> - 2011-01-09 23:52:20
|
Dear list,
I'm not sure if the behaviour of metapost is desirable or not, but
plot sin(x),cos(x)
creates a black sin(x) and red cos(x) since the colors are defined in
the following way:
col0:=black;
col1:=red;
col2:=(.2,.2,1); %blue
col3:=(1,.66,0); %orange
col4:=.85*green;
col5:=.9*magenta;
col6:=0.85*cyan;
col7:=.85*yellow;
In my metapost-based terminal I was using the same basic colors as
PostScript terminal:
col[-4] = gp_color_background;
col[-3] = gp_color_background; % TODO: nodraw!!!
col[-2] = gp_color_foreground;
col[-1] = gp_color_foreground; % coordinate axes
col[0] = red;
col[1] = green;
col[2] = blue;
col[3] = magenta;
col[4] = cyan;
col[5] = yellow;
col[6] = black;
col[7] = (1,.3,0); % orange
col[8] = .5white;
I'm not saying that the choice is perfect (the color #00FF00 is indeed
a bit horrible), but it's a bit anoying to have the basic color black;
I don't really mind about the exact order of other colors.
Mojca
|
|
From: David K. <dvd...@gm...> - 2011-01-09 11:26:09
|
Hi, I've been working on an graphics-capable GNUplot port for OpenWrt [1], for use with the open-hardware NanoNote "PDA" [2]. The NanoNote only has 32MB RAM so the OpenWrt image we use does not come with an X-Server, insead everything is directly drawn onto the framebuffer (Gtk and Qt can work this way). For GNUplot I had to fall back on using a port of SVGAlib that uses the Framebuffer for text/graphics mode switching to reliably work without messing up console input. The first attached single-line patch makes Gnuplot's 'linux.trm' driver work with all SVGAlib video modes, not only 16 and 256-color modes (the NanoNote only supports G320x240x16M32). The second patch fixes selection of the terminal type when svgalib support is compiled in. Currently it wrongly selects 'vgagl' over 'linux' even when 'vgagl' driver is not compiled in due to missing lib3dkit. cheers, David [1] http://projects.qi-hardware.com/index.php/p/openwrt-packages/source/tree/master/gnuplot-gfx [2] http://en.qi-hardware.com/wiki/Ben_NanoNote -- GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg Fingerprint: B17A DC95 D293 657B 4205 D016 7DEF 5323 C174 7D40 |
|
From: Daniel J S. <dan...@ie...> - 2011-01-04 22:34:41
|
Alexandre, Have you looked into creating a SourceForge account and creating an entry in the gnuplot Patch list? If you haven't time to learn diff, simply append your "split triangles" code for the initial entry. I'll try integrating it into gnuplot in some way as a first step. Initially, it won't be much more than breaking up triangles, so the sorting will probably be off. From there the development list can improve things with proper sorting, etc. Then we'll look at it as a candidate for integration into the latest gnuplot. I think a lot of people would be happy to see this surface issue fixed. Dan |
|
From: Juhász P. <pet...@gm...> - 2011-01-03 20:59:20
|
On Tue, 2011-01-04 at 04:43 +0900, Tatsuro MATSUOKA wrote:
> Hello
>
> Thank you for immediate response and treatment.
>
> Build on the Cygwin with the cvs source dated 2011-01-03 was successful.
> Fine!!
>
That's good to hear!
> > I've checked in a fix just now. Could you please test it? If it builds
> > successfully, could you test the following command?
> >
> > print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
>
> Cygwin
> gnuplot> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
> 347398005 347398005.468875 2011/01/03 19:26:45.468875
>
> MinGW
> gnuplot> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
> 347398047 347398047.453125 2011/01/03 19:27:27.453125
>
> DJGPP
> gnuplot> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
> 347430489 347430489.76 2011/01/04 04:28:09.760000
>
> Note that the result in DJGPP is different from those in Cygwin and MinGW.
> Perhaps DJGPP uses JST (Japanese Standard Time, UTC+9) and Cygwin and MinGW use UTC.
>
> I do not know which you would like to implement.
>
The fact that DJGPP returns a different answer is somewhat worrisome.
Gnuplot uses and assumes UTC more or less consistently. Therefore "time"
should return UTC as well. On a well-behaved platform where the system
clock runs in UTC and there is a sane mechanism in the OS to handle time
zones, gettimeofday() does return UTC, and so does gnuplot's "time".
Apparently, DJGPP is not such a platform, because the underlying system
call uses local time. Perhaps we should fall back to the good old time()
function on DJGPP, or figure out a different implementation if that's
bad as well.
Interestingly, on linux I get something like this:
gnuplot> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
347400672 347400672.289117 2011/01/03 20:11:12.289168
which means that the timer is precise enough to measure the time elapsed
between the consecutive function calls.
Péter Juhász
|
|
From: Tatsuro M. <tma...@ya...> - 2011-01-03 19:44:07
|
Hello
Thank you for immediate response and treatment.
Build on the Cygwin with the cvs source dated 2011-01-03 was successful.
Fine!!
> I've checked in a fix just now. Could you please test it? If it builds
> successfully, could you test the following command?
>
> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
Cygwin
gnuplot> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
347398005 347398005.468875 2011/01/03 19:26:45.468875
MinGW
gnuplot> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
347398047 347398047.453125 2011/01/03 19:27:27.453125
DJGPP
gnuplot> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
347430489 347430489.76 2011/01/04 04:28:09.760000
Note that the result in DJGPP is different from those in Cygwin and MinGW.
Perhaps DJGPP uses JST (Japanese Standard Time, UTC+9) and Cygwin and MinGW use UTC.
I do not know which you would like to implement.
> I apologize for the inconvenience.
No problem. One of the purpose of my frequently build of the CVS source is to kill the bug as soon as
possible. Faster finding issue is better for debugging.
Regards
Tatsuro
--- Peter Juhasz wrote:
> On Mon, Jan 3, 2011 at 11:40 AM, Tatsuro MATSUOKA
> <tma...@ya...> wrote:
> > Hello
> >
> > I have checked out the cvs source and tried to build it.
> >
> > 2011-01-02 �Peter Juhasz �<ju...@us...>
> >
> > � � � �* src/internal.c (f_time) docs/gnuplot.doc:
> > � � � �Modified time() so that type of result depends on type of
argument
> >
> >
> > gcc -shared-libgcc -DHAVE_CONFIG_H -I. -I.. �-I../term -I../term
-DBINDIR=\"/usr/local/bin\"
> > -DX11_DRIVER_DIR=\"/usr/local/libexec/gnuplot/4.5\"
> > -DGNUPLOT_PS_DIR=\"/usr/local/share/gnuplot/4.5/PostScript\"
> > -DGNUPLOT_JS_DIR=\"/usr/local/share/gnuplot/4.5/js\"
> > -DGNUPLOT_LUA_DIR=\"/usr/local/share/gnuplot/4.5/lua\"
> > -DCONTACT=\"gnu...@li...\"
> > -DHELPFILE=\"/usr/local/share/gnuplot/4.5/gnuplot.gih\" -DGNUPLOT_X11=\"`echo gnuplot_x11 |
> sed
> > 's,x,x,'`.exe\" -DXAPPLRESDIR=\"/etc/X11/app-defaults/\" �-I/usr/local/include �
-D_REENTRANT
> > -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
> > -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include � �-O3
> > -fomit-frame-pointer -MT internal.o -MD -MP -MF .deps/internal.Tpo -c -o internal.o internal.c
> > internal.c: In function 'f_time':
> > internal.c:1452: error: storage size of 'tp' isn't known
> > make[3]: *** [internal.o] Error 1
> >
> >
> > On djgpp and MinGW, the builds were successful without errors.
> >
> > HMMM. On the source 2011-01-01, the cygwin build was carried out without problem. So this
> error comes
> > from newly imported code.
> >
> > f_time(union argument *arg)
> > {
> > � �struct value val, val2;
> > � �double time;
> > � �struct timeval tp; // <== line 1452
> >
> > Is timeval a origin of the error
> >
> > Any suggestions?
> >
> > Regards
> >
> > Tatsuro
> >
> >
> >
> > Any suggestions ?
> >
>
> The breakage was caused by me: I carelessly used the gettimeofday()
> function without realizing that it has to be included from sys/time.h.
> Apparently, on GNU systems the compiler manages to find the correct
> definition even without the missing #include statement - perhaps this
> is why your MinGW and djgpp builds proceeded without error, and this
> is why I noticed nothing. However, on other systems this is not so.
>
> I've checked in a fix just now. Could you please test it? If it builds
> successfully, could you test the following command?
>
> print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
>
> I apologize for the inconvenience.
>
> P�er Juh�z
>
--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
|
|
From: Flapane <int...@gm...> - 2011-01-03 19:14:15
|
Hi, OSX 10.4 PPC, gnuplot grabbed from cvs, latest automake 1.11 from fink: ./configure -with-x=no --without-tutorial CFLAGS=-DDEFAULTTERM=\"aqua\" --with-readline=gnu From CONFIG.LOG (http://pastebin.com/184ikbCS): ------ configure:20045: result: gnuplot will be compiled with the following terminals: configure:20263: result: aqua terminal (MacOS X): yes [...] ------- However, after the compilation ends and I try to run the executable, I get: ----- Unknown or ambiguous terminal name 'aqua' Terminal type set to 'unknown' --------- Aquaterm is not present in SET TERM list. I've used the script located at http://www.gnuplot.info/development/sample_osx_installation.html I wrote a couple of years ago. Last time I ran the script (some months ago), aquaterm support worked flawlessy. I've uploaded the binary file at flapane.com/upload/gnuplot_cvs Regards, Flavio -- Flavio www.flapane.com |
|
From: Peter J. <pet...@gm...> - 2011-01-03 14:51:28
|
On Mon, Jan 3, 2011 at 11:40 AM, Tatsuro MATSUOKA
<tma...@ya...> wrote:
> Hello
>
> I have checked out the cvs source and tried to build it.
>
> 2011-01-02 Peter Juhasz <ju...@us...>
>
> * src/internal.c (f_time) docs/gnuplot.doc:
> Modified time() so that type of result depends on type of argument
>
>
> gcc -shared-libgcc -DHAVE_CONFIG_H -I. -I.. -I../term -I../term -DBINDIR=\"/usr/local/bin\"
> -DX11_DRIVER_DIR=\"/usr/local/libexec/gnuplot/4.5\"
> -DGNUPLOT_PS_DIR=\"/usr/local/share/gnuplot/4.5/PostScript\"
> -DGNUPLOT_JS_DIR=\"/usr/local/share/gnuplot/4.5/js\"
> -DGNUPLOT_LUA_DIR=\"/usr/local/share/gnuplot/4.5/lua\"
> -DCONTACT=\"gnu...@li...\"
> -DHELPFILE=\"/usr/local/share/gnuplot/4.5/gnuplot.gih\" -DGNUPLOT_X11=\"`echo gnuplot_x11 | sed
> 's,x,x,'`.exe\" -DXAPPLRESDIR=\"/etc/X11/app-defaults/\" -I/usr/local/include -D_REENTRANT
> -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
> -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O3
> -fomit-frame-pointer -MT internal.o -MD -MP -MF .deps/internal.Tpo -c -o internal.o internal.c
> internal.c: In function 'f_time':
> internal.c:1452: error: storage size of 'tp' isn't known
> make[3]: *** [internal.o] Error 1
>
>
> On djgpp and MinGW, the builds were successful without errors.
>
> HMMM. On the source 2011-01-01, the cygwin build was carried out without problem. So this error comes
> from newly imported code.
>
> f_time(union argument *arg)
> {
> struct value val, val2;
> double time;
> struct timeval tp; // <== line 1452
>
> Is timeval a origin of the error
>
> Any suggestions?
>
> Regards
>
> Tatsuro
>
>
>
> Any suggestions ?
>
The breakage was caused by me: I carelessly used the gettimeofday()
function without realizing that it has to be included from sys/time.h.
Apparently, on GNU systems the compiler manages to find the correct
definition even without the missing #include statement - perhaps this
is why your MinGW and djgpp builds proceeded without error, and this
is why I noticed nothing. However, on other systems this is not so.
I've checked in a fix just now. Could you please test it? If it builds
successfully, could you test the following command?
print time(0),time(0.),time(" %Y/%m/%d %H:%M:%02.6S")
I apologize for the inconvenience.
Péter Juhász
|
|
From: Tatsuro M. <tma...@ya...> - 2011-01-03 11:07:09
|
Hello
I have checked out the cvs source and tried to build it.
2011-01-02 Peter Juhasz <ju...@us...>
* src/internal.c (f_time) docs/gnuplot.doc:
Modified time() so that type of result depends on type of argument
gcc -shared-libgcc -DHAVE_CONFIG_H -I. -I.. -I../term -I../term -DBINDIR=\"/usr/local/bin\"
-DX11_DRIVER_DIR=\"/usr/local/libexec/gnuplot/4.5\"
-DGNUPLOT_PS_DIR=\"/usr/local/share/gnuplot/4.5/PostScript\"
-DGNUPLOT_JS_DIR=\"/usr/local/share/gnuplot/4.5/js\"
-DGNUPLOT_LUA_DIR=\"/usr/local/share/gnuplot/4.5/lua\"
-DCONTACT=\"gnu...@li...\"
-DHELPFILE=\"/usr/local/share/gnuplot/4.5/gnuplot.gih\" -DGNUPLOT_X11=\"`echo gnuplot_x11 | sed
's,x,x,'`.exe\" -DXAPPLRESDIR=\"/etc/X11/app-defaults/\" -I/usr/local/include -D_REENTRANT
-I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O3
-fomit-frame-pointer -MT internal.o -MD -MP -MF .deps/internal.Tpo -c -o internal.o internal.c
internal.c: In function 'f_time':
internal.c:1452: error: storage size of 'tp' isn't known
make[3]: *** [internal.o] Error 1
On djgpp and MinGW, the builds were successful without errors.
HMMM. On the source 2011-01-01, the cygwin build was carried out without problem. So this error comes
from newly imported code.
f_time(union argument *arg)
{
struct value val, val2;
double time;
struct timeval tp; // <== line 1452
Is timeval a origin of the error
Any suggestions?
Regards
Tatsuro
Any suggestions ?
--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/
|
|
From: Daniel J S. <dan...@ie...> - 2010-12-29 22:10:53
|
Hans-Bernhard Bröker wrote:
> On 29.12.2010 21:18, Daniel J Sebald wrote:
>
>> Shouldn't operators work inside complex numbers?
>
>
> No. Operators never work inside numbers. Gnuplot's {a,b} syntax is for
> complex numbers, not complex expressions.
>
>> gnuplot> print {2**31-1,1}
>> ^
>> invalid complex constant
>
>
> The way of getting that is
>
> print 2**31-1 + {0,1}
>
> Most people would probably want to define
>
> i={0,1}
>
> somewhere and then write
>
> print 2**31-1 + 1*i
Easy enough.
Dan
|
|
From: Hans-Bernhard B. <HBB...@t-...> - 2010-12-29 21:51:18
|
On 29.12.2010 21:18, Daniel J Sebald wrote:
> Shouldn't operators work inside complex numbers?
No. Operators never work inside numbers. Gnuplot's {a,b} syntax is for
complex numbers, not complex expressions.
> gnuplot> print {2**31-1,1}
> ^
> invalid complex constant
The way of getting that is
print 2**31-1 + {0,1}
Most people would probably want to define
i={0,1}
somewhere and then write
print 2**31-1 + 1*i
|