Group Abstract Group Abstract

Message Boards Message Boards

Integer inside [] is unexpectedly changed to a machine-precision real number

Posted 1 year ago
POSTED BY: Aki Hiro
6 Replies
Posted 1 year ago

Sorry, I suddenly got busy and my reply was delayed.

I had never thought of a way to create temporary variables using Unique, but it seems like a good way. Although I'm not familiar with handling Context, I found that side effects can be cancelled by doing something like Remove["`MyPrivate`*"].

An advantage of my function notation is that zero or negative number "subscripts" are available, and this is the same with your proposed Subscript description.Additionally, it feels more natural and reasonable to use Subscript than function notation. It somehow doesn't be affected by N[]...

My question have been resolved, thank you!

POSTED BY: Aki Hiro
Posted 1 year ago
POSTED BY: Eric Rimbey
Posted 1 year ago

I have made a slight modification to your code to make it work, but I still get the error output.

solveEquations3[a_, varCount_] := Module[
  {x, vars}
  ,
  vars = Table[x[i], {i, 0, varCount}];
  Values[
   FindRoot[
    Catenate[{{vars[[1]] == 1}, 
      Table[vars[[i]] == Gamma[a, vars[[i - 1]]], {i, 2, 
        varCount + 1}]}], Thread[{vars, 1}]]]]

solveEquations3[1., 3]

What problems do you see with Gianluca's solution?

POSTED BY: Aki Hiro
Posted 1 year ago
POSTED BY: Updating Name

Try SetAttributes[x, NHoldFirst].

POSTED BY: Gianluca Gorni
Posted 1 year ago

Simple solution, Thank you!

POSTED BY: Aki Hiro
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard