Linked Questions

1 vote
3 answers
933 views

Assign a function within a function [duplicate]

What I'm doing wrong? 1st function works as expected but the 2nd one doesn't. What I want is to enter an algebraic expression and two numeric constants and get the same result as with the first ...
Sanmuten's user avatar
4 votes
1 answer
71 views

problem using package to verify solution of ode with Association, Naming scope/context handling [duplicate]

I learning how to use packages. I found a big problem. Here is description of the problem is, then a MWE is given. This small package takes in an ode and ...
Nasser's user avatar
  • 143k
3 votes
1 answer
148 views

How to inject segments of code into functions defined by SetDelayed [duplicate]

I need to define a set of functions that are written in terms of common but lengthy expressions. To effect this, I want to inject abbreviations for such expressions into the RHS of ...
QuantumDot's user avatar
  • 19.6k
2 votes
1 answer
309 views

How to define a function inside a module through Evaluate [duplicate]

I am trying to define a function inside a module as following ...
NonalcoholicBeer's user avatar
0 votes
1 answer
177 views

Function generating a rule with a Patterns: e.g. toRule[ lhs, rhs] into lhs[x_] -> rhs [duplicate]

I want to create a rule as a function of z from a left and right hand side. My (non-working) code and usage is: ...
jlperla's user avatar
  • 967
1 vote
0 answers
102 views

Why does With return a temporary symbol? [duplicate]

Why does With[{x0 = 1, y0 = 2}, f[x_] = a + b x /. First[ Solve[{y0 == a + b x0, b == 0.1}, {a, b}]]] evaluate to ...
user42582's user avatar
  • 4,195
1 vote
0 answers
90 views

Odd problem with `Module` and `Block` [duplicate]

I found some bizarre phenomena in my code. While I'm using Module in my function, the result is incompatible with which I did outside ...
Turgon's user avatar
  • 1,050
1 vote
0 answers
76 views

How to use Evaluate inside function definitions? [duplicate]

How to use Evaluate inside function definition so that is acts as Evaluate only whet function is called? This is toy exampl, where I want to define function inside another function: ...
Artem Vorozhtsov's user avatar
2 votes
0 answers
72 views

Immediate Function Definition inside a Module [duplicate]

In mathematica, it is possible to perform immediate definition of a function where the dependent variable is not explicitly mentioned on the RHS. For example: ...
zed111's user avatar
  • 203
2 votes
0 answers
42 views

Does passing patterns between packages alter their name unbeknownst to the user? [duplicate]

This question is a partial followup to my previous question. Mainly, after using With to inject the proper argument in the function at the rhs of ...
yosimitsu kodanuri's user avatar
0 votes
0 answers
39 views

Patterns in module [duplicate]

I have this weird behavior of patterns inside the Module construct. Note that we have In: Module[{}, a_->x] Out: a_ -> x ...
Peter Kravchuk's user avatar
0 votes
0 answers
29 views

Set keeps RHS unevaluated when RHS is a Module variable [duplicate]

Consider the simple code ...
lineage's user avatar
  • 1,144
602 votes
19 answers
156k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
23 votes
3 answers
989 views

Nested definition: How can I define a function with a passed-in expression?

Here's a simplified version of what I'm trying to do: ...
celtschk's user avatar
  • 19.1k
23 votes
3 answers
2k views

How to find the name of the current function?

I would like to know the name of the current function from within that function. For example, consider the following code ...
Ian Hinder's user avatar
  • 2,125

15 30 50 per page
1
2 3 4 5 6