Using Integrate1D and Optimize
Supriya Balaji
Function myFunc_Maker(w,x)
wave w //coefficients wave w = {a,b,c}
return myFunc//a function of x, with parameters w
end
The above function passes wave w to the below function
Function myFunc(a,b,c)
variable a,b,c
return f(x) with parameters a,b,c
end
Question A
I am able to do a Findroots/z=some-y-value myfunc,w but Optimize is not able to locate the preferred y values. Is there a way around this? Also FindRoots is only finding 1 root whereas there are definitely 2 roots. When I split the function into two phases, the Findroots could find the second root in the function containing the second phase only.
Question B
I need to find the area of the curve for f(x) over x = 0 to x = inf.
I understand that Integrate1D can do this.
I read the Help Menu in detail but am not able to execute it by passing the coefficient wave w .Is there a way to do so?
<pre><code class="language-igor"> ...</code></pre>
tags for code.A: Could you post an example?
B: A workaround could be usage of a reference to the coefficient wave inside the function.
Variable inX
Wave Coef=root:myproject:mycoefficients:CoefRun42 // <--
... do something
return result
For detailed help: Could you post an example?
HJ
March 16, 2018 at 03:46 am - Permalink
Find roots will report the first root that it can find based on the initial conditions that you provide. If you know that there is more than one root, it is up to you to invoke findRoots as many times as you need to find additional roots. Igor does not have the technology to determine how many roots you want to find in an arbitrary user function.
Before you even try to use Integrate1D I suggest that you use pen and paper to write down your expression for f(x) and inspect if you can transform it from infinite to finite limits. There are some typical tricks that they teach in analysis classes that involve change of variables. For example, if you change x to tan(alpha) then your half-infinite range [0,inf) is covered by the finite range alpha=[0,pi/2]. This is just an example. You will have to choose a change of variable that is appropriate for your expression. After you make the change of variable you may want to check some integral tables per chance there exists a simple analytical solution.
I hope this helps,
A.G.
WaveMetrics, Inc.
March 16, 2018 at 11:02 am - Permalink