Message Boards Message Boards

0
|
5744 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Store variables after using Solve?

Posted 5 years ago

Hello everyone, I'm new here and new to Mathematica, very excited about it.

I have two questions:

1)is there a way to store variables after a Solve operation? For example a=Solve[x+1==0,x]

2)solving this gives me troubles: Solve[s^2+s+1==0,s] result s -> -(-1)1/3}, {s -> (-1)2/3}. Correct result are two complex conjugate radixes, is that a sort of module+phase writing? If so is there a way to obtain arithmetic format? Using the domain field Solve[s^2+s+1==0,s,Complexes] doesn't help. The thing I do not understand further is that if I solve as^2 +bs +c==0 it gives be the classical 2nd order formula and if then I substitute a=b=c=1 then I get the correct complex radixes in arithmetic form!

Thanks.

POSTED BY: Ermanno Citraro
4 Replies
Posted 5 years ago

To answer your first question, if this is what you mean, try this.

Clear[a, b, c]; p = 
 Solve[{a^2 + b^2 == c^2, a > 0, b > 0, c > 0, a < b, c <= 50}, {a, b,
    c}, Integers]

and to then store the results, I use this method though there are other ways to achieve this.

q = {a, b, c} /. p

Hope this helps.

POSTED BY: Paul Cleary

It's not what a really meant on 1) but thanks for reply. The different sintax you provided will be usefull in the near future.

POSTED BY: Ermanno Citraro

You replied to everything in two lines, great, thanks a lot!

POSTED BY: Ermanno Citraro

Mathematica understands that the solution is complex and is probably trying to write it in the most compact form. To expand, you could use ExpToTrig like so

roots = (s /. Solve[s^2 + s + 1 == 0, s]) // ExpToTrig
ListPlot[(Tooltip[{Re[#1], Im[#1]}] &) /@ roots, AspectRatio -> 1]
POSTED BY: Tim Laska
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract