Message Boards Message Boards

[✓] Solve equation a+b*x=cot(x) in Mathematica numerically?

GROUPS:

Hi all, I am Bin, a PhD student on graphene antenna. I am doing a calculation of dispersion relation of SPP wave propagation on Graphene.

There is a equation like I mentioned in title. Obviously there is no close form expression for x in this equation. So it should be done numerically.

I use function 'SOLVE/Nsolve' to deal with this problem but it turns out a error said 'This system cannot be solved with the methods available to NSolve/solve".

Could you please help me on this ?

Any comments or suggestions would be great.

Thanks in advance.

Best

BIN

POSTED BY: Bin ZHANG
Answer
4 months ago

With numeric coefficients and bounds on x it works:

With[{a = 1, b = 2},
 Solve[a + b*x == Cot[x] && 0 < x < Pi/2, x]]
POSTED BY: Gianluca Gorni
Answer
4 months ago

Thank you Gianluca !!! Does it work for complex number ? like if b=1+5i or any complex else.

Or this equation is just not doable if there is a complex in it ?

I set b as a complex and it shows the error again.....

Regards, Bin

POSTED BY: Bin ZHANG
Answer
4 months ago

You will have to give a complex bound on x:

With[{a = 1, b = 1 + 5 I}, 
 Solve[a + b*x == Cot[x] && Abs[x] < Pi/2, x]]
POSTED BY: Gianluca Gorni
Answer
4 months ago

Group Abstract Group Abstract