How to find the number of values that are odd?
5 次查看(过去 30 天)
显示 更早的评论
How do you write a matlab code to find the number of values that are odd mutliples of 11 or 13?
3 个评论
回答(1 个)
Andrey Smolyakov
2020-6-16
If I understand you correctly, you may try something like this:
x = 120:230;
m = x((mod(x,11)==0 | mod(x,13)==0) & mod(x,2)==1);
11 个评论
Andrey Smolyakov
2020-6-16
Just take a look into the Workspace. There will be variable m, which is conatain desired data. Or just delete semicolumn at the and of the second line before execution, MATLAB will aucomatically print m to the Command Window.
Rik
2021-3-14
@Ron Mahabir regarding your flag ("Please remove this content. This is an assignment question and the posting of this question online to seek answers was strictly prohibited. This was made clear to the student. Relevant action will be taken at the administrative level for this act on the student's part. I appreciate your understanding in this matter.")
This answer is not the offending part. The posting of the question is. Why are you flagging the answer, if you would only conceivably have the right to request deletion of the question?
Also I don't work for Mathworks, and I'm not a lawyer, but nothing in the question sounds like it is specific enough to be copywritable.
John D'Errico
2021-3-15
Yes. The problem is with the question, though the responder should have had the good judgement to not do the student's homework. My question is why is this a problem 9 months after the question was posted?
Ron Mahabir
2021-3-15
Thanks all for the responses. Trying not to make this into a dialog, and nothing to do with who answered the question: (1) Some questions are somewhat identifiable, especially if you look at the specific timestamps, among other markers, and (2) realistically, courses can repeat from one period to the other, and its not always easy to catch everything on the first go. This can be a longer discussion elsewhere I think.
Walter Roberson
2021-3-15
编辑:Walter Roberson
2021-3-15
As one of the most active volunteers with over 50000 contributions: I feel little responsibility to tailor my contributions against the possibility that somewhere sometime in the future some professor or TA might want to reuse a question without change.
I do spend a lot of time educating people about MATLAB and programming concepts, avoiding doing people's homework for them even when one or two lines would solve the problem at hand, in favor of leading them to understand what and why.
I did not happen to contribute to this particular Question; if I had, I would definitely object to having my contribution removed without compensation.
I would, for example, point to certain provisions in US Title 17 such as Chapter 1 paragraph 101 to claim that you had no enforceable copyright over the matter that the user posted, and that instead relevant jurisdiction is UTSA (Uniform Trade Secrets Act), and that accordingly you have no cause in law to require that anyone's content be removed (but you would potentially have cause for action against the student for allegedly revealing the secret.)
Ron Mahabir
2021-3-15
@Walter Roberson that is a very interesting point of view. In that case, would it even be possible to challege/enforce the following situation in any context:
"...certain provisions in US Title 17 such as Chapter 1 paragraph 101 to claim that you had no enforceable copyright over the matter that the user posted"
For example, is there a special set of conditions that the pusuant would need to meet, and would be possible to meet, for the above to situation to be in their favor?
Walter Roberson
2021-3-15
The user used their own phrasing to express the idea. Ideas cannot be copyrighted, only their expression can, and the user used their own expression.
You made the homework available to a restricted set of people (you can even make a list of people authorized to read the homework, by the class lists) and enjoined them not to make the homework public. The paragraph 101 definition of "Publication" requires that the work be available to the general public, so it was not "Published". If, hypothetically, the user had copied the exact words from the assignment, then the user would become the Publisher of the words for the purposes of Title 17. Published without authorization, potentially, but your rights as alleged author of allegedly exact original words are rather constrained for a non-for-profit publication.
But you didn't allege that the user posted an exact copy of the assignment, and considering that the user only wrote one sentance and that the user phrased it as a question rather than a command, I don't think you are going to be able to get anywhere on a claim of exact copy of words or even of a "substantial" excerpt or derivative work.
You also didn't go after the posting; you went after the responses, including the fact that the response you flagged includes none of the original words from the post other than the word "you". So you are not going after people for copyright, you are going after them for the ideas expressed.
Going after people for the ideas expressed is impossible in copyright law, and is solely the rhealm of Trade Secret (unless you want to claim that National Defence was involved!), in which case you would have to claim that the ideas that the volunteers expressed were secret ideas that you controlled and which the volunteers had misappropriated. Such a claim would go precisely no-where in court, as the volunteers clearly worked based upon ideas that the user expressed. So if there is a Trade Secret action, it would be solely against the user. It is fundamental to Trade Secret that once a secret is revealed in public that the secret is no longer protected, with the exception of cases where you can prove that the people making use of the secret (that is, the volunteers) had "induced" the user to reveal the secret. That's not going to happen. (And if you did go after the user under Trade Secret, I would direct them to a simple line of defense that would invalidate the claims with respect to the ideas at hand.)
Now, if you were to tell me at this time that actually the homework was Published under law (such as if it were available to the public from your university web site without any requirement that the receiver certify that they were part of the university), then I would proceed to point you to the Fair Use provisions of Title 17. If the work is even published at all, then there are specific exemptions under Title 17 for "short excerpts" for the purpose of discussion and criticism, and the posters clearly engaged in discussion and criticism of the ideas expressed.
The volunteers did not "cause" the ideas to be first published, and they engaged in Fair Use of the ideas. You have no grounds for asking that their works be removed.
I would suggest that you drop this matter as a learning opportunity.
If the user violated academic rules, then sure, deal with them under academic processes. I personally think that academic rules that prevent students from seeking tutoring are Bad Rules.
In my opinion, the role of educators is to teach the ideas at hand, by any means that is feasible for the educators and which helps the students learn; the role of educators is not to stress-test students to see if they already came into the situation with relevant experience, or to stress-test them to see how much load they can carry single-handedly. There are some universities in developing countries that take the approach of trying to find the "best" in the country by putting impossible loads on people and discarding the ones that "break"; what those universities do is instead find the people who are best at cheating and locating work that other people have done and doing minimal modifications to it.
Conversely, as a de factor educator myself, I believe firmly that it is inappropriate for tutors to do a student's work for them, even if the solution is short and the claimed urgency is high. I regularly turn students away in email, telling them that I am not available to be hired by undergraduates. I teach people things they need to understand in order to be able to do assignments themselves.
And I do not believe that it is constructive for universities to tell students that they cannot reach out to me or the other volunteers for assistance in learning concepts. You are a professor and a researcher: did you get into your field in order to put up arbitrary road-blocks to learning, or did you get into your field in order to promote learning?
I would suggest that you get rid of your rules in their current form about having students post here (or elsewhere) about concepts involved with their coursework and assignments. I would be completely supportive of rules designed to keep students from asking for homework solutions -- as long as they could ask about the ideas involved.
If you are concerned about "unequal access" then you can outright point students to here and say "Hey, there are volunteer tutors there that you can ask about concepts and to explain error messages and help you figure out your misconceptions -- but if you outright ask for homework answers then that will be considered Cheating!". Our most-used FAQ here is this link on how to ask questions; we actively force people to work for their answers. (But please do remember that we have limited load capacity; some of us are holding about 50 simultaneous conversations every day. We "drop the ball" sometimes.)
That said, although I disagree with rules blocking students for reaching out for tutoring, I do recognize the right of universities to impose such rules. so if you need to sanction the users academically for having done so, then you gotta do what you gotta do. If, for example, your purpose is to teach that bad rules are more important than good learning.
In the meaning, with respect to this particular assignment, I offer you this variation that you can use to personalize the assignment without much extra effort at all: Instead of fixing the two primes that the students have to work with, have them take the last two digits of their student numbers, find the first two primes that are as least as large, and work with those. (This can potentially lead to primes 101 and 103, so you might need to expand the range a bit.)
Rik
2021-3-15
Thank you for articulating this Walter. I couldn't agree more (at least as far as my legal knowledge on this subject goes).
Regarding that last suggestion: you can generalize this by using the student ID as the random seed and using the random functions to generate the assignment values:
ID='s1000430';
rng(str2double(ID(isstrprop(ID,'digit'))))
numbers=randi([10 100],200,1);
numbers=numbers(isprime(numbers));
numbers=sort(numbers(1:2))
numbers = 2×1
11
13
Ron Mahabir
2021-3-15
Thanks @Walter Roberson and @Rik for the great ideas. I am definitely going to use the feedback and suggestions.
Rik
2021-3-17
@Ron Mahabir Do you still requestion deletion of the two answers? If not, feel free to remove the flags. I could also do that, but I would prefer it if you did.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)