Group Abstract Group Abstract

Message Boards Message Boards

Find the function for a decision variable

Posted 1 year ago

Hi, I'm currently trying to find the equation for a decision variable from a total profit equation using Mathematica. From what I've read, I can use the solve function to do this. Here's a example i found:

(*Define the total cost function*)
TC[Q_] := (D S/Q) + (H Q/2)

(*Compute the first derivative*)
dTCdQ = D[TC[Q], Q]

(*Solve for Q*)
solution = Solve[dTCdQ == 0, Q]

(*Simplify the solution*)
simplifiedSolution = Simplify[solution]

However, when I try to apply this to my actual equation, the program runs for hours without completing (it stuck). Here is my specific code:

TP[x_] = pr/x ((a (1 - b) (x^2))/(2 L) ((y g)/(1 + y g)))^(1/(
   1 - b)) - ((c + 1) (Kr/x + Kp/(n x) + Kf/(
      n x) + (hr + g)/
       x (2 x (-((a (-1 + b) g x^2 y)/(L + g L y)))^(1/(1 - b))) + (
       hp + g)/(2 R x) ((a (1 - b) (x^2))/(2 L) ((y g)/(1 + y g)))^(
       2/(1 - b)) + ((hp + g) (n - 1))/(
       2 x) ((a (1 - b) (x^2))/(2 L) ((y g)/(1 + y g)))^(2/(
       1 - b)) (x ((a (1 - b) (x^2))/(2 L) ((y g)/(1 + y g)))^(1/(
          1 - b)) - 1/R) + 
      1/x^2 S + (v/x + vp/(n x)) ((a (1 - b) (x^2))/(
         2 L) ((y g)/(1 + y g)))^(1/(1 - b)) + 
      1/(n x)^2 Sv + (Pv w)/( 
       x f ww) ((a (1 - b) (x^2))/(2 L) ((y g)/(1 + y g)))^(1/(
       1 - b)) + (((cf f) + (m bk))/( 
        x f ww ) {k n x + 
          k/q (Log[1 + z E^(-q n x)] - Log[1 + z])}) )) + (c ((pp/x + 
        pf/x) ((a (1 - b) (x^2))/(2 L) ((y g)/(1 + y g)))^(1/(
      1 - b)))) + (pr/x l (
     2 a g (x^2)
       y (((-((a (-1 + b) g x^2 y)/(L + g L y)))^(1/(1 - b)))^b) )/(
     L + g L y) - ((a (1 - b) (x^2))/(2 L) ((y g)/(1 + y g)))^(1/(
     1 - b)) (M - x))
(*Compute the first derivative*)
dTPdx = D[TP[x], x]

(*Solve for p*)
solution = Solve[dTPdx == 0, x]

(*Simplify the solution*)
simplifiedSolution = Simplify[solution]

Any suggestions on how to resolve this issue? Are there more efficient methods or best practices I should consider for solving complex equations in Mathematica?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard
Be respectful. Review our Community Guidelines to understand your role and responsibilities. Community Terms of Use