## plotting – Different results from polar and cartesian forms of a function?

I am trying to write up and study the given function: by the following Mathematica input (with N=5 and not infinity)

``````u(r_, phi_) :=
Piecewise({{An*BesselJ(1.5 r, 5)*Exp(I 5 phi),
0 < r < 1/2}, {(Bn*BesselJ(3 r, 5) + Cn*BesselY(3 r, 5))*
Exp(I 5 phi), 1/2 < r < 1}, {Dn*HankelH1(r, 5)*Exp(I 5 phi),
r > 1}})
``````

But something is not correct here. If I convert it to Cartesian form by:

``````TransformedField("Polar" -> "Cartesian",
u(r, phi), {r, phi} -> {x, y})
``````

I obtain the following: The I make the plots. Here is were the problem is identified. One of the two forms above, Cartesian or radial are wrong.

The first plot is the radial plot. When I plot u in Polar form I get this image (within the interval -1,1 , -1,1): However, when I plot the Transformed form on the same interval, I get a completely different plot: Clearly they are not the same, and they should.

What is wrong here?

Thanks

Posted on Categories Articles

## reference request – Dimension of cartesian products

Is there a notion of dimension such that for all Borel sets $$A,Bsubseteqmathbb{R}^{n}$$ we have
$$dim(Atimes B)=dim(A)+dim(B)?$$ For topological, Minkowsky, packing and Hausdorff dimension this is not true. If the answer is no (which I suppose) I like to understand which problems appear, if we try to give such a defintion of dimension.

Posted on Categories Articles

## sql server – Why does FROM multiple tables default to cartesian product?

What was the idea behind doing a cartesian product (cross join) when i did a query like –

``````SELECT * FROM agents, orders
``````

I would think that they would concatenate (like pandas). It feels more natural to add tables instead of multiplying them.

Just curious and did not find on the internet the rationale behind defaulting to cartesian product. I am assuming that syntax `FROM table1, table2` according to SQL would probably be more correct with cross join but why?

Posted on Categories Articles

## plotting – Plot a figure in cartesian XY coordinates in 2D using spherical angles

I have the following equations in $$x$$, $$y$$, $$z$$ coordinates:

