Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2016-12-28 16:12:55

evene
Member
Registered: 2015-10-18
Posts: 272

### Mathematica -- Solving a system of equations over a domain

How would you solve a system of equations over a specific domain, such as the reals, integers, rationals, etc.

Specifically, I mean this:

Over the integers (i.e integer solutions). I tried this code:

``Solve[{f, f^2 g, f g^2 + f^2 h, g^3 + 6 f g h, g^2 h + f h^2, g h^2, h^3} == {c, a + c^2 d, a^2 + b + c d^2 + c^2 e, a^3 + 6 a b + d^3 + 6 c d e, a^2 b + b^2 + d^2 e + c e^2, a b^2 + d e^2, b^3 + e^3}, Integer]``

But that didn't work. Mathematica didn't respond. What went wrong?

Last edited by evene (2016-12-28 16:15:07)

Offline

## #2 2016-12-28 17:13:21

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Mathematica -- Solving a system of equations over a domain

Hi;

For one thing you have more variables than equations and there are non-linear terms.

Still using FindInstance I found this one pretty quick.

{a -> 3, b -> -1, c -> 1, d -> 0, e -> 0, g -> 3, h -> -1}

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #3 2016-12-29 07:59:07

evene
Member
Registered: 2015-10-18
Posts: 272

### Re: Mathematica -- Solving a system of equations over a domain

Oh... I was kind of hoping that

.

So replace Solve[] with FindInstance[]? Is that what was wrong with my code?

Offline

## #4 2016-12-29 08:27:36

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Mathematica -- Solving a system of equations over a domain

That is what I was looking for too but I could not find a solution like that quickly.

There is not much wrong with your code and using FindInstance is just another try at getting an answer. There are other commands too.

When Hercules was instructed to get a bunch of magical apples he was told that only Atlas ( I am using the Roman names here ) could fetch them for him. So Hercules took the journey to go see Atlas. When he got there he could see that Atlas was really busy. I mean, the guy was literally holding up the entire world on his shoulders. He also noticed how hard Atlas was working to hold that weight but still Hercules took the world from Atlas' mighty shoulders and sent him to get those delicious apples. Even Hercules strained under the task of holding up the world. Some historians believe that the strain was so great that Hercules' spleen exploded.

The point: Mathematica is like Hercules. If you ask it to do an extremely difficult problem it will have to work very hard. You saw how hard it was working and for how long. The moral of the story: Hard tasks are hard to do even if you are Hercules.

This is where you come in to the story. You could have told Hercules to put a back supporter on or maybe given him a protein shake ( mixed in a blender of course ) to strengthen him. Or, you could have lightened the load by eliminating all the humans and their skyscrapers from the face of the earth. Math is like the earth, a big heavy ball of grass, water and air. You have to make the problem a bit easier when Mathematica struggles, else it too will suffer from an exploding spleen.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #5 2016-12-29 08:56:05

evene
Member
Registered: 2015-10-18
Posts: 272

### Re: Mathematica -- Solving a system of equations over a domain

But Mathematica doesn't have a spleen!

Hm... okay, then this is a bit problematic.

So using an alternative method, I got (I think) a smaller system, but with the same number of variables. Is that considered an improvement?

Offline

## #6 2016-12-29 08:56:52

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Mathematica -- Solving a system of equations over a domain

Does it run any faster?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #7 2016-12-29 08:57:48

evene
Member
Registered: 2015-10-18
Posts: 272

### Re: Mathematica -- Solving a system of equations over a domain

I haven't written/tested the program code yet...

Offline

## #8 2016-12-29 09:02:40

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Mathematica -- Solving a system of equations over a domain

That is the best test. Are there any other equations?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #9 2016-12-30 04:03:43

evene
Member
Registered: 2015-10-18
Posts: 272

### Re: Mathematica -- Solving a system of equations over a domain

No, I think that's it...

Then what would be the code? I tried

``Solve[{c^2 f, c f^2, 6 c e f + f^3, e f^2, e^2 f} == {a + c^2 d, a^2 + c d^2, a^3 + 6 a b + d^3 + 6 c d e, a^2 b + d^2 e, a b^2 + d e^2}, Integer]``

But the output was just
.

Last edited by evene (2016-12-30 04:04:02)

Offline

## #10 2016-12-30 04:06:43

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Mathematica -- Solving a system of equations over a domain

You have a syntax error!

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #11 2017-01-05 13:03:58

evene
Member
Registered: 2015-10-18
Posts: 272

### Re: Mathematica -- Solving a system of equations over a domain

Thanks, I got it!

Another question: Is there a way to solve

For
and
such that the formula for
does not include
and vice versa.

I'm trying to find a substitution for
and
such that when they are substituted into
, it produces an identity such as
.

Offline

## #12 2017-01-05 13:55:02

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Mathematica -- Solving a system of equations over a domain

Hi;

I do not understand what you want.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline