Effacer les filtres
Effacer les filtres

Answer format for solve()

3 vues (au cours des 30 derniers jours)
Billy
Billy le 2 Juin 2011
I don't like the way MuPad inserts an extra parameter in the solution to a problem I gave it:
solve( { v1 + v2*t + v3*t^2 = 0,
v1*-2 + v2*(-2*t+1) + v3*(-2*t^2 + 2*t) = 0,
v1*4 + v2*(4*t-4) + v3*(4*t^2 - 8*t + 2)=12 } )
Answer: {[t = -z/12, v1 = z^2/24, v2 = z, v3 = 6]}
So I have 2 questions here:
  1. How do you stop mupad from using a parameter, or remove z from the equations and have the solution in t only?
  2. If you square z in the solution for v1, you lose the negativity, so isn't this answer strictly speaking not correct? (Since v1 = 6*t^2, not -6*t^2 as it should be?)

Réponse acceptée

Walter Roberson
Walter Roberson le 2 Juin 2011
1. Specify the variable you want to solve for
solve(...,{z,v1,v2,v3})
2. The solution set I get in terms of t is
z = z, v1 = 6*t^2, v2 = -12*t, v3 = 6
If I back-substitute those in to the original equations, I get 6=6 and 12=12 which are logical truths, so v1 = 6*t^2 is correct.
If I back-substitute using v1 = -6*t^2 and the rest the same, I get
-12*t^2 = 0, 24*t^2 = 0, -48*t^2+12 = 12
which is true if and only if t=0

Plus de réponses (1)

Andrew Newell
Andrew Newell le 2 Juin 2011
1. Just specify the variables:
solve(...,{v1,v2,v3})
2. In your solution, if you substitute for all four variables, the equation is zero.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by