$$x = R_0(f(theta,phi)sin(theta)cos(phi) + partial_{theta}f(theta,phi)cos(theta)cos(phi) – partial_{phi}f(theta,phi)sin(phi)/sin(theta)$$

$$y = R_0(f(theta,phi)sin(theta)sin(phi) + partial_{theta}f(theta,phi)cos(theta)sin(phi) + partial_{phi}f(theta,phi)cos(phi)/sin(theta)$$

$$z = R_0(f(theta,phi)cos(theta) – partial_{theta}f(theta,phi)sin(theta)$$

with $$f(theta,phi) = 1 + frac{4epsilon_e}{1-4epsilon_e}(cos^4(theta) + sin^4(theta)(1 -2sin^2(phi)cos^2(phi)))$$

where $$epsilon_e = 0.047, R_0 = 15$$. Here, $$theta,phi$$ are spherical angles

Now, I would like to plot $$(x,y)$$ for $$epsilon_e = 0.047$$ and $$0$$

This is what I have tried:

``````f((Theta)_, (Phi)_) :=
1 + ((4 Subscript((Epsilon), e))/(
1 - 3 Subscript((Epsilon), e)))((
Cos^4)((Theta)) + (
Sin^4)((Theta)) (1 - 2 (Sin^2)((Phi)) (Cos^2)((Phi)) ))
x = Subscript(R, 0)(
f((Theta)_, (Phi)_) Sin((Theta)) Cos((Phi))  +
Diff(f((Theta)_, (Phi)_), (Theta)) Cos((Theta)) Cos((Phi)) -
Diff(f((Theta)_, (Phi)_), (Phi)) Sin((Phi))/Sin((Theta)))

y = Subscript(R, 0)(
f((Theta)_, (Phi)_) Sin((Theta)) Sin((Phi))  +
Diff(f((Theta)_, (Phi)_), (Theta)) Cos((Theta)) Sin((Phi)) +
Diff(f((Theta)_, (Phi)_), (Phi)) Cos((Phi))/Sin((Theta)))

z = Subscript(R, 0)(
f((Theta)_, (Phi)_) Cos((Theta)) -
Diff(f((Theta)_, (Phi)_), (Theta)) Sin((Theta)))
``````

Can anyone suggest how to proceed forward to plot in XY-2D plane ? Do I have to use SphericalPlot or ListPlot?

Posted on Categories Articles

## java – Architectural problem for class combination (cartesian product) for save format strategy

Hello to everyone and thank you for any suggestion.

I have a family of subclasses of `Track` (`Track` is abstract).
Every concrete `Track` has a different number and types of fields (attributes) that extend the basic abstract track-fields.

Then I have a family of file-types that implement some methods (`saveRow()` etc..).
Every file is presumed to have different type of row-formatting (imagine csv tabs, headers etc..)

ex:

• SimpleTrack: double lat, double lon, Calendar dateTime.
• DetectionTrack: (as SimpleTrack) + boolean detection.
• ..
• CsvFile
• TxtFile

When I create a new (X)Track and a (Y) file, they are independent by nature, but.. the row is a cartesian product of track & row types.

EDIT
(to be more clear): How can I have many concrete-tracks in one hand and many FileTypes in the other hand, and create well-formatted-rows (differents for every file) by tracks which have different data (columns, headers..)?
es:

• XtrackRow(double a, double b, Calendar date) -> to -> CVSfile (tab delimited with headers)
• XtrackRow(double a, double b, Calendar date) -> to -> TXTfile (formatted columns and title)
• YtrackRow(double a, string, b, int c, double e) -> to CSV ..
• YtrackRow …. -> to -> docx file (with another kind of table or tabulation)
..

I see two kinds of solutions:

1. Tracks send (right)-formatted row to file: every track has to know which kind of format apply (to rows) to give them to save to any specific type of file.
2. Tracks send raw-data to any kind of file which is responsible to format them: in this case, the file-class must know wich kind of data has to format (every track has diffrent contents, columns, headers..). Moreover, every track-class has to send different number and types of parameter..

The second solution seems to be more fitted to the Single-Responsibility principle.. but I have no Idea how to implement it.

I tried to use Bridge Pattern to solve this problem (using first solution):

``````abstract class Track{
...
FileInterface file;

Track(FileInterface fileType){
this.file = fileType;
}

abstract String formatConcreteTrackRow();

void sendRow(){
String rowToSave = formatConcreteTrackRow();
file.saveRow(rowToSave);
}
}
``````

By this way the problem is not already solved, because every concrete-track has to implement a set of methods which returs right formatted rowString: one for every file-type.
If I use a Strategy Pattern:

``````class SimpleTrack extends Track{
...
RowFormatStrategy rowStrategy;

@override
String formatConcreteTrackRow(){
return this.rowStrategy.getRowString("args")
}
``````

but in this case.. every concrete-track require a different `StrategyInterface`, because every concrete-track has different number and types of arguments to elaborate..
If I do not use Strategy Pattern and I define a set of methods (`formatCsvRow(args)`,`formatTxtRow(args)`..) I need to include a `switch(fileType)` loop to choose which method to use.. breaking SOLID principles.. 🙁

Moreover..
how to impose, for every new concrete-track to have right row-format methods for every existent file-template-row?
and.. How to impose, at the same time, for every new file-class to impose new templates and relative methods in every existent concrete-track?

To be honest, it’s also quite reductive impose `formatConcreteTrackRow` to be a String, but it’s over and over the main problem.

I’m not interested to maintain this kind of class structure, this is only the best solution I found trying to follow SOLID principles. If you can show me a better solution, my intent is to study and understand SOLID procedures to solve these kind of purposes.

(I looked around for similar questions, but I’m not even able to define the specific problem itself..)
Thank you very much.

Posted on Categories Articles

## java – Architettural problem for class combination (cartesian product) for save format strategy

Hello to everyone and thank you for any suggestion.

I have a family of subclasses of `Track` (`Track` is abstract).
Every concrete `Track` has a different number and types of fields (attributes) that extend the basic abstract track-fields.

Then I have a family of file-types that implement some methods (`saveRow()` etc..).
Every file is presumed to have different type of row-formatting (imagine csv tabs, headers etc..)

ex:

• SimpleTrack: double lat, double lon, Calendar dateTime.
• DetectionTrack: (as SimpleTrack) + boolean detection.
• ..
• CsvFile
• TxtFile

When I create a new (X)Track and a (Y) file, they are independent by nature, but.. the row is a cartesian product of track & row types.

EDIT
(to be more clear): How can I have many concrete-tracks in one hand and many FileTypes in the other hand, and create well-formatted-rows (differents for every file) by tracks which have different data (columns, headers..)?
es:

• XtrackRow(double a, double b, Calendar date) -> to -> CVSfile (tab delimited with headers)
• XtrackRow(double a, double b, Calendar date) -> to -> TXTfile (formatted columns and title)
• YtrackRow(double a, string, b, int c, double e) -> to CSV ..
• YtrackRow …. -> to -> docx file (with another kind of table or tabulation)
..

I see two kinds of solutions:

1. Tracks send (right)-formatted row to file: every track has to know which kind of format apply (to rows) to give them to save to any specific type of file.
2. Tracks send raw-data to any kind of file which is responsible to format them: in this case, the file-class must know wich kind of data has to format (every track has diffrent contents, columns, headers..). Moreover, every track-class has to send different number and types of parameter..

The second solution seems to be more fitted to the Single-Responsibility principle.. but I have no Idea how to implement it.

I tried to use Bridge Pattern to solve this problem (using first solution):

``````abstract class Track{
...
FileInterface file;

Track(FileInterface fileType){
this.file = fileType;
}

abstract String formatConcreteTrackRow();

void sendRow(){
String rowToSave = formatConcreteTrackRow();
file.saveRow(rowToSave);
}
}
``````

By this way the problem is not already solved, because every concrete-track has to implement a set of methods which returs right formatted rowString: one for every file-type.
If I use a Strategy Pattern:

``````class SimpleTrack extends Track{
...
RowFormatStrategy rowStrategy;

@override
String formatConcreteTrackRow(){
return this.rowStrategy.getRowString("args")
}
``````

but in this case.. every concrete-track require a different `StrategyInterface`, because every concrete-track has different number and types of arguments to elaborate..
If I do not use Strategy Pattern and I define a set of methods (`formatCsvRow(args)`,`formatTxtRow(args)`..) I need to include a `switch(fileType)` loop to choose which method to use.. breaking SOLID principles.. 🙁

Moreover..
how to impose, for every new concrete-track to have right row-format methods for every existent file-template-row?
and.. How to impose, at the same time, for every new file-class to impose new templates and relative methods in every existent concrete-track?

To be honest, it’s also quite reductive impose `formatConcreteTrackRow` to be a String, but it’s over and over the main problem.

I’m not interested to maintain this kind of class structure, this is only the best solution I found trying to follow SOLID principles. If you can show me a better solution, my intent is to study and understand SOLID procedures to solve these kind of purposes.

(I looked around for similar questions, but I’m not even able to define the specific problem itself..)
Thank you very much.

Posted on Categories Articles

## java – Design pattern problem for class combination (cartesian product) for save format strategy

Hello to everyone and thank you for any suggestion.

I have a family of subclasses of `Track` (`Track` is abstract).
Every concrete `Track` has a different number and types of fields (attributes) that extend the basic abstract track-fields.

Then I have a family of file-types that implement some methods (`saveRow()` etc..).
Every file is presumed to have different type of row-formatting (imagine csv tabs, headers etc..)

ex:

• SimpleTrack: double lat, double lon, Calendar dateTime.
• DetectionTrack: (as SimpleTrack) + boolean detection.
• ..
• CsvFile
• TxtFile

When I create a new (X)Track and a (Y) file, they are independent by nature, but.. the row is a cartesian product of track & row types.

I see two kinds of solutions:

1. Tracks send (right)-formatted row to file: every track has to know which kind of format use to send formatted-row to a specific type of file.
2. Tracks send raw-data to file which is responsible to format them: in this case, the file class must know wich kind of data has to format (headers, type of data..). Moreover, every track-class has to send different number and types of parameter..

The second solution seems to be more fitted to the Single-Responsibility principle.. but I have no Idea how to implement it.

I tried to use Bridge Pattern to solve this problem (using first solution):

``````abstract class Track{
...
FileInterface file;

Track(FileInterface fileType){
this.file = fileType;
}

abstract String formatConcreteTrackRow();

void sendRow(){
String rowToSave = formatConcreteTrackRow();
file.saveRow(rowToSave);
}
}
``````

By this way the problem is not already solved, because every concrete-track has to implement a set of methods which returs right formatted rowString: one for every file-type.
If I use a Strategy Pattern:

``````class SimpleTrack extends Track{
...
RowFormatStrategy rowStrategy;

@override
String formatConcreteTrackRow(){
return this.rowStrategy.getRowString("args")
}
``````

but in this case.. every concrete-track require a different `StrategyInterface`, because every concrete-track has different number and types of arguments to elaborate..
If I do not use Strategy Pattern and I define a set of methods (`formatCsvRow(args)`,`formatTxtRow(args)`..) I need to include a `switch(fileType)` loop to choose which method to use.. breaking SOLID principles.. 🙁

Moreover..
how to impose, for every new concrete-track to have right row-format methods for every existent file-template-row?
and.. How to impose, at the same time, for every new file-class to impose new templates and relative methods in every existent concrete-track?

To be honest, it’s also quite reductive impose `formatConcreteTrackRow` to be a String, but it’s over and over the main problem.

I’m not interested to maintain this kind of class structure, this is only the best solution I found trying to follow SOLID principles. If you can show me a better solution, my intent is to study and understand SOLID procedures to solve these kind of purposes.

(I looked around for similar questions, but I’m not even able to define the specific problem itself..)
Thank you very much.

Posted on Categories Articles

## database design – Cartesian product of same set in oracle not working

Why aren’t you allows to use JOIN? Must be an artificial restriction for a homework problem.

There are several uses of ‘AS’ in your code. The problematic one is

``````FROM Sells, Sells AS Temp1
``````

So check the SQL Language Reference, and you will see there is no use of AS in this context. Take it out.

But before that, you have a problem with the name of the table you are creating.

``````CREATE TABLE 4
``````

That’s an invalid object name.

And after you fix all of those things, you will get errors on your use of ‘==’ as a relational operator. It’s a single ‘=’.

There a still more errors when all of those are fixed. And in the end, I’m puzzeled as to the desired outcome – the purpose of this exercise at all.

Two key references:
minimal-reproducible-example
SQL Language Reference

Posted on Categories Articles

## How do I convert the argument of a dirac delta function from cartesian coordinates to spherical coordinates?

I have V(x)=Aδ(x) where I needed to convert the argument from cartesian to spherical, namely from δ(x) to δ(r) so I can compute an integral involving V in dr. I don’t understand the dirac delta quite well so I have little idea how to do this. Any help would be greatly appreciated. Thanks!

Posted on Categories Articles

## multivariable calculus – Bounds on triple integral (Cartesian)

I want to setup a triple integral for the volume of the surface in the ordering $$dy hspace{1mm} dz hspace{1mm} dx$$: So far I have that for $$0leq z leq 1, 0 leq y leq x$$ and for $$1 leq z leq 2, 0 leq y leq sqrt{2-z}$$. I’m having trouble setting up bounds for $$x$$. It looks from the projection like $$0 leq x leq 1$$ for both integrals, but it doesn’t give me the right value for volume (should be $$frac{11}{12}$$ based on the other differential orderings.)

Posted on Categories Articles