Cell formatting and hiding codeProgrammatic formatting for Mathematica code - possible?How to change default settings of cell formatting?Mathematica Presentation Cell FormattingHow to prevent a definition from overwriting my inputFormatting of partial and ddCode formattingWould like input and output printed on same line, w/o needing extra syntaxCode indenting of // postfix functionsIs there any code formatting style reference?Formatting an input cell

Can I sign legal documents with a smiley face?

Is possible to search in vim history?

Is camera lens focus an exact point or a range?

Does the Mind Blank spell prevent the target from being frightened?

Varistor? Purpose and principle

List of people who lose a child in תנ"ך

If a character with the Alert feat rolls a crit fail on their Perception check, are they surprised?

Could the E-bike drivetrain wear down till needing replacement after 400 km?

Is it possible to have a strip of cold climate in the middle of a planet?

Drawing ramified coverings with tikz

How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?

A social experiment. What is the worst that can happen?

Greatest common substring

Is there a conventional notation or name for the slip angle?

Freedom of speech and where it applies

Can someone explain how this makes sense electrically?

Is it improper etiquette to ask your opponent what his/her rating is before the game?

Transformation of random variables and joint distributions

Customize circled numbers

What is the difference between "Do you interest" and "...interested in" something?

When quoting, must I also copy hyphens used to divide words that continue on the next line?

Two-sided logarithm inequality

About a little hole in Z'ha'dum

Folder comparison



Cell formatting and hiding code


Programmatic formatting for Mathematica code - possible?How to change default settings of cell formatting?Mathematica Presentation Cell FormattingHow to prevent a definition from overwriting my inputFormatting of partial and ddCode formattingWould like input and output printed on same line, w/o needing extra syntaxCode indenting of // postfix functionsIs there any code formatting style reference?Formatting an input cell













2












$begingroup$


I've written some code that's been getting longer and longer, Is there a way to "hide" the section of the code that does not require input so that i can just give it my two inputs and jump straight to the results?



p1 = -5, 4;
m = 9/8;

p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m;
m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
StringForm["The slope is: `1`", First[m]]
bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]]
StringForm["Slope Intercept form: y=`1`x`3``2`", First[m],
Abs[First[bb[[All, 1, 2]]]],
If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]]
denom = Max[Denominator[m]];
StringForm["Standard Form: `1`x`4``3`y=`2`",
If[Max[m] < 0, -denom*First[m], denom*First[m]],
If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"]]
StringForm["General Form: `1`x`4``3`y`5``2`=0",
If[Max[m] < 0, -denom*First[m],
denom*First[m]], -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"],
If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]]
StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
Abs[Max[Drop[p1, 1]]], Max[m], Abs[Max[Take[p1, 1]]],
If[Max[Drop[p1, 1]] >= 0, "-", "+"],
If[Max[Take[p1, 1]] >= 0, "-", "+"]]


I would like to hide or collapse the code after the first 2 lines and still be able to run it.










share|improve this question









$endgroup$











  • $begingroup$
    tutorial/DefiningFunctions ?
    $endgroup$
    – Kuba
    7 hours ago










  • $begingroup$
    If you are using the Notebook Front End GUI you can insert a new cell, perhaps "Section" and give it a descprition. Place the code suggested by the goldberg answer in the next cell. Finally insert another new "Section" with a description and place the code that calls the previous code in the next cell. You can "collapse sections" and hide cells groups by enabling "Show open/close icon for cell groups" in the "Edit" > "Preferences" > "Interface" menu.
    $endgroup$
    – Somos
    5 hours ago















2












$begingroup$


I've written some code that's been getting longer and longer, Is there a way to "hide" the section of the code that does not require input so that i can just give it my two inputs and jump straight to the results?



p1 = -5, 4;
m = 9/8;

p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m;
m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
StringForm["The slope is: `1`", First[m]]
bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]]
StringForm["Slope Intercept form: y=`1`x`3``2`", First[m],
Abs[First[bb[[All, 1, 2]]]],
If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]]
denom = Max[Denominator[m]];
StringForm["Standard Form: `1`x`4``3`y=`2`",
If[Max[m] < 0, -denom*First[m], denom*First[m]],
If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"]]
StringForm["General Form: `1`x`4``3`y`5``2`=0",
If[Max[m] < 0, -denom*First[m],
denom*First[m]], -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"],
If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]]
StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
Abs[Max[Drop[p1, 1]]], Max[m], Abs[Max[Take[p1, 1]]],
If[Max[Drop[p1, 1]] >= 0, "-", "+"],
If[Max[Take[p1, 1]] >= 0, "-", "+"]]


