2

I am a brand new to using Mathematica, and currently using it for my thesis.

Essentially I have a really long expression made up of lots of parameters.

that looks like this

I am trying to reduce the size of the expression to something a lot smaller.

Just wondering if anyone had any ideas/tips to help me out.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Taylor
  • 35
  • 5
  • 5
    This probably should be done along the way that generated that expression. What code generated it? – Coolwater Jun 29 '19 at 07:23
  • So I defined a pretty convoluted 4x4 matrix (m) and super simple vector (Y). Then used the commands c = Inverse[m].Y --> c1 = c[[1]] – Taylor Jun 29 '19 at 08:44
  • 2
    Your formulation is not clear: the Normalize command of Mathematica is applicable to vectors and complex numbers only. Please refine your question. – user64494 Jun 29 '19 at 08:53
  • 1
    To get concrete answers, please ask a concrete question. Right now your question is so abstract that the answers will be equally abstract: try FullSimplify, Simplify, PowerExpand etc. possibly with assumptions? – Roman Jun 29 '19 at 15:29
  • People here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this meta Q&A helpful – Michael E2 Jun 30 '19 at 21:23
  • An outside chance of being related: https://mathematica.stackexchange.com/a/58985/4999 – Michael E2 Jun 30 '19 at 21:23
  • Welcome to Mma.SE. Start by taking the [tour] now and learning about asking and what's on-topic. Always [edit] if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. – rhermans Jul 05 '19 at 16:07
  • Here it's considered helpful to show your own efforts and share your code in a well formatted form instead of images or links to external files, so we can quickly Copy&Paste your code, test it, and see the problem you are facing. Please help us to help you and [edit] your question accordingly. This question in Meta could be useful. – rhermans Jul 05 '19 at 16:08
  • 1
    Your question may be put on-hold because it's not clear what you need. To avoid or revert the Hold you can [edit] your question to improve it and make it specific, well-structured and easy to understand. Please don't be discouraged by that cleaning-up policy. Your questions are and will be most welcomed. Learn about good questions here. – rhermans Jul 05 '19 at 16:08

1 Answers1

10

It might help to be familiar with how expressions are structured in the Wolfram Language. Try reading through some of the tutorials here, particularly this one about expressions as trees and then this one about extracting certain levels of these trees.

It looks like your expression has a lot of smaller repeating subexpressions. As far as I know there isn't a great way to deal with simplifying such expressions built into the language; one that would extract these repeating subexpressions, replacing their instances in the original expression with some unique variable and then annotating the whole thing with maybe an Inactive[With] to mimic the "where x = ..." often seen in mathematical literature.

One thing you can do to approximate this feature is to enumerate all of the subexpressions that appear in your expression and see which ones appear most often, then do a simple ReplaceAll. For example, if you have an expression like the following

step response

assigned to a symbol called expr, I could do the following

Level[expr, -5] // Tally // MaximalBy[Last]

common subexpression

to find which subexpression (subtree) with height of at least 5 occurs most often. Assigning this subexpression to subexpr and then using ReplaceAll you get

expr /. subexpr -> x

simplified

which is clearly a much smaller and more manageable expression.

While not a comprehensive answer, hopefully this gives you some additional avenues to explore beyond what other users have suggested.

ccosm
  • 408
  • 3
  • 8