I am trying to solve the following equations for the coefficients c1 and c2.

w[x_] := c1*(1 - x)  
a[x_] := c2*(1 - x)

Given the constraints:

Solve[(1 + w[x]*a[x]) == (1/x) && w[0] == wmax && a[1] == 0 , {c1, c2}]

Mathematica gives me:

{{c1->wmax,c2->1/((x-x^2) wmax)}}

However when plugging the formula for c2 into a, the condition a[1] == 0 is not satisfied. Instead of being zero, a[1] == 1/wmax.

How can I convince Solve to generate a c2 that truly makes a[1] == 0?

  • $\begingroup$ Welcome to Mathematica.SE! I have formatted the post for better readability. Please click the edit link above to see how to do this for your next post. $\endgroup$ – Szabolcs Dec 14 '12 at 0:06
  • $\begingroup$ As you can see from the syntax colouring the the notebook interface, C is a defined system symbol. It is used for several purposes by the system. Make sure you never use a system symbol where you need an undefined one! Even if it hasn't caused trouble in this example, it will sooner or later. (Actually there was a post a couple of days ago where using C did cause problems.) In general, it is good practice never to use symbols starting with capitals. All system symbols start with a capital, so if your own ones start with a lowercase, you can be sure you won't run into this kind of trouble. $\endgroup$ – Szabolcs Dec 14 '12 at 0:11
  • $\begingroup$ Thanks very much Szabolcs, I've replaced C with x in the post (the problem persists though). $\endgroup$ – Miles Dec 14 '12 at 0:16
  • $\begingroup$ Given the definitions of w[x] and a[x] the equation a[1] == 0 is identically true, therefore no condition for c2 is needed. $\endgroup$ – Artes Dec 14 '12 at 0:29
  • 1
    $\begingroup$ Someone will surely post a more mathematically sound answer, but the problem is the following: notice that a[1] == 0 holds for any constant c2 (i.e. independent of x). The remaining two conditions tell you that c1 and c2 must depend on x the way you posted in your answer. This c2 == 1/(wmax x - wmax x^2) is undefined for x==1 (1/0), but taking the limit x -> 1 gives a[x] -> 1/wmax (and not 0). It's a good example of a simple problem where you can't just blindly input equations into a CAS and look at what comes out. You need to be careful and look at what is happening. $\endgroup$ – Szabolcs Dec 14 '12 at 0:31

(1) it works for me.

w[x_] := c1*(1 - x)
a[x_] := c2*(1 - x)

eqns = (1 + w[x]*a[x]) == (1/x) && w[0] == wmax && a[1] == 0;
sol = Solve[eqns, {c1, c2}]

(* {{c1 -> wmax, c2 -> -(1/(wmax (-x + x^2)))}} *)

Simplify[eqns /. sol]

(* {True} *)

(2) a[1] evaluates to 0 independently of solution values.

  • $\begingroup$ Thanks Daniel, I am still a little confused, if I substitue c2 into a I have: a[x_] := (1 - x)*-1/(wmax (-x + x^2)) a[1] = Indeterminate And the limit approaches 1/wmax as x->1. $\endgroup$ – Miles Dec 14 '12 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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