Group Abstract Group Abstract

Message Boards Message Boards

Avoid errors while using RecurrenceTables?

Posted 7 years ago

Hello - I started having errors in notebooks making use of RecurrenceTables. I am running Mathmatica Version - "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)",

I have several notebooks making use of RecurrenceTable. These have been working for many months. All of a sudden they stopped working maybe after an update?

I have replicated the error by copy/pasting a RecurrenceTable example from the online help into a new and empty Notebook

The example is

RecurrenceTable[{a[n + 1] == 3 a[n], a[1] == 7}, a, {n, 1, 10}]

The error is - RecurrenceTable::dsvar: 1 cannot be used as a variable.

This is happening for all notebooks new and old that use RecurrenceTables

Any ideas what is going on?

thank you Al

POSTED BY: Albert Cattani
8 Replies

Dear Albert,

try

ClearAll["Global`*"]

That clears the global context. The documentation shows how to clear private contexts.

instead.

POSTED BY: Marco Thiel
Posted 7 years ago
POSTED BY: Albert Cattani
POSTED BY: Marco Thiel
Posted 7 years ago
POSTED BY: Albert Cattani

Killing the Kernel is overkill. It is enough to Clear the variables you are using inside RecurrenceTable, which does not protect its variables:

n = 1;
RecurrenceTable[{a[n + 1] == 3 a[n], a[1] == 7}, a, {n, 1, 10}]
Clear[a, n];
RecurrenceTable[{a[n + 1] == 3 a[n], a[1] == 7}, a, {n, 1, 10}]
POSTED BY: Gianluca Gorni
Posted 7 years ago

thanks .... great minds think alike. I should have thought of killing the kernel sooner

POSTED BY: Albert Cattani

Works fine on my machine:

enter image description here

Have you tried restarting the kernel?

Best wishes,

Marco

PS: Sorry. Your second message came only up after I posted my reply.

POSTED BY: Marco Thiel
Posted 7 years ago

I resolved the issue but I cannot say I understand what happened. Bottom line I had to close all workbooks and then kill the running instance of Mathmatica. Just closing all notebooks did not work.

I will chalk this one up to "who the heck knows why just be happy it's working again"

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