What is the best method for plotting function parameter errors?

In summary, the function plots as a function of a with a slowly varying error. The error can be determined by plotting the function for different values of a and comparing the differences and fluctuation of the curves.
  • #1
ChrisVer
Gold Member
3,378
464
Hi, suppose that you have some function: [itex]F(x;a)[/itex]
where [itex]x[/itex] is the variable with which you plot the function and [itex]a[/itex] is some parameter which enters the function.
If I want to find the error coming from some uncertainty in [itex]a[/itex], computationally, I would have to plot the function for 2 different let's say values of [itex]a[/itex]: Let's say that this means to plot the functions below:
[itex]F(x;a)[/itex]
[itex]F(x;2a)[/itex]
Then I believe the error then can can be computed by (their difference):

[itex]F(x;2a)-F(x;a)[/itex]

as well as (their fluctuation)

[itex]\frac{F(x;2a)-F(x;a)}{F(x;a)}[/itex]

Which of these two are best for a plotting? Is there some physical meaning behind any of these two? like they are showing something different to the reader?
 
Physics news on Phys.org
  • #2
I think what you're after is to "portray" the "error" visually, not to compute it. For such a purpose, I'd pefer to see a shaded graph created by plotting lots of curves on top of each other The reason is that the points on the the graphs of [itex] F(x,a) [/itex] and [itex]F(x,2a) [/itex] might not show the most extreme values. For example, it's possible that that for some [itex] a < c < 2a [/itex] that [itex] F(x,c) [/itex] might be be greater than both [itex] F(x,a) [/itex] and [itex] F(x,2a) [/itex]. If you're sure that this kind of thing won't happen then then your idea of plotting only [itex] F(x,a) [/itex] and [itex] F(x,2a) [/itex] would be sufficient.

You haven't defined what you mean by "error". If the graph is to portray a specific statistical meaning, we'd have to know the probability model for the situation.
 
  • #3
By error I mean something like this: in general you can't determine [itex]a[/itex] exactly, but within some range [itex](a_{min}, a_{max})[/itex]... This will cause an error to the function [itex]F(x;a)[/itex] coming from [itex]a[/itex]...
So I thought :
I could determine it by eg saying that I can determine [itex]a[/itex] within an order of magnitude (let's say [itex] 10 \le a \le 100[/itex]), what should I do to see the error then? I would have to plot [itex]F(x;10)[/itex] and [itex]F(x;100)[/itex] and look at their differences...
 
  • #4
ChrisVer said:
I would have to plot [itex]F(x;10)[/itex] and [itex]F(x;100)[/itex] and look at their differences...

That would be Ok if the graph of [itex] F(x,c) [/itex] always rises as [itex]c [/itex] increases or always falls as [itex] c [/itex] increases. But suppose as [itex] c [/itex] increases between 10 and 100, the point at [itex] F(5,c) [/itex] moves up and down. Then [itex] F(5,10) [/itex] and [itex] F(5,100) [/itex] might not indicate the extremes of the movement.

What specific [itex] F(x,a) [/itex] are you dealing with?
 
  • #5
Recombination (cosmology) and the uncertainty in determining the recombination temperature [itex]T[/itex] in which [itex] X(T_{rec})= \frac{n_{ion}}{n_e}=1/2[/itex]
http://www.maths.qmul.ac.uk/~jel/ASTM108lecture8.pdf
(Eq. 8.23 with uncertainty in [itex]\eta =\frac{n_B}{n_\gamma}= 4 - 8 \times 10^{-10}[/itex] )
 
Last edited by a moderator:
  • #6
ChrisVer said:
(Eq. 8.23 with uncertainty in [itex]\eta =\frac{n_B}{n_\gamma}= 4 - 8 \times 10^{-10}[/itex] )

[itex] \frac{ n_{ion}}{n_e} = \frac{n_\gamma}{n_B} \ exp( \frac { E_{ion}} {k_B T} ) \ \ [/itex] (Eq.8.23)

[itex] T = \frac{E_{ion}}{k_B} \frac{1}{ \ln({\frac{n_{ion}}{n_e})} \ - \ \ln({ \frac{n_\gamma}{n_B} )} }[/itex]

[itex] T = \frac{E_{ion}}{k_B} \frac{1}{ \ln({\frac{n_{ion}}{n_e})} \ - \ \ln({ \frac{1}{\eta} )} }[/itex]

So you are plotting this as [itex] y = T = f(x,a) [/itex] with [itex] a = \eta [/itex]. But what variable plays the role of [itex] x [/itex] ?
 
  • #7
ehmm.. no, I am plotting [itex]X \equiv X(T ;\eta)= \frac{1}{\eta} \exp \Big ( \frac{E_{ion}}{k_BT} \Big) [/itex] for [itex]3000<T(Kelvin)<4500[/itex]
And [itex]\eta= 4 \times 10^{-10} [/itex] and [itex]\eta= 8 \times 10^{-10}[/itex]
However I'd [personally] like to generalize this to an uncertainty of [itex]\eta[/itex] within an order of magnitude...
 
  • #8
Then for a given value of [itex] T [/itex] , the point on the graph, as a function of [itex] \eta [/itex] has the form [itex] y = s \frac{1}{\eta} [/itex] where [itex] s [/itex] is a constant. So I plotting points given by the extreme values of [itex] \eta [/itex] will show the extremes of variation in [itex] y [/itex].
 

What is a function parameter error?

A function parameter error occurs when there is an issue with the inputs or arguments given to a function. This can result in the function not being able to execute properly or returning unexpected results.

What are common causes of function parameter errors?

Common causes of function parameter errors include passing the wrong type of data as an argument, passing too few or too many arguments, and passing arguments in the wrong order. It can also be caused by the function expecting a different data type than what is actually passed.

How can I prevent function parameter errors?

To prevent function parameter errors, it is important to carefully check the data types and number of arguments expected by the function. Make sure to pass the correct arguments in the correct order and check for any potential errors in the input data before calling the function.

What are some debugging techniques for function parameter errors?

One way to debug function parameter errors is to use print statements to check the values of the parameters at different points in the function. Another technique is to use a debugger tool to step through the code and track the values of the parameters as the function is executed.

Is there a way to handle function parameter errors in code?

Yes, there are several ways to handle function parameter errors in code. One way is to use conditional statements to check for specific errors and handle them accordingly. Another approach is to use try-catch blocks to catch and handle any errors that may arise in the function. It is also important to provide informative error messages to aid in debugging and troubleshooting.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
912
  • Set Theory, Logic, Probability, Statistics
Replies
13
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
30
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
902
  • Set Theory, Logic, Probability, Statistics
Replies
22
Views
1K
Back
Top