Message Boards Message Boards

0
|
3024 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Remove $number in the output of NonlinearModelfit

Posted 3 years ago

Can someone explain to me how to remove the $number values following the variable x in the answer to the NonLinearModelfit.

y(Stem} =  (3.92523*10^-17+0.1225 x$84312+0.0204167 x$84312^2)
POSTED BY: Geoff Landis
3 Replies
Posted 3 years ago

Geoff:

I found myself debugging this issue myself today. The issue turned out to be a misplaced semi-colon.

In my Module[], I was returning an association. It looked something like:

Module[
  { 
   private = 0
   },
  (* some interesting code that could change the world some day *)

  <| 
   "a" -> 1, 
   "b" -> 2,
   "c" -> private;
   |>

  ];

So, the lesson from here is to make sure you don't have semi-colons in the wrong place.

I hope that helps.

POSTED BY: Mike Besso
Posted 3 years ago

Geoff:

Rohit is of course correct. Though I can add is that this happens to me when I fail to assign a value to the module level variable. Remember, Wolfram does symbolic math. If you fail to assign a value to a variable, you get the symbol returned in your results.

I have also run into situations that the solution required me to switch to a Block instead of a Module. I am just starting to grasp the differences between Modules and Blocks. But, I do still get confused at times.

Have a great and safe weekend.

Have a great weekend.

POSTED BY: Mike Besso
Posted 3 years ago

Hi Geoff,

The code to reproduce is not provided. So, one possibility is that Module scoped symbols are being exposed. e.g.

Module[{x}, x]
(* x$2606189 *)

Depending on the specifics of your code, you might want to change the code to avoid that, or use Block instead. Hard to advise without more details.

POSTED BY: Rohit Namjoshi
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