I would like to hide or collapse the code after the first 2 lines and still be able to run it.










share|improve this question









$endgroup$











  • $begingroup$
    tutorial/DefiningFunctions ?
    $endgroup$
    – Kuba
    7 hours ago










  • $begingroup$
    If you are using the Notebook Front End GUI you can insert a new cell, perhaps "Section" and give it a descprition. Place the code suggested by the goldberg answer in the next cell. Finally insert another new "Section" with a description and place the code that calls the previous code in the next cell. You can "collapse sections" and hide cells groups by enabling "Show open/close icon for cell groups" in the "Edit" > "Preferences" > "Interface" menu.
    $endgroup$
    – Somos
    5 hours ago













2












2








2


2



$begingroup$


I've written some code that's been getting longer and longer, Is there a way to "hide" the section of the code that does not require input so that i can just give it my two inputs and jump straight to the results?



p1 = -5, 4;
m = 9/8;

p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m;
m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
StringForm["The slope is: `1`", First[m]]
bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]]
StringForm["Slope Intercept form: y=`1`x`3``2`", First[m],
Abs[First[bb[[All, 1, 2]]]],
If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]]
denom = Max[Denominator[m]];
StringForm["Standard Form: `1`x`4``3`y=`2`",
If[Max[m] < 0, -denom*First[m], denom*First[m]],
If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"]]
StringForm["General Form: `1`x`4``3`y`5``2`=0",
If[Max[m] < 0, -denom*First[m],
denom*First[m]], -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"],
If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]]
StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
Abs[Max[Drop[p1, 1]]], Max[m], Abs[Max[Take[p1, 1]]],
If[Max[Drop[p1, 1]] >= 0, "-", "+"],
If[Max[Take[p1, 1]] >= 0, "-", "+"]]


I would like to hide or collapse the code after the first 2 lines and still be able to run it.










share|improve this question









$endgroup$




I've written some code that's been getting longer and longer, Is there a way to "hide" the section of the code that does not require input so that i can just give it my two inputs and jump straight to the results?



p1 = -5, 4;
m = 9/8;

p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m;
m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
StringForm["The slope is: `1`", First[m]]
bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]]
StringForm["Slope Intercept form: y=`1`x`3``2`", First[m],
Abs[First[bb[[All, 1, 2]]]],
If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]]
denom = Max[Denominator[m]];
StringForm["Standard Form: `1`x`4``3`y=`2`",
If[Max[m] < 0, -denom*First[m], denom*First[m]],
If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"]]
StringForm["General Form: `1`x`4``3`y`5``2`=0",
If[Max[m] < 0, -denom*First[m],
denom*First[m]], -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]],
denom*First[bb[[All, 1, 2]]]], If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"],
If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]]
StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
Abs[Max[Drop[p1, 1]]], Max[m], Abs[Max[Take[p1, 1]]],
If[Max[Drop[p1, 1]] >= 0, "-", "+"],
If[Max[Take[p1, 1]] >= 0, "-", "+"]]


I would like to hide or collapse the code after the first 2 lines and still be able to run it.







functions formatting code-review






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 7 hours ago









WomblesWombles

955




955











  • $begingroup$
    tutorial/DefiningFunctions ?
    $endgroup$
    – Kuba
    7 hours ago










  • $begingroup$
    If you are using the Notebook Front End GUI you can insert a new cell, perhaps "Section" and give it a descprition. Place the code suggested by the goldberg answer in the next cell. Finally insert another new "Section" with a description and place the code that calls the previous code in the next cell. You can "collapse sections" and hide cells groups by enabling "Show open/close icon for cell groups" in the "Edit" > "Preferences" > "Interface" menu.
    $endgroup$
    – Somos
    5 hours ago
















  • $begingroup$
    tutorial/DefiningFunctions ?
    $endgroup$
    – Kuba
    7 hours ago










  • $begingroup$
    If you are using the Notebook Front End GUI you can insert a new cell, perhaps "Section" and give it a descprition. Place the code suggested by the goldberg answer in the next cell. Finally insert another new "Section" with a description and place the code that calls the previous code in the next cell. You can "collapse sections" and hide cells groups by enabling "Show open/close icon for cell groups" in the "Edit" > "Preferences" > "Interface" menu.
    $endgroup$
    – Somos
    5 hours ago















$begingroup$
tutorial/DefiningFunctions ?
$endgroup$
– Kuba
7 hours ago




$begingroup$
tutorial/DefiningFunctions ?
$endgroup$
– Kuba
7 hours ago












