Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A chebfun3 function failed to pass the vectorCheck() of chebfun2 #2436

Closed
George-Gate opened this issue Apr 6, 2023 · 3 comments
Closed
Assignees

Comments

@George-Gate
Copy link

George-Gate commented Apr 6, 2023

The following code will generate a warning saying that

Function did not correctly evaluate on an array.
Turning on the 'vectorize' flag. Did you intend this?
Use the 'vectorize' flag in the CHEBFUN2 constructor
call to avoid this warning message.

B_A_chebfun3 = chebfun3(@(x,y,z)exp(-(x+y.*y+1.5*(z+1))), [-0.4, 0.4,  -0.3,0.3,  -0.35,0.35]);
B_A_chebfun2 = chebfun2(@(x,z)B_A_chebfun3(x,0*x,z), [-0.4, 0.4,  -0.35,0.35]);

The problem is that the result of B_A_chebfun3(x,0*x,y) is transposed as shown in the following code

xx2 = [-0.4,0.4;-0.4,0.4]
yy2 = [-0.35,-0.35;0.35,0.35]
B_A_chebfun3(xx2,0*xx2,yy2)
arrayfun(@(xx,yy)B_A_chebfun3(xx,0*xx,yy), xx2, yy2)

I think this is a bug.

@trefethen
Copy link
Contributor

Interesting! Here's a simpler version of the same problem:

f = chebfun3(@(x,y,z) x);
g = chebfun2(@(x,y) f(x,0*x,y));

If 0 is changed to 1, it works fine. @bhashemi, would you be able to sort this out?

@bhashemi bhashemi self-assigned this Sep 14, 2023
bhashemi added a commit that referenced this issue Sep 14, 2023
@bhashemi
Copy link
Contributor

I intended to create a pull request to resolve this issue, but I pushed my changes, by mistake, directly to the master branch! This is embarrassing. Can someone please check that I've not caused a serious problem here? Thanks in advance.

@bhashemi
Copy link
Contributor

This issue is fixed in the latest changes to the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants