Hi! I am trying to solve 2 equations simultaneously.
There are 4 variables (x,y,a,b) in these 2 equations. 2 of these variables (x,y) are to be determined using Mathcad.
The other 2 variables (a and b) are given, However there is a large set of values of 'a' and 'b', around 1000!
If it was only 2 set i would have replaced the values of 'a' and 'b' each time, then take the solutions for (x,y).
However replacing 'a' and 'b' 1000 times doesn't seem a good idea!
I was wondering if there is a way in Mathcad to define 'a' and 'b' as arrays of values and then solve for x and y. So as to obtain the solution for all pairs of (a,b) at one go.
Thanks for helping!
Solved! Go to Solution.
The solution is to turn the solve block into a function of a and b and all this function (vectorized) with two data vectors as argument.
If these data vectors are not of the same dimension and you want to solve for every combination of values from the two vectors, then a small program routine would be necessary.
See if the attached would help.
Vectorization is not really necessary in case of your equations, but is used here just to be on the safe side.
At the end of the sheet you find a different approch using symbolics, which gives you both pairs of x/y for every a/b. The solve block will only give you one, depending on the guess values you provide and/or additional constraints.
The solution is to turn the solve block into a function of a and b and all this function (vectorized) with two data vectors as argument.
If these data vectors are not of the same dimension and you want to solve for every combination of values from the two vectors, then a small program routine would be necessary.
See if the attached would help.
Vectorization is not really necessary in case of your equations, but is used here just to be on the safe side.
At the end of the sheet you find a different approch using symbolics, which gives you both pairs of x/y for every a/b. The solve block will only give you one, depending on the guess values you provide and/or additional constraints.
Thanks Werner. It was very helpful indeed!
There's only 1 hiccup now. The values for 'a' and 'b' are provided in an Excel sheet.
In a_vec:=stack(15,36,50,55), i'll have to enter each of these data manually. Is there a way i can copy the data from the Excel sheet directly into Matcad? Normally i wouldn't mind doing it manually but since there's a really large data set, it going to take me hours!
I'm sending you part of the Excel sheet. I'll be really grateful if you could help me. Thanks!
There are at least four different ways how you can get your data into Mathcad.
P.S.: There is nothing wrong at using Mathcad's built-in help system
Further to Werner comments I would highly recommend using one of the file input options. I have passed many worksheets to the forum in the past which will help. I will try and find them and post for information.