Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to write a cumulative function (my version of gnuplot does NOT have smooth cumul option!)

But the documentation for user-defined functions is very limited. For example what does this do? The docs list it - but don't explain it?!

delta(t) = (t == 0)

Is there a more thorough explanation anywhere?

share|improve this question

migrated from stackoverflow.com Mar 23 '13 at 19:29

This question came from our site for professional and enthusiast programmers.

1  
To those migrating these questions -- Why are you doing this? In what way is SU a better SE site for this question than SO? –  mgilson Mar 23 '13 at 19:41

1 Answer 1

up vote 1 down vote accepted

In gnuplot, logical expressions evaluate to 1 or 0 as they do in C. Your function above will return 1 if (and only if) the t you pass in equals 0 -- Otherwise it returns 0.

The documentation on help operators states:

The operators in gnuplot are the same as the corresponding operators in the C programming language, except that all operators accept integer, real, and complex arguments, unless otherwise noted. The ** operator (exponentiation) is supported, as in FORTRAN.

Parentheses may be used to change order of evaluation.

I'm not really sure how much additional information there is to say. There is more help available for the various operators as well -- help operator unary or help operator binary ...

Also see help user-defined for a little more info on how to define functions and help expressions for help on how to write gnuplot expressions in general.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.