The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How to speed up FindRoot with Map or MapThread
Replies: 1   Last Post: Jan 7, 2013 11:04 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Bob Hanlon

Posts: 906
Registered: 10/29/11
Re: How to speed up FindRoot with Map or MapThread
Posted: Jan 7, 2013 11:04 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

h1 = Range[3];

phi1 = Range[0, Pi/4, Pi/8];

X = Table[2 Pi {n, n - 1/2, n + 1/2}, {n, 2}];

Outer[{#1, #2, #3,
Sin[2*theta] + 2*#1*Sin[theta - #2] == 0,
{theta, Sequence @@ #3}]} &,
h1, phi1, X, 1], 2] // Grid

Bob Hanlon

On Mon, Jan 7, 2013 at 12:39 AM, <> wrote:
> Hi,
> I would like to speed up FindRoot.
> In this special case I'm looking for roots of the equation
> sin[2*theta]+2*h*sin[theta - phi]
> for different h's and phi's.
> To do this I specify for each h the region within which the solution has to be found: X = {x_middle, x_left, x_right}, e.g.:
> FindRoot[sin[2*theta] + 2*h1*sin[theta - phi1] == 0 , {theta, x_middle, x_left, x_right}]
> That means that h is an mx1 matrix and X is an nx3 matrix (X = {x_middle, x_left, x_right}).
> The question:
> How can I use Map or MapThread to combine each element of h with the whole matrix X inside FindRoot to speed it up?
> Thanks for any idea.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.