Timeline for How to avoid repeatedly recalculating a function that is used multiple times in another function
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 27, 2017 at 16:07 | answer | added | user42582 | timeline score: 5 | |
Oct 27, 2017 at 14:56 | answer | added | m_goldberg | timeline score: 5 | |
Oct 26, 2017 at 5:36 | comment | added | LLlAMnYP |
I usually do With[{value = g[x]}, (*some expression with value *)] but I'm not sure how well this may work in NIntegrate
|
|
Oct 26, 2017 at 5:14 | history | edited | p.s | CC BY-SA 3.0 |
added 108 characters in body
|
Oct 26, 2017 at 5:09 | history | edited | p.s | CC BY-SA 3.0 |
added 108 characters in body
|
Oct 26, 2017 at 4:53 | comment | added | Nasser |
Yes, Mathematica calls g[x] twice, since you called it twice. Why not use = instead of := and this way, it will integrate once? But it is better to make a complete working small example, showing the actually integration you are doing. This way, one does not have to guess.
|
|
Oct 26, 2017 at 4:49 | history | edited | p.s | CC BY-SA 3.0 |
added 2 characters in body
|
Oct 26, 2017 at 4:40 | history | asked | p.s | CC BY-SA 3.0 |