FIND A VECTOR IN R4

3 ビュー (過去 30 日間)
Coupe Honda
Coupe Honda 2017 年 2 月 1 日
回答済み: Walter Roberson 2017 年 2 月 1 日
Find a vector x∈R4, all of whose elements are distinct nonzero integers, for which ||x||1 = 11, another vector for which ||x||2 = 11, and yet another for which ||x||inf = 11

採用された回答

Niels
Niels 2017 年 2 月 1 日
really? this does not look like homework, nooo
[1 1 1 8]
[1 2 4 100]
[1 1 1 11]

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 2 月 1 日
Use randi to generate four random integers. Test to see whether they have the desired property; if not then keep generating.
How long this will take will depend upon the original range you generate over.
Another approach would be to note that for all of those norms, adding another value cannot decrease the norm. So you can generate a random first value and test that the norm of it does not exceed the target; if it does then you keep generating. Then generate a second value and test that the combination of it and the first value does not exceed the norm; if it does then you keep generating the second value. And so on until the 4th. But you have to be careful: some initial sequences can make it impossible for the condition to be satisfied. You can do a lot better with some reasoning about the random number generation.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by