SOLVED:Why does solve give no solution on my PC but it does when running exact same script on different PC?

1 view (last 30 days)
Hi, I've got a problem with the solve function. I'm trying to solve the following equations:
equ1 := sqrt(abs(100-100*nx^2/(nz^2+ny^2+nx^2))^2+10000*abs(nx*ny/(nz^2+ny^2+nx^2))^2+10000*abs(nx*nz/(nz^2+ny^2+nx^2))^2)-86.6
equ2 := sqrt(abs(-150+(50*(2*ny+3*nx))*nx/(nz^2+ny^2+nx^2))^2+abs(100-(50*(2*ny+3*nx))*ny/(nz^2+ny^2+nx^2))^2+2500*abs((2*ny+3*nx)*nz/(nz^2+ny^2+nx^2))^2)-179.44
I want to solve them for the variables nx and ny, leaving nz as a symbolic variable using:
S = solve(equ1, equ2, nx, ny)
I know that a numeric solution exists because I've managed to get it in Maple and I've also verified that Maple gives the correct solution. The interesting thing is, that when I give the exact same script to my boss at university and he runs it with his 2010a release, everything works. I've already tried it with 2011a, 2010a and 2010b but everytime I get the error:
Warning: Explicit solution could not be found. > In solve at 81 In Pos_ueber_Ebenen at 42
S =
[ empty sym ]
I'm using the student version, might that be the problem?
Thank you for your help!
Best wishes Tobias

Answers (2)

Walter Roberson
Walter Roberson on 4 Aug 2011
You are probably using a version that still used Maple as its symbolic engine. The versions your boss is running use MuPad as their symbolic engine, and it can be significantly more difficult to get MuPad to solve some equations.
If you can get Maple to solve for a sufficiently general form, and if you have a sufficiently recent Maple, you can use CodeGeneration[Matlab] to have Maple convert the Maple expressions in to MATLAB code (though that Maple facility could use improvements to be sure.)
  1 Comment
Walter Roberson
Walter Roberson on 4 Aug 2011
Note: if your Maple does not support the CodeGeneration package, it probably supports the older codegen that is at least able to translate in to C. You could then mex-ify the C if it seemed worthwhile.

Sign in to comment.


Tobias
Tobias on 4 Aug 2011
Hey,
thank you for your answer.
I don't think, that either of the versions is still using Maple because they're at least 2010a and I think Maple has been replaced by MuPad in 2009. So I think they're both running MuPad. Mine is for sure because when I type "symengine" into the command window a pop up says that MuPad is the only symbolic engine that can be used now.
Apart from that unfortunately Maple can't solve the equations whitout the explicit numbers at the end of the equations (237.47 and 179.44) and I need these numbers to be variables in my script (the actual values posted above are only examples). The equations look like this, when you leave them as variables:
equ1 := sqrt(abs(200-(10*(-13*ny+20*nx))*nx/(nz^2+ny^2+nx^2))^2+abs(130+(10*(-13*ny+20*nx))*ny/(nz^2+ny^2+nx^2))^2+100*abs((-13*ny+20*nx)*nz/(nz^2+ny^2+nx^2))^2)-l1_str
equ2 := sqrt(abs(-150+(50*(2*ny+3*nx))*nx/(nz^2+ny^2+nx^2))^2+abs(100-(50*(2*ny+3*nx))*ny/(nz^2+ny^2+nx^2))^2+2500*abs((2*ny+3*nx)*nz/(nz^2+ny^2+nx^2))^2)-l3_str
  1 Comment
Tobias
Tobias on 6 Aug 2011
Problem solved.
Had to install the Maple Symbolic Toolbox for Matlab which comes with Maple and whose installer can be found in the Maple directory. Turned out, my boss had it installed, so you were right in a way because while I was using Mupad he was using Maple. That's also the reason, why he got an error when he entered 'symengine' into the command window. Anyway, I'm very glad, I found the reason. Cost me about 2 days ;)

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!