Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Szabolcs Dec 14 '12 at 0:06
    
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. –  Szabolcs Dec 14 '12 at 0:11
    
Thanks very much Szabolcs, I've replaced C with x in the post (the problem persists though). –  Miles Dec 14 '12 at 0:16
    
Given the definitions of w[x] and a[x] the equation a[1] == 0 is identically true, therefore no condition for c2 is needed. –  Artes Dec 14 '12 at 0:29
1  
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. –  Szabolcs Dec 14 '12 at 0:31
show 1 more comment

1 Answer

up vote 3 down vote accepted

(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.

share|improve this answer
    
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. –  Miles Dec 14 '12 at 0:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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