Page 1 of 1
Errors with WITH LOOK UP function
Posted: Sun Feb 05, 2023 3:11 pm
by ngtrang
Could you tell me if there is any error related to missed parens in the following equation? I tried but could not fix it.
Thank you.
Cost of waste recycling = Transportation cost+WITH LOOKUP(maturation of waste recycling market, ((0.15,40),(0.2,35),(0.3,30),(0.4,27),(0.5,23),(0.6,18),(0.7,16),(0.8,14)))
The Vensim notified about an error with Lookup function: look for missing parens
Re: Errors with WITH LOOK UP function
Posted: Sun Feb 05, 2023 5:31 pm
by tomfid
I think the error message may be misleading. WITH LOOKUP has to be the first & only thing on the right side of the equation - that's probably the issue here.
Re: Errors with WITH LOOK UP function
Posted: Mon Feb 06, 2023 7:10 am
by ngtrang
tomfid wrote: ↑Sun Feb 05, 2023 5:31 pm
I think the error message may be misleading. WITH LOOKUP has to be the first & only thing on the right side of the equation - that's probably the issue here.
Thank you so much, I understood the issue here.
What other function can I use in case I want to calculate the total cost as equal to transportation cost plus recycling cost (for example) which in turn depends on the maturation of the market? I mean a combined functions like the inital idea.
Re: Errors with WITH LOOK UP function
Posted: Mon Feb 06, 2023 8:30 am
by Administrator
ngtrang wrote: ↑Mon Feb 06, 2023 7:10 amWhat other function can I use in case I want to calculate the total cost as equal to transportation cost plus recycling cost (for example) which in turn depends on the maturation of the market? I mean a combined functions like the inital idea.
It's probably best if you start a new topic and provide more details.
Re: Errors with WITH LOOK UP function
Posted: Mon Feb 06, 2023 3:07 pm
by tomfid
Just create a separate variable.
z = x + y
y = WITH LOOKUP(...)
Re: Errors with WITH LOOK UP function
Posted: Mon Feb 06, 2023 3:08 pm
by tomfid
Or use an ordinary lookup variable instead of WITH LOOKUP:
z = x + y( input )
y = (0,1),(1,2),(3,4), ...
Re: Errors with WITH LOOK UP function
Posted: Thu Feb 09, 2023 12:38 am
by ngtrang
tomfid wrote: ↑Mon Feb 06, 2023 3:08 pm
Or use an ordinary lookup variable instead of WITH LOOKUP:
z = x + y( input )
y = (0,1),(1,2),(3,4), ...
Thank you

Re: Errors with WITH LOOK UP function
Posted: Thu Feb 09, 2023 12:44 am
by ngtrang
tomfid wrote: ↑Mon Feb 06, 2023 3:07 pm
Just create a separate variable.
z = x + y
y = WITH LOOKUP(...)
Thank you. I am trying to re-establish the model found from a published paper to understand the methodology. The authors explained a formula in which x = a + WITH LOOKUP (y). Then I tried doing similar things but now I know WITH LOOKUP can not be used in such a combination like this.
Re: Errors with WITH LOOK UP function
Posted: Thu Feb 09, 2023 12:52 pm
by Administrator
I always discourage the use of WITH LOOKUP, I'm not sure why anyone uses it. It much better to define the lookup as a separate variable.
Re: Errors with WITH LOOK UP function
Posted: Thu Feb 09, 2023 9:35 pm
by tomfid
I don't discourage it, but I tend to use regular lookups in my own work. WITH LOOKUP is fine if you'll only use the curve shape once.
I'm puzzled that the authors describe x = a + WITH LOOKUP (y) - that hasn't ever worked, and the function is more or less unique to Vensim. Perhaps it was simply a shorthand.
Re: Errors with WITH LOOK UP function
Posted: Wed Jun 26, 2024 10:32 am
by domenicacox36
Hi, i am also have issues with creating LOOKUP functions in Venism PLE. I am trying to create a look up function for the impact of a policy throughout time (2024-2050) so that i can use it to show that the policy will have a non-linear impact on other variables in my model depending on the year. However, when I create an auxillary variable and use the =WITHLOOKUP (ImpactLSP([(2024, 0)-(2050, 1)],(2024, 0.3),(2025,0.35),(2026,0.4)
(2027, 0.2), (2028,0.19),(2029, 0.1)). I am getting the error "expecting an operator". Do you know why this might be. Any help would be really appreciated.