Skip to main content
Short and clear title. Improved formatting.
Source Link
Johu
  • 5k
  • 17
  • 43

Fairly simple derivative but Solve and Reduce (as I've implemented them) are having trouble solvingdon't solve a simple derivative for its real roots

As I'm only interested in Realreal solutions. I've tried restricting the SolveSolve to RealsReals but it never solves it. Leaving out the Solve[...,Reals]Solve[_,Reals] can get a solution, but it ends up with (sometimes vanishingly small) complex components. Maybe it's just too many [if a>b's and c<=d's grandmothers and b<h's second cousins scenarios][if a>b's and c<=d's grandmothers and b<h's second cousins scenarios] for it to solve? 

Also my approach may not be the most elegant here, so any help would be greatly appreciated! (I do need to "functionalize" any Real solutions as I'll likely be using this in some other program)

Fairly simple derivative but Solve and Reduce (as I've implemented them) are having trouble solving for its real roots

As I'm only interested in Real solutions I've tried restricting the Solve to Reals but it never solves it. Leaving out the Solve[...,Reals] can get a solution, but it ends up with (sometimes vanishingly small) complex components. Maybe it's just too many [if a>b's and c<=d's grandmothers and b<h's second cousins scenarios] for it to solve? Also my approach may not be the most elegant here, so any help would be greatly appreciated! (I do need to "functionalize" any Real solutions as I'll likely be using this in some other program)

Solve and Reduce don't solve a simple derivative for its real roots

As I'm only interested in real solutions. I've tried restricting the Solve to Reals but it never solves it. Leaving out the Solve[_,Reals] can get a solution, but it ends up with (sometimes vanishingly small) complex components. Maybe it's just too many [if a>b's and c<=d's grandmothers and b<h's second cousins scenarios] for it to solve? 

Also my approach may not be the most elegant here, so any help would be greatly appreciated! (I do need to "functionalize" any Real solutions as I'll likely be using this in some other program)

Source Link

Fairly simple derivative but Solve and Reduce (as I've implemented them) are having trouble solving for its real roots

As I'm only interested in Real solutions I've tried restricting the Solve to Reals but it never solves it. Leaving out the Solve[...,Reals] can get a solution, but it ends up with (sometimes vanishingly small) complex components. Maybe it's just too many [if a>b's and c<=d's grandmothers and b<h's second cousins scenarios] for it to solve? Also my approach may not be the most elegant here, so any help would be greatly appreciated! (I do need to "functionalize" any Real solutions as I'll likely be using this in some other program)

Print["function"]
y[a_, b_, c_, d_, e_, f_, g_, h_, x_] := 
  a*Log[1 - e*x] + b*Log[1 - f*x] + c*Log[1 + g*x] + d*Log[1 + h*x];
y[a, b, c, d, e, f, g, h, x]

Print["derivative"]
(*dEV1[b,Subscript[p, 1],x]=D[EV1[b,Subscript[p, 1] ,x],x]*)
yprime[a_, b_, c_, d_, e_, f_, g_, h_, x_] := 
  D[y[a, b, c, d, e, f, g, h, x], x];
(*dEV1[b_,p1_,x_]:=D[EV1[b,Subscript[p, 1] ,x],x];*)
yprime[a, b, c, d, e, f, g, h, x]

Print["solve"]
sol1 = Solve[yprime[a, b, c, d, e, f, g, h, x] == 0, x]
sol2 = Refine[
  Reduce[yprime[a_, b_, c_, d_, e_, f_, g_, h_, x_] == 0, {a, b, c, d,
     e, f, g, h, x}], 
  Assumptions -> 
   a > 0 && b > 0 && c > 0 && d > 0 && e > 0 && f > 0 && g > 0 && 
    h > 0]

Print["Functionalize solution rules"]
z1 = x /. sol1[[1]];
z2 = x /. sol1[[2]];
fsol11[a_, b_, c_, d_, e_, f_, g_, h_] = 
 z1 /. {a -> a, b -> b, c -> c, d -> d, e -> e, f -> f, g -> g, h -> h}
fsol12[a_, b_, c_, d_, e_, f_, g_, h_] = 
 z2 /. {a -> a, b -> b, c -> c, d -> d, e -> e, f -> f, g -> g, h -> h}

Print["Example"]
fsol11[1, 2, 3, 4, 5, 6, 7, 8]
fsol12[1, 2, 3, 4, 5, 6, 7, 8]