Hi Jon, I want to follow up on this discussion regarding operator variable.
I found that if b and c are cellvariables, the command a = b*c will make a an operator variable. If I use a = (b * c).copy(), a becomes a cellvariable. Would this be a good command to use to assign b*c values to cellvariable a? A general question is why we need the operator variables, if all we care is numpy array operations and value assignment? Thanks, Rose On Mon, Jan 27, 2014 at 2:50 PM, Guyer, Jonathan E. Dr. < [email protected]> wrote: > Thanks for the information. I suspect that the problem is not that b*c is > an operator variable (it is), but rather that a is an operator variable and > you are attempting to set its value, which is not permitted. The value of > an operator variable is determined by the operation and the values of the > variables that compose the operation. > > What is it that you would like to do? Establish a functional relationship? > Set an initial condition? Is `a` a variable you are solving for or a > coefficient that you are setting? > > On Jan 27, 2014, at 1:10 PM, yuan wang <[email protected]> wrote: > > > Jonathan, > > > > I think I got the error because I was trying to do a.value = b*c, where > b and c are CellVariables. b * c become an operator variable, which cannot > be assigned to the LHS (numpy arrary). > > a = b*c should work if all of them are CellVariables. > > > > Sorry for the confusion and thank you for your help. > > > > Best regards, > > Rose > > > > > > On Mon, Jan 27, 2014 at 10:39 AM, Guyer, Jonathan E. Dr. < > [email protected]> wrote: > > > > On Jan 24, 2014, at 5:11 PM, yuan wang <[email protected]> wrote: > > > > > All the operations made on CellVariables will be stored as > binaryOperatorVariables. The operation is not actually conducted, until the > result is requested by numpy.array() or .value operation. It's like the > operations are just doing book keeping of the account, but the > numpy.array() method encash the final values. Even though, the operators > will work the same on CellVariables as on numpy arrays. > > > > As Daniel said, this is an accurate understanding. > > > > > > > I wrote something like a = b*c, but it does not work. An error pop up > saying, "TypeError: The value of an `_OperatorVariable` cannot be assigned" > > > > Can you tell us exactly what you did to generate this error? It is not > possible to have gotten this error from writing "a = b*c", no matter what > a, b, or c are. Python syntax just doesn't work that way. > > > > I believe you got the error, and if you tell us exactly what code you > wrote and what you are trying to accomplish, it will help us direct you to > the right expression. > > > > > > _______________________________________________ > > fipy mailing list > > [email protected] > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > > > > > > -- > > Yuan (Rose) Wang > > PhD Candidate, Tufts University > > Cellphone: 617-699-8006 > > _______________________________________________ > > fipy mailing list > > [email protected] > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > -- Yuan (Rose) Wang PhD Candidate, Tufts University Cellphone: 617-699-8006
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
