- Thank you received: 0
CoefficientFunction with spacial condition
4 years 7 months ago #2531
by NilsHM
CoefficientFunction with spacial condition was created by NilsHM
Hello everyone,
I would like to set a CoefficientFunction that is different on the y-axis than anywhere else.
I hoped to do this as follows:
but cf now is zero everwhere.
How can I make cf be cf1 but cf2 on the y-axis?
Best
Nils
I would like to set a CoefficientFunction that is different on the y-axis than anywhere else.
I hoped to do this as follows:
Code:
cf1 = 2*x
cf2 = CoefficientFunction(1)
cf = CoefficientFunction([cf2 if X == 0.0 else cf1 for X in x])
How can I make cf be cf1 but cf2 on the y-axis?
Best
Nils
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
4 years 7 months ago #2532
by mneunteufel
Replied by mneunteufel on topic CoefficientFunction with spacial condition
Hi Nils,
I think the IfPos-CoefficientFunction is what you are looking for.
Maybe you need to "regularize" it a bit
Best
Michael
I think the IfPos-CoefficientFunction is what you are looking for.
Code:
IfPos(x,0,IfPos(-x,0,1))
Maybe you need to "regularize" it a bit
Code:
eps = 1e-8
IfPos(x-eps,0,IfPos(-x-eps,0,1))
Best
Michael
The following user(s) said Thank You: NilsHM
Time to create page: 0.111 seconds