$begingroup$
If you are using the Notebook Front End GUI you can insert a new cell, perhaps "Section" and give it a descprition. Place the code suggested by the goldberg answer in the next cell. Finally insert another new "Section" with a description and place the code that calls the previous code in the next cell. You can "collapse sections" and hide cells groups by enabling "Show open/close icon for cell groups" in the "Edit" > "Preferences" > "Interface" menu.
$endgroup$
– Somos
5 hours ago




$begingroup$
If you are using the Notebook Front End GUI you can insert a new cell, perhaps "Section" and give it a descprition. Place the code suggested by the goldberg answer in the next cell. Finally insert another new "Section" with a description and place the code that calls the previous code in the next cell. You can "collapse sections" and hide cells groups by enabling "Show open/close icon for cell groups" in the "Edit" > "Preferences" > "Interface" menu.
$endgroup$
– Somos
5 hours ago










1 Answer
1






active

oldest

votes


















2












$begingroup$

Perhaps this will work for you.



Make the part of code you want to ignore into a command with SetDelayed ( := ), like so;



resuts := (
p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m0;
m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
denom = Max[Denominator[mm]];
bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
Column[
StringForm["The slope is: `1`", First[m]],
StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]],
StringForm["Slope Intercept form: y=`1`x`3``2`",
First[m], Abs[First[bb[[All, 1, 2]]]],
If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]],
StringForm["Standard Form: `1`x`4``3`y=`2`",
If[Max[m] < 0, -denom*First[m], denom*First[m]],
If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"]],
StringForm["General Form: `1`x`4``3`y`5``2`=0",
If[Max[m] < 0, -denom*First[m], denom*First[m]],
-If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
If[Max[m] > 0, -denom, denom],
If[Max[m] > 0, "", "+"],
If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]],
StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
Abs[Max[Drop[p1, 1]]],
Max[m],
Abs[Max[Take[p1, 1]]],
If[Max[Drop[p1, 1]] >= 0, "-", "+"],
If[Max[Take[p1, 1]] >= 0, "-", "+"]]])


You won't be able to hide the code, but you can ignore it pretty easily and run cases like this:



p1 = -5, 4;
m0 = 9/8;
resuts


out_1



p1 = -5, 5;
m0 = 7/8;
resuts


out_2



Notes



  1. You could put the results code in one notebook and the do computations in a 2nd notebook. It is even possible for the 2nd notebook to load the 1st notebook automatically when it is opened.


  2. This isn't best Mathematica practice, but there is nothing really wrong with it. It is pretty much a minimal revision of you current code. It should satisfy your needs.


  3. Modifying your code to bring it up to best practice levels would require a much greater effort and, unless you are going to use the code in an industrial level application, I don't think it worth your effort to carry out that level of revision. Later on, when you have more Mathematica experience best, or at least better, practice methods will become second nature.






share|improve this answer











