0
$\begingroup$

what is wrong with this? It runs forever and never displays anything on the screen.

NSolve[{E^-k == (Cg + m)/(Cs - (Cs/q) + ((E^(\[Theta]q\[Alpha]E^(-k))       
-1)/(q\[Theta]E^(-k) \[Tau] (E^(\[Theta]q\[Alpha]E^(-k)) + \
\[Tau] - 1)))) \[Tau] + (\[Alpha]/\[Tau]) + m,
(E^(\[Theta]q\[Alpha]E^-k) - 1)/(\[Tau] + 
 E^(\[Theta]q\[Alpha]E^(-k)) -1) == \[Theta]E^(-k) \[Tau] (Cs + (q\[Beta]/(1 
 -E^(-k) \[Tau])^2)) /. {q -> 0.5, \[Alpha] -> 4, Cg -> 5, 
 m -> 5, Cs -> 7, \[Beta] -> 0.5, \[Theta] -> 0.3}}, {\[Tau], k}, Reals]

screenshot below

$\endgroup$
5
  • $\begingroup$ You see the brackets are red? THat means they are mis-matched. Please place the code in executable format (not an image) so that we can run it and see. $\endgroup$
    – bill s
    Feb 11, 2018 at 18:31
  • $\begingroup$ NSolve[{E^-k == (Cg + m)/(Cs - (Cs/ q) + ((E^([Theta]q[Alpha]E^(-k)) - 1)/(q[Theta]E^(-k) [Tau] (E^([Theta]q[Alpha]E^(-k)) + \ [Tau] - 1)))) [Tau] + ([Alpha]/[Tau]) + m, (E^([Theta]q[Alpha]E^-k) - 1)/([Tau] + E^([Theta]q[Alpha]E^(-k)) - 1) == [Theta]E^(-k) [Tau] (Cs + (q[Beta]/(1 - E^(-k) [Tau])^2)) /. {q -> 0.5, [Alpha] -> 4, Cg -> 5, m -> 5, Cs -> 7, [Beta] -> 0.5, [Theta] -> 0.3}}, {[Tau], k}, Reals] $\endgroup$
    – user55225
    Feb 11, 2018 at 18:53
  • $\begingroup$ Please, do not post images of your code. Instead, read how to type a post in mathematica.stackexchange.com in helpful way to others can reproduce and assist you. $\endgroup$ Feb 11, 2018 at 18:54
  • $\begingroup$ user55225 -- it is not possible to copy/paste the code you have posted in the comment. Repost by editing your original. Check to make sure that the code you enter actually can be run (even if it does not do what you want it to). Otherwise people cannot help you. $\endgroup$
    – bill s
    Feb 11, 2018 at 19:29
  • $\begingroup$ I posted my code $\endgroup$
    – user55225
    Feb 11, 2018 at 19:56

1 Answer 1

1
$\begingroup$
FindRoot[{
  E^-k == (Cg+m)/(Cs-Cs/q+(E^(θ*q*α*E^-k)-1)/(q*θ*E^-k*τ*(E^(θ*q*α*E^-k)+τ-1)))*τ+α/τ+m,
  (E^(θ*q*α*E^-k)-1)/(τ+E^(θ*q*α*E^-k)-1) == θ*E^-k*τ*(Cs+q*β/(1-E^-k*τ)^2)} /.
{q->1/2, α->4, Cg->5, m->5, Cs->7, β->1/2, θ->3/10}, {{τ, 1}, {k, 1}}, 
WorkingPrecision -> 16]

immediately returns

{τ->4.045735266605817, k->37.94584124554267}

but if you increase that working precision you get different values for k from 19 out to 106 and beyond so there may be multiple solutions for this.

If for each of your equations you Plot the left hand side-right hand side with that value of τ substituted in and for values of k ranging from 1 to 106 then you can see the somewhat inconvenient behaviour of your two equations.

$\endgroup$
4
  • $\begingroup$ Thank you so much for your help..But do we need to mention working precision always? $\endgroup$
    – user55225
    Feb 11, 2018 at 21:24
  • $\begingroup$ Also, It is still taking a lot of time to run the code.I still could see only "running" status $\endgroup$
    – user55225
    Feb 11, 2018 at 21:33
  • $\begingroup$ I am using 11.2 version and I just copy pasted the code pasted by you. $\endgroup$
    – user55225
    Feb 11, 2018 at 21:38
  • $\begingroup$ Thank you very much. I appreciate your help. $\endgroup$
    – user55225
    Feb 11, 2018 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.