How to Sum a Function with a Free Parameter in R?

  • Context: Undergrad 
  • Thread starter Thread starter aymer
  • Start date Start date
  • Tags Tags
    Statistics
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
aymer
Messages
16
Reaction score
0
Hey everyone,

This is for someone who has used R. Please tell me how can we sum a function with a free parameter in R.
I used the normal command f=function(n) sum(body of function containing n)
it does not show any warnings till here, but when I plot this sum vs n (which i now define as a sequence, n=seq(-1.2,0.8)), it shows that the two quantities have differing lengths.

How can this be if my sum is a function of n?
Did I define the sum incorrectly?

Please help
 
Physics news on Phys.org
You talk about the "command" "f=function(n) sum(body of function containing n)" so apparently you are using some computer algebra system. But we cannot help you without know which system (Maple, Mathematica, ...) you are using!
 
Hi there,
Thanx for the response.
I am using the statistical software R