Linked Questions

3 votes
1 answer
309 views

Using a Global symbol inside a package [duplicate]

Part I - Without package I have created a function to compute a bridge score. ...
Jack LaVigne's user avatar
  • 14.5k
1 vote
1 answer
100 views

Differentiation inside package [duplicate]

I am trying to put all my functions in a single package and some of them do not work because of differentiation. Suppose I have the following package ...
Yuri's user avatar
  • 264
0 votes
0 answers
289 views

Why the package (.wl) and .nb behaves completely different [duplicate]

I am developing an application in one part I am checking the if the functions are constant or not. I am using a couple of lines of code (it is possible that there is another way of doing it) but the ...
Erdem's user avatar
  • 879
1 vote
1 answer
83 views

Context issues when using NDSolve and rule substitutions in a package [duplicate]

I have a .wl package and a demo .nb notebook. The package file is testPackage.wl and it ...
wil3's user avatar
  • 253
3 votes
0 answers
111 views

How to resolve a context shadow problem (revised) [duplicate]

I have developed a notebook of 30+ functions for Geometric Algebra, all of which involved using the symbol e with subscripts like Subscript[e,1]. I write them here as e1, e2, e3 ... for readability. ...
matrixbud's user avatar
  • 435
0 votes
0 answers
107 views

function from .wl produces no output [duplicate]

I'm trying to learn to reuse functions. I have created a .wl file with the following content. As I understand the last line without semicolon is the function output. Should each function have it's ...
LetzerWille's user avatar
1 vote
0 answers
59 views

Why is my MMA package unable to evaluate some user-defined functions? [duplicate]

I am trying to create a package for other Mathematica programmers to use, but in doing so, I came across an interesting MMA problem which I cannot seem to figure out. The following code in .nb file ...
Wilson's user avatar
  • 349
0 votes
0 answers
55 views

Is it possible to create complicated packages from modules which work fine by copy paste? -- A counterexample [duplicate]

Here is a module which constructs essentially several functions in a chain [Phi], sct, ks, WE, G: ...
florin's user avatar
  • 1,798
0 votes
0 answers
18 views

Function working in command line session but not in package [duplicate]

I have this pretty straight-forward function GetMinimum[function_, xmin_] := First[FindMinimum[{function, x>xmin}, x]] that works perfectly within a ...
user3075898's user avatar
42 votes
7 answers
2k views

How symbol lookup actually works

Bug introduced in V6 and fixed in V11.3 The behavior indeed changed but now the documentation is clear about it. This code is inconsistent with the description from Power Programming with ...
user12753's user avatar
  • 423
5 votes
1 answer
353 views

Import expression for function definition inside a Module of a Package

I've been struggling on this problem for quite a while, but I still don't understand why Mathematica is unable to recognize a function definition where the rhs is an ...
Giovanni Bordiga's user avatar
5 votes
1 answer
124 views

Where should global variables be defined in a package?

I am trying to understand two of the answers to the question 114769 Package functions and symbolic calculations ...
florin's user avatar
  • 1,798
8 votes
1 answer
165 views

Function defined in a package behaves differently from when defined in a notebook

On a Windows system I'm using the Rubi rule-based integration package by Albert Rich which defines function "Int" in addition to Mathematica's Integrate. In my ..\ProgramData\kernel\init.m I have: <...
Roland Salz's user avatar
3 votes
1 answer
117 views

Behavior of Remove inside a Package

I have a notebook containing (in a Code cell, Initialization Group) ...
mitochondrial's user avatar
2 votes
1 answer
105 views

Why is pattern matching different inside package

This works fine when put in a notebook: TestFunction2[x_] := Column[{Head /@ x, Cases[x, _f], MatchQ[_f] /@ x}]; TestFunction2[{f[1, 2]}] and produces: ...
skromnibog's user avatar
2 votes
1 answer
131 views

Returning a list of replacement rules from a package function

I am having a go at writing my first package and would like to do something similar to the following. Its a basically a very thin wrapper around NonlinearModelFit. ...
lac's user avatar
  • 151
1 vote
0 answers
131 views

Transferring a function between two modules in a package

I have a first module which outputs as forth output a function G I want to transfer to another module. The specific function is ...
florin's user avatar
  • 1,798
2 votes
1 answer
93 views

Converting strings to expressions in a package

I have a function that generates an equation in the form of a String. I want to be able to turn that string into an Expression, and evaluate it in another function. For example: ...
Ken Thomson's user avatar
3 votes
1 answer
90 views

ReplaceAll Wierdness

I've come across some weirdness in ReplaceAll. Replacement works fine outside of a module, but inside the module some replacements don't occur where one might expect them to. ...
SkyCat's user avatar
  • 91
0 votes
2 answers
38 views

Dropping \$NUMBER from local var$number when passing results from a Module [duplicate]

I'm sure this has been asked, but I can't seem to find the correct terms to find it. I have a function that looks something like this ...
mikemtnbikes's user avatar
1 vote
0 answers
39 views

Why a script stops working when moved from the beginning of a file into a package?

Here's a two command script defining L1, Der1 (which compute the first Lyapunov exponent of an ODE): ...
florin's user avatar
  • 1,798