2
$\begingroup$

Many years ago a friend of mine solved a product package problem for me. Now I am struggling to recreate the notation. The problem was there were product bundles including plane, hotel and car rental from alternative providers. Let say Airlines1 is a, Hotel1 is b, Rental1 is c, Airlines2 is d, Hotel2 is e and Rental2 is f. I was informed with only package prices such as:

    a+e+c=400
    d+b+f=380
    a+b+f=330
    d+e+c=450

My friend defined a matrix in wolframalpha.com and wolframalpha came up with a result such as "There is one possible solution, a=200, b=100, c=50, d=250, e=150, f=30"

Now I am trying to replicate the solution again but I am unsuccessful with the syntax. What I've tried so far:

    {{a,e,c},{d,b,f},{a,b,f},{d,e,c}}={400,380,330,450}

and

    LinearSolve[{{a,e,c},{d,b,f},{a,b,f},{d,e,c}},{400,380,330,450}]

Could anyone help me please with the correct syntax for the desired solution?

$\endgroup$

1 Answer 1

6
$\begingroup$

If you want to set up your problem like that, you can do something like:

mat = {{a, e, c}, {b, d, f}, {a, b, d}, {d, e, c}}
y = {400, 380, 330, 450}
Solve[Total[mat, {2}] == y]

Use FindInstance instead of Solve if you just want a solution out of the many possibilities.

Also: do not use single capital letters as variables! Many of them are built-in functions or constants (E is Euler's constant, for example) that you shouldn't use as free variables.

$\endgroup$
3
  • $\begingroup$ Thank you very much. You are right about capitalization. I corrected. One last note I wasn't clear that, I need this syntax to be used specifically in wolframalpha.com. I input your syntax but it came up with only normal matrix notation without any solutions. I used semicolons instead of linebreaks but it didn't work. $\endgroup$
    – Litestone
    Commented Mar 13, 2023 at 9:58
  • $\begingroup$ You could also try Wolfram Cloud. $\endgroup$
    – Moo
    Commented Mar 13, 2023 at 10:31
  • 1
    $\begingroup$ Ok finally I found the correct notation. {{a, d, a, d} + {e, b, b, e} + {c, f, f, c}}={400, 380, 330, 450} Since this is the only answer I will accept as solution. $\endgroup$
    – Litestone
    Commented Mar 13, 2023 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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