$endgroup$












    Your Answer





    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193884%2fcell-formatting-and-hiding-code%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2












    $begingroup$

    Perhaps this will work for you.



    Make the part of code you want to ignore into a command with SetDelayed ( := ), like so;



    resuts := (
    p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m0;
    m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
    denom = Max[Denominator[mm]];
    bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
    Column[
    StringForm["The slope is: `1`", First[m]],
    StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]],
    StringForm["Slope Intercept form: y=`1`x`3``2`",
    First[m], Abs[First[bb[[All, 1, 2]]]],
    If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]],
    StringForm["Standard Form: `1`x`4``3`y=`2`",
    If[Max[m] < 0, -denom*First[m], denom*First[m]],
    If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
    If[Max[m] > 0, -denom, denom],
    If[Max[m] > 0, "", "+"]],
    StringForm["General Form: `1`x`4``3`y`5``2`=0",
    If[Max[m] < 0, -denom*First[m], denom*First[m]],
    -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
    If[Max[m] > 0, -denom, denom],
    If[Max[m] > 0, "", "+"],
    If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]],
    StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
    Abs[Max[Drop[p1, 1]]],
    Max[m],
    Abs[Max[Take[p1, 1]]],
    If[Max[Drop[p1, 1]] >= 0, "-", "+"],
    If[Max[Take[p1, 1]] >= 0, "-", "+"]]])


    You won't be able to hide the code, but you can ignore it pretty easily and run cases like this:



    p1 = -5, 4;
    m0 = 9/8;
    resuts


    out_1



    p1 = -5, 5;
    m0 = 7/8;
    resuts


    out_2



    Notes



    1. You could put the results code in one notebook and the do computations in a 2nd notebook. It is even possible for the 2nd notebook to load the 1st notebook automatically when it is opened.


    2. This isn't best Mathematica practice, but there is nothing really wrong with it. It is pretty much a minimal revision of you current code. It should satisfy your needs.


    3. Modifying your code to bring it up to best practice levels would require a much greater effort and, unless you are going to use the code in an industrial level application, I don't think it worth your effort to carry out that level of revision. Later on, when you have more Mathematica experience best, or at least better, practice methods will become second nature.






    share|improve this answer











    $endgroup$

















      2












      $begingroup$

      Perhaps this will work for you.



      Make the part of code you want to ignore into a command with SetDelayed ( := ), like so;



      resuts := (
      p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m0;
      m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
      denom = Max[Denominator[mm]];
      bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
      Column[
      StringForm["The slope is: `1`", First[m]],
      StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]],
      StringForm["Slope Intercept form: y=`1`x`3``2`",
      First[m], Abs[First[bb[[All, 1, 2]]]],
      If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]],
      StringForm["Standard Form: `1`x`4``3`y=`2`",
      If[Max[m] < 0, -denom*First[m], denom*First[m]],
      If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
      If[Max[m] > 0, -denom, denom],
      If[Max[m] > 0, "", "+"]],
      StringForm["General Form: `1`x`4``3`y`5``2`=0",
      If[Max[m] < 0, -denom*First[m], denom*First[m]],
      -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
      If[Max[m] > 0, -denom, denom],
      If[Max[m] > 0, "", "+"],
      If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]],
      StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
      Abs[Max[Drop[p1, 1]]],
      Max[m],
      Abs[Max[Take[p1, 1]]],
      If[Max[Drop[p1, 1]] >= 0, "-", "+"],
      If[Max[Take[p1, 1]] >= 0, "-", "+"]]])


      You won't be able to hide the code, but you can ignore it pretty easily and run cases like this:



      p1 = -5, 4;
      m0 = 9/8;
      resuts


      out_1



      p1 = -5, 5;
      m0 = 7/8;
      resuts


      out_2



      Notes



      1. You could put the results code in one notebook and the do computations in a 2nd notebook. It is even possible for the 2nd notebook to load the 1st notebook automatically when it is opened.


      2. This isn't best Mathematica practice, but there is nothing really wrong with it. It is pretty much a minimal revision of you current code. It should satisfy your needs.


      3. Modifying your code to bring it up to best practice levels would require a much greater effort and, unless you are going to use the code in an industrial level application, I don't think it worth your effort to carry out that level of revision. Later on, when you have more Mathematica experience best, or at least better, practice methods will become second nature.






      share|improve this answer











      $endgroup$















        2












        2








        2





        $begingroup$

        Perhaps this will work for you.



        Make the part of code you want to ignore into a command with SetDelayed ( := ), like so;



        resuts := (
        p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m0;
        m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
        denom = Max[Denominator[mm]];
        bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
        Column[
        StringForm["The slope is: `1`", First[m]],
        StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]],
        StringForm["Slope Intercept form: y=`1`x`3``2`",
        First[m], Abs[First[bb[[All, 1, 2]]]],
        If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]],
        StringForm["Standard Form: `1`x`4``3`y=`2`",
        If[Max[m] < 0, -denom*First[m], denom*First[m]],
        If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
        If[Max[m] > 0, -denom, denom],
        If[Max[m] > 0, "", "+"]],
        StringForm["General Form: `1`x`4``3`y`5``2`=0",
        If[Max[m] < 0, -denom*First[m], denom*First[m]],
        -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
        If[Max[m] > 0, -denom, denom],
        If[Max[m] > 0, "", "+"],
        If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]],
        StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
        Abs[Max[Drop[p1, 1]]],
        Max[m],
        Abs[Max[Take[p1, 1]]],
        If[Max[Drop[p1, 1]] >= 0, "-", "+"],
        If[Max[Take[p1, 1]] >= 0, "-", "+"]]])


        You won't be able to hide the code, but you can ignore it pretty easily and run cases like this:



        p1 = -5, 4;
        m0 = 9/8;
        resuts


        out_1



        p1 = -5, 5;
        m0 = 7/8;
        resuts


        out_2



        Notes



        1. You could put the results code in one notebook and the do computations in a 2nd notebook. It is even possible for the 2nd notebook to load the 1st notebook automatically when it is opened.


        2. This isn't best Mathematica practice, but there is nothing really wrong with it. It is pretty much a minimal revision of you current code. It should satisfy your needs.


        3. Modifying your code to bring it up to best practice levels would require a much greater effort and, unless you are going to use the code in an industrial level application, I don't think it worth your effort to carry out that level of revision. Later on, when you have more Mathematica experience best, or at least better, practice methods will become second nature.






        share|improve this answer











        $endgroup$



        Perhaps this will work for you.



        Make the part of code you want to ignore into a command with SetDelayed ( := ), like so;



        resuts := (
        p2 = First[Take[p1, 1]] + 1, First[Drop[p1, 1]] + m0;
        m = (Drop[p1, 1] - Drop[p2, 1])/(Take[p1, 1] - Take[p2, 1]);
        denom = Max[Denominator[mm]];
        bb = Solve[Drop[p1, 1] == m*Take[p1, 1] + b];
        Column[
        StringForm["The slope is: `1`", First[m]],
        StringForm["The y intercept is `1`", First[bb[[All, 1, 2]]]],
        StringForm["Slope Intercept form: y=`1`x`3``2`",
        First[m], Abs[First[bb[[All, 1, 2]]]],
        If[First[bb[[All, 1, 2]]] >= 0, "+", "-"]],
        StringForm["Standard Form: `1`x`4``3`y=`2`",
        If[Max[m] < 0, -denom*First[m], denom*First[m]],
        If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
        If[Max[m] > 0, -denom, denom],
        If[Max[m] > 0, "", "+"]],
        StringForm["General Form: `1`x`4``3`y`5``2`=0",
        If[Max[m] < 0, -denom*First[m], denom*First[m]],
        -If[Max[m] > 0, -denom*First[bb[[All, 1, 2]]], denom*First[bb[[All, 1, 2]]]],
        If[Max[m] > 0, -denom, denom],
        If[Max[m] > 0, "", "+"],
        If[If[Max[m] < 0, -denom*First[m], denom*First[m]] > 0, "+", ""]],
        StringForm["Point Slope Form: y`4``1`=`2`(x`5``3`)",
        Abs[Max[Drop[p1, 1]]],
        Max[m],
        Abs[Max[Take[p1, 1]]],
        If[Max[Drop[p1, 1]] >= 0, "-", "+"],
        If[Max[Take[p1, 1]] >= 0, "-", "+"]]])


        You won't be able to hide the code, but you can ignore it pretty easily and run cases like this:



        p1 = -5, 4;
        m0 = 9/8;
        resuts


        out_1



        p1 = -5, 5;
        m0 = 7/8;
        resuts


        out_2



        Notes



        1. You could put the results code in one notebook and the do computations in a 2nd notebook. It is even possible for the 2nd notebook to load the 1st notebook automatically when it is opened.


        2. This isn't best Mathematica practice, but there is nothing really wrong with it. It is pretty much a minimal revision of you current code. It should satisfy your needs.


        3. Modifying your code to bring it up to best practice levels would require a much greater effort and, unless you are going to use the code in an industrial level application, I don't think it worth your effort to carry out that level of revision. Later on, when you have more Mathematica experience best, or at least better, practice methods will become second nature.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 4 hours ago

























        answered 5 hours ago









        m_goldbergm_goldberg

        87.7k872198




        87.7k872198



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193884%2fcell-formatting-and-hiding-code%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to create a command for the “strange m” symbol in latex? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How do you make your own symbol when Detexify fails?Writing bold small caps with mathpazo packageplus-minus symbol with parenthesis around the minus signGreek character in Beamer document titleHow to create dashed right arrow over symbol?Currency symbol: Turkish LiraDouble prec as a single symbol?Plus Sign Too Big; How to Call adfbullet?Is there a TeX macro for three-legged pi?How do I get my integral-like symbol to align like the integral?How to selectively substitute a letter with another symbol representing the same letterHow do I generate a less than symbol and vertical bar that are the same height?

            Българска екзархия Съдържание История | Български екзарси | Вижте също | Външни препратки | Литература | Бележки | НавигацияУстав за управлението на българската екзархия. Цариград, 1870Слово на Ловешкия митрополит Иларион при откриването на Българския народен събор в Цариград на 23. II. 1870 г.Българската правда и гръцката кривда. От С. М. (= Софийски Мелетий). Цариград, 1872Предстоятели на Българската екзархияПодмененият ВеликденИнформационна агенция „Фокус“Димитър Ризов. Българите в техните исторически, етнографически и политически граници (Атлас съдържащ 40 карти). Berlin, Königliche Hoflithographie, Hof-Buch- und -Steindruckerei Wilhelm Greve, 1917Report of the International Commission to Inquire into the Causes and Conduct of the Balkan Wars

            Category:Tremithousa Media in category "Tremithousa"Navigation menuUpload media34° 49′ 02.7″ N, 32° 26′ 37.32″ EOpenStreetMapGoogle EarthProximityramaReasonatorScholiaStatisticsWikiShootMe