Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.5K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Help with programming (finding roots)

Posted 11 years ago

Hi I have defined a two variable f(a,b) function and now I have to solve an equation where I have to call that function four times. I have to solve for one of those variable (a). For the other variable (b) I have assigned numerical values. The code is as follows (also attached): The computer is hanging. Can anyone help me?

n0 := 1.50355
ne := 1.64131
e := 1/ne
d := 1/n0
c := Sqrt[(e *Cos[a])^2 + (d *Sin[a])^2]
f[a_, b_] := (1/((e *Cos[a])^2 + (d *Sin[a])^2)) (e^2 - d^2) Sin[
    a] Cos[a] Sin[
    b] + (1/Sqrt[(e *Cos[a])^2 + (d *
          Sin[a])^2]) (1 - (e^2 d^2 (Sin[b])^2)/
       Sqrt[(e *Cos[a])^2 + (d *Sin[a])^2])^0.5 - (1/
     d) (1 - (d* Sin [b])^0.5)
b1 := (-14.78*Pi)/180
b2 := (5.0096*Pi)/180
b3 := (-5*Pi)/180
b4 := (16.95*Pi)/180
Solve[((f[a, b1] - f[a, b2])/(f[a, b3] - f[a, b4])) == 1, a]
Attachments:
POSTED BY: cleveland cav
2 Replies
Posted 11 years ago
Attachments:
POSTED BY: David Keith

To put code in your post please use the formatting tools at the top of the input area.

Your

NSolve[x[a_] == 1, a]

should be

NSolve[x[a] == 1, a]

Your function x[a] is a complicated (and Complex in the sense of involving the complex plane) trigonometric expression. So it is not clear that you will converge easily to a solution. You may have better luck with FindRoot.

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard