cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Using solve block with multiple input values

JCrenshaw
1-Newbie

Using solve block with multiple input values

This is an embarrassing question because I think I used to know the answer. I have a function f(x,y), and am using a

solve block like this:

x :=1 y:= 2

Given f(x,y) =0 y=Find(y) (using <ctrl>=, of course)

So far, so good, and the solver finds the solution, no problem.

Now I want to do the same thing for a whole set of values for x. I vaguely remember that one can't used indexed

variables in a solve block. But I'm setting up x as an array of values, and setting the first guess y to also be an

array of the same size, Then I pass both arrays to the solve block. I tried this with a much simpler function y = exp(x)

and it worked just fine. But on my real problem, the solve block either says, "No solution found," or gives me a vector of

results that are wrong.

If I pass the individual elements of x, one at a time, it works fine and I get the right answers. But needless to say, I'd

rather not run the solve block 100 times to get the points on my braph.

What am I doing wrong?

2 REPLIES 2

Hello!

Please attach a Mathcad worksheet to the message. Which version of Mathcad are you using?

I'm using MC13. The problem worksheet is very long -- the solve block in question is at something like Equation 40. I'm working on a stripped-down version that shows the situation without all the preceding derivations.

Having said that, I see what the problem is. In the actual equation, I have several terms of the form r * cos(theta). Then I set up a vector of thetas, and my intent was to solve for the corresponding values of r.

In my solve block, I'm passing both the array theta, and a corresponding array of first guesses, r0. My intent, of course, was to have Mathcad run the solver, element by element, for each value of theta.

The problem is that Mathcad generates a vector cos(theta) for each element of theta. But then, when it sees

r*cos(theta), it interprets the product as a vector dot product, and generates a scalar result. Not what I had in mind at all.

Can anyone tell me how to explain to the solver that I want it to solve scalar equations, n times, rather than a pair of n-vectors?

Thanks

Top Tags